Skip to content

Commit

Permalink
+(*)Minimum non-Boussinesq answer date of 20230701
Browse files Browse the repository at this point in the history
  Set a minimum answer date of 20230701 when the model is known to be in
non-Boussinesq mode, and ignore all ANSWERS_2018 flags in that same mode.  This
change only applies to the code called from the src directories, and not to code
within or called directly from the config_src/drivers directories or from
another component model like SIS2 where the information about whether the model
is in non-Boussinesq mode is not available.  A verticalGrid_type arguemnt was
added to porous_barriers_init to support one of these changes.  This commit will
change answers in some non-Boussinesq configurations, but all answers in
existing test cases appear to be bitwise identical.  There are fewer entries
logged in non-Boussinesq MOM_parameter_doc files.
  • Loading branch information
Hallberg-NOAA authored and marshallward committed Aug 1, 2023
1 parent e4f76c0 commit fd31e01
Show file tree
Hide file tree
Showing 22 changed files with 230 additions and 128 deletions.
13 changes: 8 additions & 5 deletions src/ALE/MOM_ALE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,24 @@ subroutine ALE_init( param_file, GV, US, max_depth, CS)
default=99991231)
call get_param(param_file, mdl, "DEFAULT_2018_ANSWERS", default_2018_answers, &
"This sets the default value for the various _2018_ANSWERS parameters.", &
default=(default_answer_date<20190101))
default=(default_answer_date<20190101), do_not_log=.not.GV%Boussinesq)
call get_param(param_file, mdl, "REMAPPING_2018_ANSWERS", answers_2018, &
"If true, use the order of arithmetic and expressions that recover the "//&
"answers from the end of 2018. Otherwise, use updated and more robust "//&
"forms of the same expressions.", default=default_2018_answers)
"forms of the same expressions.", default=default_2018_answers, do_not_log=.not.GV%Boussinesq)
! Revise inconsistent default answer dates for remapping.
if (answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
if (GV%Boussinesq) then
if (answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
endif
call get_param(param_file, mdl, "REMAPPING_ANSWER_DATE", CS%answer_date, &
"The vintage of the expressions and order of arithmetic to use for remapping. "//&
"Values below 20190101 result in the use of older, less accurate expressions "//&
"that were in use at the end of 2018. Higher values result in the use of more "//&
"robust and accurate forms of mathematically equivalent expressions. "//&
"If both REMAPPING_2018_ANSWERS and REMAPPING_ANSWER_DATE are specified, the "//&
"latter takes precedence.", default=default_answer_date)
"latter takes precedence.", default=default_answer_date, do_not_log=.not.GV%Boussinesq)
if (.not.GV%Boussinesq) CS%answer_date = max(CS%answer_date, 20230701)

call initialize_remapping( CS%remapCS, string, &
boundary_extrapolation=remap_boundary_extrap, &
Expand Down
16 changes: 10 additions & 6 deletions src/ALE/MOM_regridding.F90
Original file line number Diff line number Diff line change
Expand Up @@ -277,28 +277,32 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
default=99991231)
call get_param(param_file, mdl, "DEFAULT_2018_ANSWERS", default_2018_answers, &
"This sets the default value for the various _2018_ANSWERS parameters.", &
default=(default_answer_date<20190101))
default=(default_answer_date<20190101), do_not_log=.not.GV%Boussinesq)
call get_param(param_file, mdl, "REMAPPING_2018_ANSWERS", remap_answers_2018, &
"If true, use the order of arithmetic and expressions that recover the "//&
"answers from the end of 2018. Otherwise, use updated and more robust "//&
"forms of the same expressions.", default=default_2018_answers)
"forms of the same expressions.", default=default_2018_answers, do_not_log=.not.GV%Boussinesq)
! Revise inconsistent default answer dates for remapping.
if (remap_answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.remap_answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
if (GV%Boussinesq) then
if (remap_answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.remap_answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
endif
call get_param(param_file, mdl, "REMAPPING_ANSWER_DATE", remap_answer_date, &
"The vintage of the expressions and order of arithmetic to use for remapping. "//&
"Values below 20190101 result in the use of older, less accurate expressions "//&
"that were in use at the end of 2018. Higher values result in the use of more "//&
"robust and accurate forms of mathematically equivalent expressions. "//&
"If both REMAPPING_2018_ANSWERS and REMAPPING_ANSWER_DATE are specified, the "//&
"latter takes precedence.", default=default_answer_date)
"latter takes precedence.", default=default_answer_date, do_not_log=.not.GV%Boussinesq)
if (.not.GV%Boussinesq) remap_answer_date = max(remap_answer_date, 20230701)
call set_regrid_params(CS, remap_answer_date=remap_answer_date)
call get_param(param_file, mdl, "REGRIDDING_ANSWER_DATE", regrid_answer_date, &
"The vintage of the expressions and order of arithmetic to use for regridding. "//&
"Values below 20190101 result in the use of older, less accurate expressions "//&
"that were in use at the end of 2018. Higher values result in the use of more "//&
"robust and accurate forms of mathematically equivalent expressions.", &
default=20181231) ! ### change to default=default_answer_date)
default=20181231, do_not_log=.not.GV%Boussinesq) ! ### change to default=default_answer_date)
if (.not.GV%Boussinesq) regrid_answer_date = max(regrid_answer_date, 20230701)
call set_regrid_params(CS, regrid_answer_date=regrid_answer_date)
endif

Expand Down
26 changes: 20 additions & 6 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2012,6 +2012,9 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, &
integer :: first_direction ! An integer that indicates which direction is to be
! updated first in directionally split parts of the
! calculation.
logical :: non_Bous ! If true, this run is fully non-Boussinesq
logical :: Boussinesq ! If true, this run is fully Boussinesq
logical :: semi_Boussinesq ! If true, this run is partially non-Boussinesq
logical :: use_KPP ! If true, diabatic is using KPP vertical mixing
integer :: nkml, nkbl, verbosity, write_geom
integer :: dynamics_stencil ! The computational stencil for the calculations
Expand Down Expand Up @@ -2075,6 +2078,14 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, &
default=.false.)
endif

call get_param(param_file, "MOM", "BOUSSINESQ", Boussinesq, &
"If true, make the Boussinesq approximation.", default=.true., do_not_log=.true.)
call get_param(param_file, "MOM", "SEMI_BOUSSINESQ", semi_Boussinesq, &
"If true, do non-Boussinesq pressure force calculations and use mass-based "//&
"thicknesses, but use RHO_0 to convert layer thicknesses into certain "//&
"height changes. This only applies if BOUSSINESQ is false.", &
default=.true., do_not_log=.true.)
non_Bous = .not.(Boussinesq .or. semi_Boussinesq)
call get_param(param_file, "MOM", "CALC_RHO_FOR_SEA_LEVEL", CS%calc_rho_for_sea_lev, &
"If true, the in-situ density is used to calculate the "//&
"effective sea level that is returned to the coupler. If false, "//&
Expand Down Expand Up @@ -2336,20 +2347,23 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, &
default=99991231)
call get_param(param_file, "MOM", "DEFAULT_2018_ANSWERS", default_2018_answers, &
"This sets the default value for the various _2018_ANSWERS parameters.", &
default=(default_answer_date<20190101))
default=(default_answer_date<20190101), do_not_log=non_Bous)
call get_param(param_file, "MOM", "SURFACE_2018_ANSWERS", answers_2018, &
"If true, use expressions for the surface properties that recover the answers "//&
"from the end of 2018. Otherwise, use more appropriate expressions that differ "//&
"at roundoff for non-Boussinesq cases.", default=default_2018_answers)
"at roundoff for non-Boussinesq cases.", default=default_2018_answers, do_not_log=non_Bous)
! Revise inconsistent default answer dates.
if (answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
if (.not.non_Bous) then
if (answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
endif
call get_param(param_file, "MOM", "SURFACE_ANSWER_DATE", CS%answer_date, &
"The vintage of the expressions for the surface properties. Values below "//&
"20190101 recover the answers from the end of 2018, while higher values "//&
"use updated and more robust forms of the same expressions. "//&
"If both SURFACE_2018_ANSWERS and SURFACE_ANSWER_DATE are specified, the "//&
"latter takes precedence.", default=default_answer_date)
"latter takes precedence.", default=default_answer_date, do_not_log=non_Bous)
if (non_Bous) CS%answer_date = 99991231

call get_param(param_file, "MOM", "USE_DIABATIC_TIME_BUG", CS%use_diabatic_time_bug, &
"If true, uses the wrong calendar time for diabatic processes, as was "//&
Expand Down Expand Up @@ -3030,7 +3044,7 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, &
endif

if (CS%use_porbar) &
call porous_barriers_init(Time, US, param_file, diag, CS%por_bar_CS)
call porous_barriers_init(Time, GV, US, param_file, diag, CS%por_bar_CS)

if (CS%split) then
allocate(eta(SZI_(G),SZJ_(G)), source=0.0)
Expand Down
13 changes: 8 additions & 5 deletions src/core/MOM_porous_barriers.F90
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,13 @@ subroutine calc_por_interface(D_min, D_max, D_avg, eta_layer, w_layer, do_next)
endif
end subroutine calc_por_interface

subroutine porous_barriers_init(Time, US, param_file, diag, CS)
type(porous_barrier_CS), intent(inout) :: CS !< Module control structure
type(param_file_type), intent(in) :: param_file !< structure indicating parameter file to parse
subroutine porous_barriers_init(Time, GV, US, param_file, diag, CS)
type(time_type), intent(in) :: Time !< Current model time
type(diag_ctrl), target, intent(inout) :: diag !< Diagnostics control structure
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(param_file_type), intent(in) :: param_file !< structure indicating parameter file to parse
type(diag_ctrl), target, intent(inout) :: diag !< Diagnostics control structure
type(porous_barrier_CS), intent(inout) :: CS !< Module control structure

! local variables
character(len=40) :: mdl = "MOM_porous_barriers" ! This module's name.
Expand All @@ -439,7 +440,9 @@ subroutine porous_barriers_init(Time, US, param_file, diag, CS)
call get_param(param_file, mdl, "PORBAR_ANSWER_DATE", CS%answer_date, &
"The vintage of the porous barrier weight function calculations. Values below "//&
"20220806 recover the old answers in which the layer averaged weights are not "//&
"strictly limited by an upper-bound of 1.0 .", default=default_answer_date)
"strictly limited by an upper-bound of 1.0 .", &
default=default_answer_date, do_not_log=.not.GV%Boussinesq)
if (.not.GV%Boussinesq) CS%answer_date = max(CS%answer_date, 20230701)
call get_param(param_file, mdl, "DEBUG", CS%debug, default=.false.)
call get_param(param_file, mdl, "PORBAR_MASKING_DEPTH", CS%mask_depth, &
"If the effective average depth at the velocity cell is shallower than this "//&
Expand Down
13 changes: 8 additions & 5 deletions src/diagnostics/MOM_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1610,21 +1610,24 @@ subroutine MOM_diagnostics_init(MIS, ADp, CDp, Time, G, GV, US, param_file, diag
default=99991231)
call get_param(param_file, mdl, "DEFAULT_2018_ANSWERS", default_2018_answers, &
"This sets the default value for the various _2018_ANSWERS parameters.", &
default=(default_answer_date<20190101))
default=(default_answer_date<20190101), do_not_log=.not.GV%Boussinesq)
call get_param(param_file, mdl, "REMAPPING_2018_ANSWERS", remap_answers_2018, &
"If true, use the order of arithmetic and expressions that recover the "//&
"answers from the end of 2018. Otherwise, use updated and more robust "//&
"forms of the same expressions.", default=default_2018_answers)
"forms of the same expressions.", default=default_2018_answers, do_not_log=.not.GV%Boussinesq)
! Revise inconsistent default answer dates for remapping.
if (remap_answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.remap_answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
if (GV%Boussinesq) then
if (remap_answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.remap_answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
endif
call get_param(param_file, mdl, "REMAPPING_ANSWER_DATE", remap_answer_date, &
"The vintage of the expressions and order of arithmetic to use for remapping. "//&
"Values below 20190101 result in the use of older, less accurate expressions "//&
"that were in use at the end of 2018. Higher values result in the use of more "//&
"robust and accurate forms of mathematically equivalent expressions. "//&
"If both REMAPPING_2018_ANSWERS and REMAPPING_ANSWER_DATE are specified, the "//&
"latter takes precedence.", default=default_answer_date)
"latter takes precedence.", default=default_answer_date, do_not_log=.not.GV%Boussinesq)
if (.not.GV%Boussinesq) remap_answer_date = max(remap_answer_date, 20230701)

call get_param(param_file, mdl, "SPLIT", split, default=.true., do_not_log=.true.)

Expand Down
13 changes: 8 additions & 5 deletions src/framework/MOM_diag_mediator.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3184,21 +3184,24 @@ subroutine diag_mediator_init(G, GV, US, nz, param_file, diag_cs, doc_file_dir)
default=99991231)
call get_param(param_file, mdl, "DEFAULT_2018_ANSWERS", default_2018_answers, &
"This sets the default value for the various _2018_ANSWERS parameters.", &
default=(default_answer_date<20190101))
default=(default_answer_date<20190101), do_not_log=.not.GV%Boussinesq)
call get_param(param_file, mdl, "REMAPPING_2018_ANSWERS", remap_answers_2018, &
"If true, use the order of arithmetic and expressions that recover the "//&
"answers from the end of 2018. Otherwise, use updated and more robust "//&
"forms of the same expressions.", default=default_2018_answers)
"forms of the same expressions.", default=default_2018_answers, do_not_log=.not.GV%Boussinesq)
! Revise inconsistent default answer dates for remapping.
if (remap_answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.remap_answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
if (GV%Boussinesq) then
if (remap_answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.remap_answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
endif
call get_param(param_file, mdl, "REMAPPING_ANSWER_DATE", remap_answer_date, &
"The vintage of the expressions and order of arithmetic to use for remapping. "//&
"Values below 20190101 result in the use of older, less accurate expressions "//&
"that were in use at the end of 2018. Higher values result in the use of more "//&
"robust and accurate forms of mathematically equivalent expressions. "//&
"If both REMAPPING_2018_ANSWERS and REMAPPING_ANSWER_DATE are specified, the "//&
"latter takes precedence.", default=default_answer_date)
"latter takes precedence.", default=default_answer_date, do_not_log=.not.GV%Boussinesq)
if (.not.GV%Boussinesq) remap_answer_date = max(remap_answer_date, 20230701)
call get_param(param_file, mdl, 'USE_GRID_SPACE_DIAGNOSTIC_AXES', diag_cs%grid_space_axes, &
'If true, use a grid index coordinate convention for diagnostic axes. ',&
default=.false.)
Expand Down
Loading

0 comments on commit fd31e01

Please sign in to comment.