-
Notifications
You must be signed in to change notification settings - Fork 60
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
*+Add ePBL bottom boundary layer mixing option #717
base: dev/gfdl
Are you sure you want to change the base?
Conversation
3034aed
to
60b636b
Compare
I am converting this to a draft PR , because while I believe that it is correct (and worth assessing), I think that it could be made much more efficient. We are not using released mean kinetic energy to drive added bottom boundary layer mixing, which means that we can solve directly for the diffusivity that can be supported by a given energy increment without having to do so iteratively with Newton's method. |
Corrected a bug that causes ePBL column to set the wrong variable and then use an uninitialized variable when EPBL_ORIGINAL_PE_CALC is set to false. This bug was present when the EPBL_ORIGINAL_PE_CALC was first added on Sept. 30, 2016, but it was not detected because only the default case with EPBL_ORIGINAL_PE_CALC = True appears to being used or tested. Any runs that used this code with debugging compile options would have trapped it immediately. This will change answers when EPBL_ORIGINAL_PE_CALC is false.
Added the new runtime parameter EPBL_MLD_ITER_BUG that can be set to false to correct buggy logic that gives the wrong bounds for the next iteration when USE_MLD_ITERATION is true and successive guesses increase by exactly EPBL_MLD_TOLERANCE. By default all answers are bitwise identical, but there is a new runtime parameter in some MOM_parameter_doc files.
Added the ability to passively run ePBL_column twice in a diagnostic mode and then provide diagnostics of the differences in the diffusivities and boundary layer depths that are generated with the two options. This is controlled by the new runtime parameter EPBL_OPTIONS_DIFF, which is an integer that specifies which options to change or 0 (the default) to disable this capability. Associated with this are the new diagnostics ePBL_opt_diff_Kd_ePBL, ePBL_opt_maxdiff_Kd_ePBL and ePBL_opt_diff_h_ML, which only are registered when the differencing is enabled. For now, only changes associated with the settings of EPBL_ORIGINAL_PE_CALC and EPBL_ANSWER_DATE can be evaluated, but this list will grow as new options are added. As a part of these changes, there were some other reforms to the way that MOM_energetic_PBL handles diagnostics, with the 2-d and 3-d arrays changed from allocatable arrays with enduring memory commitments in the energetic_PBL_CS type into simple arrays in energetic_PBL, relying on the fact that compilers will be smart enough to avoid actually allocating this memory when it is unused to avoid expanding the overall memory requirements of MOM6. A number of allocate and deallocate calls were eliminated by these changes. In addition, explicit 'units=' descriptors were added to numerous register_diag_field calls to help identify inconsistent conversion factors. Also, the diagnostic of the number of boundary layer depth iterations was added to the ePBL_column_diags, which enabled the intent of the CS and G arguments to ePBL_column to be changed to intent(in). The unnecessary extra logic associated with the use of the OBL_converged variable in ePBL_column was eliminated, but the results are uneffected. Because the MOM_parameter_doc files were changing anyway, and because this commit is only a diagnostic change, about 6 spelling errors were corrected in ePBL parameter descriptions as a part of this commit. All answers are bitwise identical, but there is a new runtime parameter and there may be new diagnostics depending on the choice of a non-default value for that new parameter.
Added the new internal subroutine find_Kd_from_PE_chg inside of the MOM_energetic_PBL module to directly calculate an increment in the diapycnal diffusivity from an energy input. This can be used when ePBL does not convert released mean kinetic energy into turbulent kinetic energy (i.e., if MKE_TO_TKE_EFFIC = 0.) and is more efficient than the more general iterative approach. To preserve old answers, this new option is only enabled for the surface boundary layer when the new runtime parameter DIRECT_EPBL_MIXING_CALC is set to true. This new option can be tested passively by setting EPBL_OPTIONS_DIFF to 3 in a run that uses ePBL. By default all answers are bitwise identical, but there is a new runtime parameter in some of the MOM_parameter_doc files.
60b636b
to
f89e7db
Compare
This PR has now been revised into its complete form, and ready for review. Please do not squash this PR, as each of the 5 commits that comprise this PR are significant, either in their scope or by fixing a bug. |
f89e7db
to
ca009da
Compare
Add the option to do energetically consistent bottom boundary layer mixing with the new routine ePBL_BBL_column. ePBL_BBL_column is closely based on the surface-focused ePBL mixing in ePBL_column, but without adding convective instability driven mixing or mean-TKE driven mixing to avoid possible double-counting. This new option is enabled by setting the new runtime parameter EPBL_BBL_EFFIC to be positive. If both EPBL_BBL_EFFIC and BBL_EFFIC are set to positive values, there is a risk of double-counting, but this case is not being trapped for now. The changes include the addition of a new mandatory vertvisc_type argument to the publicly visible routine energetic_PBL. When this new ePBL bottom boundary layer mixing option is enabled, there are several new diagnostics available that are related to bottom boundary layer mixing. Several new checksum calls were also added with this new option when DEBUG = True. The MOM_parameter_doc files are altered by the addition of two new runtime parameters, and by the correction of several spelling errors in the descriptions of other ePBL parameters. By default, all answers are bitwise identical.
ca009da
to
6b9b0d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Wondering is @breichl should also look at this?
This series of five commits adds the option to do energetically consistent bottom boundary layer mixing with the new routine
ePBL_BBL_column()
.ePBL_BBL_column()
is closely based on the surface-focused ePBL mixing inePBL_column()
, but without adding convective instability driven mixing or mean-TKE driven mixing to avoid possible double-counting. This new option is enabled by setting the new runtime parameterEPBL_BBL_EFFIC
to be positive. The changes include the addition of a new mandatoryvertvisc_type
argument to the publicly visible routineenergetic_PBL()
. If both EPBL_BBL_EFFIC and BBL_EFFIC are set to positive values, there is a risk of double-counting, but this case is not being trapped for now. The changes that actually addsePBL_BBL_column()
is in the fifth of the commits in this PR.The first commit in this series corrects a bug that causes ePBL column to set the wrong variable and then use an uninitialized variable when
EPBL_ORIGINAL_PE_CALC
is set to false. This bug was present when theEPBL_ORIGINAL_PE_CALC
was first added on Sept. 30, 2016, but it was not detected because only the default case withEPBL_ORIGINAL_PE_CALC = True
appears to being used or tested. Any runs that used this code with debugging compile options would have trapped it immediately. This will change answers whenEPBL_ORIGINAL_PE_CALC is false
.The second commit corrects an unlikely bug when iterating to determine the mixed layer depth, that arises when the change between iterations exactly matches the tolerance. This bug is fixed by setting the new runtime parameter
EPBL_MLD_ITER_BUG = False
.The third commit adds the ability to passively run
ePBL_column()
twice in a diagnostic mode and then provide diagnostics of the differences in the diffusivities and boundary layer depths that are generated with the two options. This is controlled by the new runtime parameterEPBL_OPTIONS_DIFF
, which is an integer that specifies which options to change or 0 (the default) todisable this capability. Associated with this are the new diagnostics
ePBL_opt_diff_Kd_ePBL
,ePBL_opt_maxdiff_Kd_ePBL
andePBL_opt_diff_h_ML
, which only are registered when the differencing is enabled.There was also some refactoring for code clarity and clean-up of some typos as a part of this third commit. Within
ePBL_column()
, thehp_a
variable was converted from a scalar into a 1-d array to emphasize where these variables arelocated and to bring
ePBL_column()
closer to what would be required if the new diffusivities were being applied on top of diffusivities from other processes, as is the case inePBL_BBL_column()
. As a part of these changes, there were some other reforms to the way thatMOM_energetic_PBL()
handles diagnostics, with the 2-d and 3-d arrays changed from allocatable arrays with enduring memory commitments in theenergetic_PBL_CS
type into simple arrays inenergetic_PBL()
,relying on the fact that compilers will be smart enough to avoid actually allocating this memory when it is unused to avoid expanding the overall memory requirements of MOM6. A number of allocate and deallocate calls were eliminated
by these changes. In addition, explicit 'units=' descriptors were added to numerous
register_diag_field()
calls to help identify inconsistent conversion factors. Also, the diagnostic of the number of boundary layer depth iterationswas added to the
ePBL_column_diags
, which enabled the intent of theCS
andG
arguments toePBL_column()
to be changed tointent(in)
. The unnecessary extra logic associated with the use of theOBL_converged
variable inePBL_column()
was eliminated, but the results are unaltered. Because the MOM_parameter_doc files were changing anyway, and because this commit is only a diagnostic change, about 6 spelling errors were corrected in ePBL parameter descriptions as a part ofthis commit.
The fourth commit adds the new internal subroutine
find_Kd_from_PE_chg()
inside of theMOM_energetic_PBL
module to directly calculate an increment in the diapycnal diffusivity from an energy input. This can be used when ePBL does not convertreleased mean kinetic energy into turbulent kinetic energy (i.e., if
MKE_TO_TKE_EFFIC = 0
.) and is more efficient than the more general iterative approach. To preserve old answers, this new option is only enabled for the surface boundary layer when the new runtime parameterDIRECT_EPBL_MIXING_CALC
is set to true. This new option can be tested passively by settingEPBL_OPTIONS_DIFF = 3
in a run that uses ePBL.ePBL_BBL_column()
also has the option to usefind_Kd_from_PE_chg()
, and to verify its correctness for the bottom boundary layer by settingEPBL_OPTIONS_DIFF = 4
.This PR makes several new diagnostics available that are related to bottom boundary layer mixing or the sensitivity of ePBL mixing to several parameter changes. The MOM_parameter_doc files are altered by the addition of 5 new runtime parameters, and by the correction of several spelling errors in the descriptions of other ePBL parameters. By default, all answers are bitwise
identical.
This commits in this PR include: