MOM6: Cleaned up vertical parameterization code#947
Merged
adcroft merged 88 commits intoJul 11, 2019
Conversation
Obsoleted the runtime parameter USE_VISBECK_SLOPE_BUG, which is no longer in use by any active experiments. This has been added to the list of obsolete parameters in MOM_obsolete_params, and any attempt to use this parameter will result in a fatal error. Also added units to the get_param call for KD_SMOOTH. All answers are bitwise identical in the MOM6-examples test cases, but there are minor changes to some MOM_parameter_doc files.
Removed the unused runtime parameters KDML and HMIX_FIXED from the MOM_set_diffusivity module. These changes do not change answers, and they do not change MOM_parameter_doc files because these same parameters were already being logged in bkgnd_mixing_init, which is called just before the get_param calls that were eliminated. All answers are bitwise identical.
Replaced real powers squaring values with integer powers at various places in the code. Fortunately, the answers do not change.
Reformatted parts of the MOM_energetic_PBL code for greater clarity and consistency, and added comments documenting parts of the code. All answers are bitwise identical.
Conflicts: src/parameterizations/vertical/MOM_energetic_PBL.F90 - Conflict handled by hand.
Added parentheses to a 3-term sum in add_drag_diffusivity, using the order that reproduces the answers with three compilers. All answers in the MOM6-examples test cases are bitwise identical.
Merged in Brandon Reichl's modifications to the MOM_energetic_PBL code. As a part of the merge, several units= arguments to MOM_get_param calls were fixed. The merged in code changes the entries in the MOM_parameter_doc files and eliminates at least one unused option, but all answers in the MOM6-exmaples test cases are bitwise identical.
Various code clean-up in MOM_energetic_PBL, including the following: Corrected the indenting. Commented out some variables that were only of use for debugging during model development. Restored several lines that do simple assignments on a single line with semicolons. Followed MOM6 standards with regard to the non-use of argument names for non-optional arguments. Corrected the case of the K index for the interface variable Kd in a number of places. Added some comments documenting various options. Added units to the comments describing several subroutine arguments. All answers are bitwise identical and there are no changes to MOM_parameter_doc files.
Eliminated unused code and options in MOM_energetic_PBL, including the recently added but as yet unused and incompletely implemented option LT_ENHANCE_K_R16 and the two duplicated subroutines ust_2_u10_coare3p5 and get_LA_windsea, which are available via the MOM_wave_interface module. Also eliminated code associated with mstar_mode == 1 and some debugging code. Fixed the accumulation of some TKE budget diagnostics when there are multiple iterations, and added comments with notes about additional changes. All answers are bitwise identical in the MOM6-examples test cases, but some of the MOM_parameter_doc.all files have had one entry deleted.
Added the new run-time parameter EPBL_2018_ANSWERS and removed the unused runtime parameters N2_DISSIPATION_POS and N2_DISSIPATION_NEG. Also added flags to only log ePBL parameters when the options that use them are enabled. It has been verified that the answers in the MOM6-examples test cases do differ, but only slightly when EPBL_2018_ANSWERS=False. By default all answers are bitwise identical, but some run-time options have changed, as have the MOM_parameter_doc files.
Eliminated the i-index in a number of the arrays in the ePBL code, in preparation to introduce a column-oriented subroutine at the heart of ePBL. Some diagnostics of mixed layer depths are now being set to 0 over land, but all answers are bitwise identical.
Eliminated the duplicated copy of the mixed layer depth from start of the final iteration, eliminated the semi-redundant diagnostics ePBL_OSBL, and changed to using the final estimate of the mixed layer depth for the first guess of the next timestep when MLD_ITERATION_GUESS is true. This later option would change answers, no MOM6-examples test cases use MLD_ITERATION_GUESS = True, and this option is recent and does not reproduce across restarts. This change alters some available_diags files, and could change answers in some cases (although this seems unlikely).
Eliminated the infrequently used ePBL diagnostics ePBL_Hs_used, LT_Enhancement, MLD_EKMAN, MLD_OBUKHOV, and EKMAN_OBUKHOV, while MSTAR_LT includes all increases to mstar due ot Langmuir Turbulence, whether this is actually implemented via addition or rescaling. All answers are bitwise identical, but there are changes to the available_diags files.
Added a type for convenience in passing around ePBL column diagnostics. All ansewrs are bitwise identical.
Added the new subroutine ePBL_column in MOM_energetic_PBL.F90, but is it not being called yet. All answers are bitwise identical.
Added a call to ePBL_column and eliminated duplicated code from energetic_PBL. All answers are bitwise identical.
Do dimensional consistency testing for depth and time units in ePBL_column. Also modified comments to reflect the rescaled dimensions. All answers are bitwise identical.
Change units of ustar in get_Langmuir_number to [Z T-1], to concentrate the unit conversion factors for dimensional consistency testing in the MOM_wave_interface code. Also made some minor revisions in MOM_energetic_PBL to cancel out unit conversion factors. All answers are bitwise identical.
Replaced the enumerated runtime parameter MSTAR_MODE with the named EPBL_MSTAR_SCHEME and similarly for LT_ENHANCE and EPBL_LANGMUIR_SCHEME. The old names still work as before but with a warning message and the new names and values are logged. All answers are bitwise identical, but there are changes to the MOM_parameter_doc files.
Replaced the enumerated runtime parameter EPBL_VEL_SCALE_MODE with the named EPBL_VEL_SCALE_SCHEME. Also renamed VSTAR_SCALE_FACTOR as EPBL_VEL_SCALE_FACTOR, properly obsoleting the name VSTAR_SCALE_FACTOR. All answers are bitwise identical, but there are changes to the MOM_parameter_doc files.
Added a new runtime parameters to enable the use of a more robust algorithm for the the iterative calculation of the open face lengths when the minimum layer thickness is 0. Answers change minorly in some test casess when this new option is set to false. By default all answers are bitwise identical, but the MOM_parameter_doc.all files have a new entry.
Added a two new runtime parameters, ML_RAD_BUG and SET_DIFF_2018_ANSWERS, to correct a bug in the calculation of the TKE available to drive mixing with the ML_RADIATION scheme, and to avoid the redundant calculation mathematically equivalent expressions via direct division or multiplication by a reciprocal in find_TKE_to_Kd. Also corrected a vertical loop extent in legacy_diabatic, with no apparent consequences. Answers change slightly in some test cases when SET_DIFF_2018_ANSWERS is set to false, and more substantially when ML_RADIATION is true and ML_RAD_BUG is false. By default all answers are bitwise identical, but the MOM_parameter_doc.all files have a new entry.
Extended the dimensional scaling test in vertical parameterization code. Rescaled SkinBuoyFlux and cTKE in applyBoundaryFluxesInOut and pass these rescaled fluxes to energetic_PBL. Rescaled Kd_ePBL returned from energetic_PBL. Pass rescaled timesteps to energetic_PBL and entrainment_diffusive, and canceled out rescaling factors inside of entrainment_diffusive. All answers are bitwise identical.
Added the new subroutine set_pen_shortwave to the MOM_diabatic_aux module to initially act as a convenient interface to set_opacity, but ultimately to handle setting up chlorophyll concentrations and allow set_opacity to be merged with MOM_shortwave_abs. All answers are bitwise identical, but there is a new public interface.
Moved code setting chlorophyll into set_pen_shortwave, along with moving the parameters controlling how this is set into the MOM_diabatic_aux module control structure. All answers are bitwise identical, but the order of entries in the MOM_parameter_doc files has changed.
Combined the MOM_shortwave_abs and MOM_opacity modules. All answers are bitwise identical, but one type and two subroutines are now found in a different module.
Explicitly declared the dimensions of the pen_SW_bnd arguments to extractFluxes1d and extractFluxes2d. This would fix a problem if MOM6 were using global indexing. All answers are bitwise identical.
Added the extractor routines extract_optics_slice, extract_optics_fields and optics_nbands to the MOM_opacity module, in preparation for possibly making the optics type opaque. All answers are bitwise identical, but there are new public subroutines.
Added nsw arguments to calculateBuoyancyFlux1d and applyBoundaryFluxesInOut to avoid directly using elements of the optics type. All answers are bitwise identical, but two public interfaces have changed.
Added a copy of the FRACTIONAL_ROUGHNESS_MAX run-time parameter to the MOM_internal_tide_input module. All answers are bitwise identical in the MOM6-examples test cases.
Added 3 new runtime parameters, OPTICS_2018_ANSWERS, PEN_SW_FLU_ABSORB and PEN_SW_ABSORB_MINTHICK, to the MOM_opacity module. Also added a new optics argument to absorbRemainingSW and added verticalGrid_type and unit_scale_type arguments to opacity_init. By default, all answers are bitwise identical, but there are non-optional changes to public interfaces and new runtime parameters are added to some MOM_parameter_doc files.
Revised the get_param message for BBL_MIXING_MAX_DECAY to be consistent with how the code actually works, and changed the code to handle 0 values as documented. Also altered the default value to 200 m so that the answers will reproduce the previous solutions, unless BBL_MIXING_MAX_DECAY was explicitly being set to 0 or a negative value, in which case the revised code will match the intended behavior as documented. All answers are bitwise identical in the existing MOM6-examples, but some MOM_parameter_doc files change and some solutions could change, in which case setting BBL_MIXING_MAX_DECAY=200 will reproduce the previous solutions.
Added a dimensional scaling factor that was dropped when changes from dev/gfdl were automatically merged into the new branch. All answers are bitwise identical and now pass the dimensional scaling test.
Split excessively long lines and corrected the syntax for unit documentation in MOM_lateral_mixing_coeffs.F90 and MOM_thickness_diffuse.F90. All answers are bitwise identical.
Improved calculation of SW_trans for very small penetrating shortwave fluxes when OPTICS_2018_ANSWERS = False. By default and for the MOM6-examples test cases, all answers are bitwise identical.
Added dimensional rescaling for forces%ustar, fluxes%ustar, fluxes%ustar_berg, fluxes%ustar_tidal, and fluxes%ustar_gustless, all of which are now in units of [Z T-1 ~> m s-1]. All answers are bitwise identical and are passing the dimensional consistency tests.
Use an unscaled g_Earth from the control structures for the various MOM_surface_forcing modules when USE_RIGID_SEA_ICE is True, rather than assuming that the version of g_Earth in the lateral grid has not been scaled. All answers are bitwise identical, and the MOM_parameter_doc files are unchanged because other modules read G_EARTH before MOM_surface forcing.
Rescaled units of g_Earth in the parameterizations/vertical code for improved dimensional consistency testing. Also added an unscaled version of g_Earth and a fully scaled version in the verticalGridtype. All answers are bitwise identical and are passing the dimensional consistency testing for time and length units.
Added the new runtime parameter DEFAULT_2018_ANSWERS to set the default for all of the ..._2018_ANSWERS parameters. By default all answers are bitwise identical, but there is a new entry in the MOM_parameter_doc files.
Added the new runtime parameter WIND_GYRES_2018_ANSWERS to enable the transition to newer and simpler expressions for ustar in the gyres option of the solo_driver version of MOM_surface_forcing. Also replaced the markers in the comments around the controlled-forcing code with #CTRL# to distinguish them from other comments. By default all answers are bitwise identical, but there is a new entry in some MOM_parameter_doc files.
Added the new runtime parameter SURFACE_FORCING_2018_ANSWERS to enable the transition to newer and simpler expressions for gustless_ustar in the coupled_driver version of MOM_surface_forcing. Also replaced the markers in the comments around the controlled-forcing code with #CTRL# to distinguish them from other comments. By default all answers are bitwise identical, but there is a new entry in some MOM_parameter_doc files.
Collaborator
Author
|
This PR is being tested with https://gitlab.gfdl.noaa.gov/ogrp/MOM6/pipelines/8447 |
adcroft
requested changes
Jul 10, 2019
Collaborator
adcroft
left a comment
There was a problem hiding this comment.
The doxygen phase of the Travis-CI tests failed: there's an undocumented argument langmuir_number in Mstar_Langmuir() of ePBL which is due to syntax. Message from the Travis-CI log:
/home/travis/build/NOAA-GFDL/MOM6/src/parameterizations/vertical/MOM_energetic_PBL.F90:1846: warning: The following parameters of mom_energetic_pbl::mstar_langmuir(type(energetic_pbl_cs), pointer CS, type(unit_scale_type), intent(in) US, real, intent(in) abs_Coriolis, real, intent(in) buoyancy_flux, real, intent(in) ustar, real, intent(in) BLD, real, intent(in) Langmuir_Number, real, intent(inout) mstar, real, intent(out) mstar_LT, real, intent(out) Convect_Langmuir_Number) are not documented:
parameter 'langmuir_number'
Fixed the doxyGen comment for Langmuir_number in the arguments to Mstar_Langmuir. All answers are bitwise identical
Collaborator
Author
|
The requested change has been made, and the revised version is being tested at https://gitlab.gfdl.noaa.gov/ogrp/MOM6/pipelines/8450. |
MJHarrison-GFDL
pushed a commit
to MJHarrison-GFDL/MOM6
that referenced
this pull request
Aug 6, 2025
* (*) Multiple fixes for the ray tracing - Solve the issue of rays not propagating through the northfold: the use of pass_vector for speed_[x/y] is not appropriate since these arrays are meant to be scalar and the direction is contained in the angle dimension of energy. changing to regular pass_var at the appropriate cell location fixes it - The energy gets trapped at critical latitude: this PR introduces 2 options for energy propagation, either propagate along the critical latitude or reflect on it. These are controlled by TURN_CRITICAL_LAT (False: get trapped, True: do something) and REFLECT_CRITICAL_LAT (True: reflect like a solid wall, False: propagate along) - Several divisions by constant number were eliminated * (*) Multiple fixes for the ray tracing - Solve the issue of rays not propagating through the northfold: the use of pass_vector for speed_[x/y] is not appropriate since these arrays are meant to be scalar and the direction is contained in the angle dimension of energy. changing to regular pass_var at the appropriate cell location fixes it - The energy gets trapped at critical latitude: this PR introduces 2 options for energy propagation, either propagate along the critical latitude or reflect on it. These are controlled by TURN_CRITICAL_LAT (False: get trapped, True: do something) and REFLECT_CRITICAL_LAT (True: reflect like a solid wall, False: propagate along) - Several divisions by constant number were eliminated * add call to turning latitude in propagate_x This should satisfy the rotational symmetry. As expected, this has no impact on global case since reflected energy from propagate_x then does not need to be reflected in propagate_y. * update units order --------- Co-authored-by: Raphael Dussin <Raphael.Dussin@noaa.gov>
herrwang0
pushed a commit
to herrwang0/MOM6
that referenced
this pull request
Aug 27, 2025
* (*) Multiple fixes for the ray tracing - Solve the issue of rays not propagating through the northfold: the use of pass_vector for speed_[x/y] is not appropriate since these arrays are meant to be scalar and the direction is contained in the angle dimension of energy. changing to regular pass_var at the appropriate cell location fixes it - The energy gets trapped at critical latitude: this PR introduces 2 options for energy propagation, either propagate along the critical latitude or reflect on it. These are controlled by TURN_CRITICAL_LAT (False: get trapped, True: do something) and REFLECT_CRITICAL_LAT (True: reflect like a solid wall, False: propagate along) - Several divisions by constant number were eliminated * (*) Multiple fixes for the ray tracing - Solve the issue of rays not propagating through the northfold: the use of pass_vector for speed_[x/y] is not appropriate since these arrays are meant to be scalar and the direction is contained in the angle dimension of energy. changing to regular pass_var at the appropriate cell location fixes it - The energy gets trapped at critical latitude: this PR introduces 2 options for energy propagation, either propagate along the critical latitude or reflect on it. These are controlled by TURN_CRITICAL_LAT (False: get trapped, True: do something) and REFLECT_CRITICAL_LAT (True: reflect like a solid wall, False: propagate along) - Several divisions by constant number were eliminated * add call to turning latitude in propagate_x This should satisfy the rotational symmetry. As expected, this has no impact on global case since reflected energy from propagate_x then does not need to be reflected in propagate_y. * update units order --------- Co-authored-by: Raphael Dussin <Raphael.Dussin@noaa.gov>
Hallberg-NOAA
pushed a commit
to Hallberg-NOAA/MOM6
that referenced
this pull request
Aug 29, 2025
* (*) Multiple fixes for the ray tracing - Solve the issue of rays not propagating through the northfold: the use of pass_vector for speed_[x/y] is not appropriate since these arrays are meant to be scalar and the direction is contained in the angle dimension of energy. changing to regular pass_var at the appropriate cell location fixes it - The energy gets trapped at critical latitude: this PR introduces 2 options for energy propagation, either propagate along the critical latitude or reflect on it. These are controlled by TURN_CRITICAL_LAT (False: get trapped, True: do something) and REFLECT_CRITICAL_LAT (True: reflect like a solid wall, False: propagate along) - Several divisions by constant number were eliminated * (*) Multiple fixes for the ray tracing - Solve the issue of rays not propagating through the northfold: the use of pass_vector for speed_[x/y] is not appropriate since these arrays are meant to be scalar and the direction is contained in the angle dimension of energy. changing to regular pass_var at the appropriate cell location fixes it - The energy gets trapped at critical latitude: this PR introduces 2 options for energy propagation, either propagate along the critical latitude or reflect on it. These are controlled by TURN_CRITICAL_LAT (False: get trapped, True: do something) and REFLECT_CRITICAL_LAT (True: reflect like a solid wall, False: propagate along) - Several divisions by constant number were eliminated * add call to turning latitude in propagate_x This should satisfy the rotational symmetry. As expected, this has no impact on global case since reflected energy from propagate_x then does not need to be reflected in propagate_y. * update units order --------- Co-authored-by: Raphael Dussin <Raphael.Dussin@noaa.gov>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR includes a series of changes that address minor problems with the
vertical parameterization code or augment the dimensional consistency testing
within this code, including new options that correct bugs or update algorithms.
By default, none of these updates change answers, but there are number of
changes to the MOM_parameter_doc files. MOM6 commits with this PR include: