-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-reproducible trigonometric functions in viscous BBL #483
Comments
This code is directly solving for the root of a cubic equation using trigonometric functions. These roots are well bracketed and well-behaved, so we could replace this code snippet with an iterative Newton's method solver that should of comparable cost and accuracy, but we would need to preserve this code wrapped in an answer-date flag because it has been used for several years in published solutions. |
Refactored set_viscous_BBL to separate out the routines setting the open interface lengths used for the channel drag, shortening a 1070 line long routine to 915 lines and reducing the scope of a number of temporary variables. A number of logical branch points have been moved outside of the innermost do loops. This refactoring will also make it easier to provide alternatives to some of the solvers that do not use the trigonometric functions to solve for the roots of a cubic expression and avoiding the issues noted at NOAA-GFDL/issues/483. All answers are bitwise identical and public interfaces are unchanged.
Refactored set_viscous_BBL to separate out the routines setting the open interface lengths used for the channel drag, shortening a 1070 line long routine to 915 lines and reducing the scope of a number of temporary variables. A number of logical branch points have been moved outside of the innermost do loops. This refactoring will also make it easier to provide alternatives to some of the solvers that do not use the trigonometric functions to solve for the roots of a cubic expression and avoiding the issues noted at NOAA-GFDL/issues/483. All answers are bitwise identical and public interfaces are unchanged.
Refactored set_viscous_BBL to separate out the routines setting the open interface lengths used for the channel drag, shortening a 1070 line long routine to 915 lines and reducing the scope of a number of temporary variables. A number of logical branch points have been moved outside of the innermost do loops. This refactoring will also make it easier to provide alternatives to some of the solvers that do not use the trigonometric functions to solve for the roots of a cubic expression and avoiding the issues noted at NOAA-GFDL/issues/483. All answers are bitwise identical and public interfaces are unchanged.
Refactored set_viscous_BBL to separate out the routines setting the open interface lengths used for the channel drag, shortening a 1070 line long routine to 915 lines and reducing the scope of a number of temporary variables. A number of logical branch points have been moved outside of the innermost do loops. This refactoring will also make it easier to provide alternatives to some of the solvers that do not use the trigonometric functions to solve for the roots of a cubic expression and avoiding the issues noted at NOAA-GFDL/issues/483. All answers are bitwise identical and public interfaces are unchanged.
Refactored set_viscous_BBL to separate out the routines setting the open interface lengths used for the channel drag, shortening a 1070 line long routine to 915 lines and reducing the scope of a number of temporary variables. A number of logical branch points have been moved outside of the innermost do loops. This refactoring will also make it easier to provide alternatives to some of the solvers that do not use the trigonometric functions to solve for the roots of a cubic expression and avoiding the issues noted at /issues/483. All answers are bitwise identical and public interfaces are unchanged.
Added the new routine find_L_open_concave_iterative to use iterative Newton's method approaches with appropriate limits to solve the cubic equation for the fractional open face lengths at interfaces that are used by the CHANNEL_DRAG code. These solutions are analogous to those given by the previous expressions that are now in find_L_open_concave_trigonometric, and the two differ at close to roundoff, but the new method is completely independent of the transcendental function library, thereby addressing dev/gfdl MOM6 issue #483. This new routine is called when the new runtime parameter TRIG_CHANNEL_DRAG_WIDTHS is set to false, but by default the previous answers are recovered. By default all answers are bitwise identical, but there is a new runtime parameter in some MOM_parameter_doc files.
The new options for solving the cubic equations for the open face lengths that were introduced with #543 allow the user to avoid using these trigonometric functions by setting TRIG_CHANNEL_DRAG_WIDTHS. The fact that the new options are both more accurate and more efficient should be motivation for them to be used routinely, but the existing solver that uses trigonometric functions does need to be retained to avoid changing answers for existing solutions. This issue has been as thoroughly addressed as it can be, so it should now be closed. |
There are trigonometric functions in the calculation of the bottom boundary layer viscosity,
set_viscous_BBL()
, of the formcos(acos(x)/3 - 2*pi/3)
.These functions may to be responsible for an answer change when transitioning from an Intel to AMD processor:
Compilers were identical across machines. AFAIK, Intel does not use the C math library to compute these functions.
CHANNEL_DRAG = False
restores answers, hinting that these functions may be responsible for the change in answers. In any case, they are recognized as a potential source of answer changes.We may want to consider replacing these expressions with a bit-reproducible approximation.
Snippet containing the lines is shown below.
MOM6/src/parameterizations/vertical/MOM_set_viscosity.F90
Lines 939 to 963 in 25b57f4
The text was updated successfully, but these errors were encountered: