Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .testing/tc0/MOM_input
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ DIAG_AS_CHKSUM = True
DEBUG = True
GRID_ROTATION_ANGLE_BUGS = True ! [Boolean] default = True
USE_GM_WORK_BUG = True ! [Boolean] default = True
FIX_UNSPLIT_DT_VISC_BUG = False ! [Boolean] default = False
USE_LAND_MASK_FOR_HVISC = False ! [Boolean] default = False
GUST_CONST = 0.02 ! [Pa] default = 0.02
FIX_USTAR_GUSTLESS_BUG = False ! [Boolean] default = False

2 changes: 1 addition & 1 deletion .testing/tc1.a/MOM_tc_variant
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#override SPLIT=False
#override FIX_UNSPLIT_DT_VISC_BUG = False ! [Boolean] default = False
#override UNSPLIT_DT_VISC_BUG = True ! [Boolean] default = False
2 changes: 1 addition & 1 deletion .testing/tc1.b/MOM_tc_variant
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#override SPLIT=False
#override USE_RK2=True
#override FIX_UNSPLIT_DT_VISC_BUG = False ! [Boolean] default = False
#override UNSPLIT_DT_VISC_BUG = True ! [Boolean] default = False
14 changes: 14 additions & 0 deletions .testing/tc1/MOM_input
Original file line number Diff line number Diff line change
Expand Up @@ -595,3 +595,17 @@ BULKML_CONV_MOMENTUM_BUG = True ! [Boolean] default = True
PEN_SW_ABSORB_MINTHICK = 0.001 ! [m] default = 0.001
GUST_CONST = 0.02 ! [Pa] default = 0.02
FIX_USTAR_GUSTLESS_BUG = False ! [Boolean] default = False


! Explicitly use the defaults from late 2024
EQN_OF_STATE = "WRIGHT" ! default = "WRIGHT_FULL"
HOR_DIFF_ANSWER_DATE = 20240101
HOR_DIFF_LIMIT_BUG = True

! Explicitly use the defaults from early 2025
VISC_REM_BUG = True
DRAG_DIFFUSIVITY_ANSWER_DATE = 20250101
FRICTWORK_BUG = True
HOR_DIFF_ANSWER_DATE = 20240101
HOR_DIFF_LIMIT_BUG = True
MASS_WEIGHT_IN_PRESSURE_GRADIENT_TOP = False
13 changes: 13 additions & 0 deletions .testing/tc2/MOM_input
Original file line number Diff line number Diff line change
Expand Up @@ -627,3 +627,16 @@ USE_MLD_ITERATION = False ! [Boolean] default = False
PEN_SW_ABSORB_MINTHICK = 0.001 ! [m] default = 0.001
GUST_CONST = 0.02 ! [Pa] default = 0.02
FIX_USTAR_GUSTLESS_BUG = False ! [Boolean] default = False

! Explicitly use the defaults from late 2024
EQN_OF_STATE = "WRIGHT" ! default = "WRIGHT_FULL"
TIDES_ANSWER_DATE = 20230630
NDIFF_ANSWER_DATE = 20240101
BACKSCATTER_UNDERBOUND = True

! Explicitly use the defaults from early 2025
VISC_REM_BUG = True
DRAG_DIFFUSIVITY_ANSWER_DATE = 20250101
FRICTWORK_BUG = True
NDIFF_ANSWER_DATE = 20240101
MASS_WEIGHT_IN_PRESSURE_GRADIENT_TOP = False
5 changes: 5 additions & 0 deletions .testing/tc3/MOM_input
Original file line number Diff line number Diff line change
Expand Up @@ -480,3 +480,8 @@ KAPPA_SHEAR_ITER_BUG = True ! [Boolean] default = True
KAPPA_SHEAR_ALL_LAYER_TKE_BUG = True ! [Boolean] default = True
GUST_CONST = 0.02 ! [Pa] default = 0.02
FIX_USTAR_GUSTLESS_BUG = False ! [Boolean] default = False

! Explicitly use the defaults from early 2025
VISC_REM_BUG = True
DRAG_DIFFUSIVITY_ANSWER_DATE = 20250101
FRICTWORK_BUG = True
5 changes: 4 additions & 1 deletion .testing/tc4/MOM_input
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,12 @@ DEBUG = True

INTERPOLATE_RES_FN = True ! [Boolean] default = True
GILL_EQUATORIAL_LD = False ! [Boolean] default = False
FIX_UNSPLIT_DT_VISC_BUG = False ! [Boolean] default = False
USE_LAND_MASK_FOR_HVISC = False ! [Boolean] default = False
KAPPA_SHEAR_ITER_BUG = True ! [Boolean] default = True
KAPPA_SHEAR_ALL_LAYER_TKE_BUG = True ! [Boolean] default = True
USE_MLD_ITERATION = False ! [Boolean] default = False

! Explicitly use the defaults from early 2025
VISC_REM_BUG = True
FRICTWORK_BUG = True
MASS_WEIGHT_IN_PRESSURE_GRADIENT_TOP = False
26 changes: 25 additions & 1 deletion config_src/external/GFDL_ocean_BGC/MOM_generic_tracer.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module MOM_generic_tracer
! ### These imports should not reach into FMS directly ###

use MOM_ALE_sponge, only : ALE_sponge_CS
use MOM_coms, only : EFP_type
use MOM_coms, only : EFP_type, real_to_EFP
use MOM_diag_mediator, only : diag_ctrl
use MOM_error_handler, only : MOM_error, FATAL
use MOM_file_parser, only : param_file_type
Expand Down Expand Up @@ -195,8 +195,14 @@ function MOM_generic_tracer_stock(h, stocks, G, GV, CS, names, units, stock_inde
integer :: MOM_generic_tracer_stock !< Return value, the
!! number of stocks calculated here.

integer :: m
MOM_generic_tracer_stock = 0

! These should never be used, but they are set to avoid compile-time warnings
do m=1,size(names) ; names(m) = "" ; enddo
do m=1,size(units) ; units(m) = "" ; enddo
do m=1,size(stocks) ; stocks(m) = real_to_EFP(0.0) ; enddo

end function MOM_generic_tracer_stock

!> This subroutine finds the global min and max of either of all available
Expand Down Expand Up @@ -227,8 +233,24 @@ function MOM_generic_tracer_min_max(ind_start, got_minmax, gmin, gmax, G, CS, na
integer :: MOM_generic_tracer_min_max !< Return value, the
!! number of tracers done here.

integer :: m

MOM_generic_tracer_min_max = 0

! These should never be used, but they are set to avoid compile-time warnings. Note that the minimum values
! are delibarately set to be larger than the maximum values.
got_minmax(:) = .false.
gmax(:) = -huge(gmax)
gmin(:) = huge(gmin)
do m=1,size(names) ; names(m) = "" ; enddo
do m=1,size(units) ; units(m) = "" ; enddo
if (present(xgmin)) xgmin(:) = 0.0
if (present(ygmin)) ygmin(:) = 0.0
if (present(zgmin)) zgmin(:) = 0.0
if (present(xgmax)) xgmax(:) = 0.0
if (present(ygmax)) ygmax(:) = 0.0
if (present(zgmax)) zgmax(:) = 0.0

end function MOM_generic_tracer_min_max

!> This subroutine calculates the surface state and sets coupler values for
Expand Down Expand Up @@ -271,6 +293,8 @@ subroutine MOM_generic_tracer_get(name,member,array, CS)
! arbitrary units [A]
character(len=128), parameter :: sub_name = 'MOM_generic_tracer_get'

array(:,:,:) = huge(array)

end subroutine MOM_generic_tracer_get

!> This subroutine deallocates the memory owned by this module.
Expand Down
2 changes: 1 addition & 1 deletion src/ALE/MOM_regridding.F90
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
"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, do_not_log=.not.GV%Boussinesq) ! ### change to default=default_answer_date)
default=default_answer_date, do_not_log=.not.GV%Boussinesq)
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
34 changes: 7 additions & 27 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,6 @@ module MOM
logical :: useMEKE !< If true, call the MEKE parameterization.
logical :: use_stochastic_EOS !< If true, use the stochastic EOS parameterizations.
logical :: useWaves !< If true, update Stokes drift
logical :: use_diabatic_time_bug !< If true, uses the wrong calendar time for diabatic processes,
!! as was done in MOM6 versions prior to February 2018.
real :: dtbt_reset_period !< The time interval between dynamic recalculation of the
!! barotropic time step [T ~> s]. If this is negative dtbt is never
!! calculated, and if it is 0, dtbt is calculated every step.
Expand Down Expand Up @@ -840,15 +838,9 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS

rel_time = 0.0
do n=1,n_max
if (CS%use_diabatic_time_bug) then
! This wrong form of update was used until Feb 2018, recovered with CS%use_diabatic_time_bug=T.
CS%Time = Time_start + real_to_time(US%T_to_s*int(floor(rel_time+0.5*dt+0.5)))
rel_time = rel_time + dt
else
rel_time = rel_time + dt ! The relative time at the end of the step.
! Set the universally visible time to the middle of the time step.
CS%Time = Time_start + real_to_time(US%T_to_s*(rel_time - 0.5*dt))
endif
rel_time = rel_time + dt ! The relative time at the end of the step.
! Set the universally visible time to the middle of the time step.
CS%Time = Time_start + real_to_time(US%T_to_s*(rel_time - 0.5*dt))
! Set the local time to the end of the time step.
Time_local = Time_start + real_to_time(US%T_to_s*rel_time)

Expand Down Expand Up @@ -878,16 +870,12 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
endif

end_time_thermo = Time_local
if (dtdia > dt .and. .not. CS%use_diabatic_time_bug) then
if (dtdia > dt) then
! If necessary, temporarily reset CS%Time to the center of the period covered
! by the call to step_MOM_thermo, noting that they begin at the same time.
! This step was missing prior to Feb 2018, and is skipped with CS%use_diabatic_time_bug=T.
CS%Time = CS%Time + real_to_time(0.5*US%T_to_s*(dtdia-dt))
endif
if (dtdia > dt .or. CS%use_diabatic_time_bug) then
! The end-time of the diagnostic interval needs to be set ahead if there
! are multiple dynamic time steps worth of thermodynamics applied here.
! This line was not conditional prior to Feb 2018, recovered with CS%use_diabatic_time_bug=T.
end_time_thermo = Time_local + real_to_time(US%T_to_s*(dtdia-dt))
endif

Expand All @@ -903,8 +891,7 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
CS%t_dyn_rel_thermo = -dtdia
if (showCallTree) call callTree_waypoint("finished diabatic_first (step_MOM)")

if (dtdia > dt .and. .not. CS%use_diabatic_time_bug) & ! Reset CS%Time to its previous value.
! This step was missing prior to Feb 2018, recovered with CS%use_diabatic_time_bug=T.
if (dtdia > dt) & ! Reset CS%Time to its previous value.
CS%Time = Time_start + real_to_time(US%T_to_s*(rel_time - 0.5*dt))
endif ! end of block "(CS%diabatic_first .and. (CS%t_dyn_rel_adv==0.0))"

Expand Down Expand Up @@ -1004,8 +991,7 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS

! If necessary, temporarily reset CS%Time to the center of the period covered
! by the call to step_MOM_thermo, noting that they end at the same time.
! This step was missing prior to Feb 2018, and is skipped with CS%use_diabatic_time_bug=T.
if (dtdia > dt .and. .not. CS%use_diabatic_time_bug) &
if (dtdia > dt) &
CS%Time = CS%Time - real_to_time(0.5*US%T_to_s*(dtdia-dt))

! Apply diabatic forcing, do mixing, and regrid.
Expand All @@ -1024,8 +1010,7 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
endif

! Reset CS%Time to its previous value.
! This step was missing prior to Feb 2018, and is skipped with CS%use_diabatic_time_bug=T.
if (dtdia > dt .and. .not. CS%use_diabatic_time_bug) &
if (dtdia > dt) &
CS%Time = Time_start + real_to_time(US%T_to_s*(rel_time - 0.5*dt))
endif

Expand Down Expand Up @@ -2733,11 +2718,6 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, &
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 "//&
"done in MOM6 versions prior to February 2018. This is not recommended.", &
default=.false.)

call get_param(param_file, "MOM", "SAVE_INITIAL_CONDS", save_IC, &
"If true, write the initial conditions to a file given "//&
"by IC_OUTPUT_FILE.", default=.false.)
Expand Down
11 changes: 7 additions & 4 deletions src/core/MOM_PressureForce_FV.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2076,16 +2076,19 @@ subroutine PressureForce_FV_init(Time, G, GV, US, param_file, diag, CS, ADp, SAL
default=enable_bugs)
call get_param(param_file, mdl, "TIDES", CS%tides, &
"If true, apply tidal momentum forcing.", default=.false.)
call get_param(param_file, '', "DEFAULT_ANSWER_DATE", default_answer_date, default=99991231)
if (CS%tides) &
if (CS%tides) then
call get_param(param_file, mdl, "DEFAULT_ANSWER_DATE", default_answer_date, &
"This sets the default value for the various _ANSWER_DATE parameters.", &
default=99991231)
call get_param(param_file, mdl, "TIDES_ANSWER_DATE", CS%tides_answer_date, "The vintage of "//&
"self-attraction and loading (SAL) and tidal forcing calculations. Setting "//&
"dates before 20230701 recovers old answers (Boussinesq and non-Boussinesq "//&
"modes) when SAL is part of the tidal forcing calculation. The answer "//&
"difference is only at bit level and due to a reordered summation. Setting "//&
"dates before 20250201 recovers answers (Boussinesq mode) that interface "//&
"heights are modified before pressure force integrals are calculated.", &
default=20230630, do_not_log=(.not.CS%tides))
default=default_answer_date, do_not_log=(.not.CS%tides))
endif
call get_param(param_file, mdl, "CALCULATE_SAL", CS%calculate_SAL, &
"If true, calculate self-attraction and loading.", default=CS%tides)
if (CS%calculate_SAL) &
Expand Down Expand Up @@ -2128,7 +2131,7 @@ subroutine PressureForce_FV_init(Time, G, GV, US, param_file, diag, CS, ADp, SAL
"If true and MASS_WEIGHT_IN_PRESSURE_GRADIENT is true, use mass weighting when "//&
"interpolating T/S for integrals near the top of the water column in FV "//&
"pressure gradient calculations. ", &
default=.false.) !### Change Default to MASS_WEIGHT_IN_PRESSURE_GRADIENT?
default=useMassWghtInterp)
call get_param(param_file, mdl, "MASS_WEIGHT_IN_PGF_NONBOUS_BUG", MassWghtInterp_NonBous_bug, &
"If true, use a masking bug in non-Boussinesq calculations with mass weighting "//&
"when interpolating T/S for integrals near the bathymetry in FV pressure "//&
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5526,7 +5526,7 @@ subroutine barotropic_init(u, v, h, Time, G, GV, US, param_file, diag, CS, &

call get_param(param_file, mdl, "ENABLE_BUGS_BY_DEFAULT", enable_bugs, &
default=.true., do_not_log=.true.) ! This is logged from MOM.F90.
call get_param(param_file, mdl, "VISC_REM_BUG", visc_rem_bug, default=enable_bugs, do_not_log=.true.)
call get_param(param_file, mdl, "VISC_REM_BUG", visc_rem_bug, default=.false., do_not_log=.true.)
call get_param(param_file, mdl, "VISC_REM_BT_WEIGHT_BUG", CS%wt_uv_bug, &
"If true, recover a bug in barotropic solver that uses an unnormalized weight "//&
"function for vertical averages of baroclinic velocity and forcing. Default "//&
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_dynamics_split_RK2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ subroutine initialize_dyn_split_RK2(u, v, h, tv, uh, vh, eta, Time, G, GV, US, p
"If true, visc_rem_[uv] in split mode is incorrectly calculated or accounted "//&
"for in two places. This parameter controls the defaults of two individual "//&
"flags, VISC_REM_TIMESTEP_BUG in MOM_dynamics_split_RK2(b) and "//&
"VISC_REM_BT_WEIGHT_BUG in MOM_barotropic.", default=enable_bugs)
"VISC_REM_BT_WEIGHT_BUG in MOM_barotropic.", default=.false.)
call get_param(param_file, mdl, "VISC_REM_TIMESTEP_BUG", CS%visc_rem_dt_bug, &
"If true, recover a bug that uses dt_pred rather than dt in "//&
"vertvisc_remnant() at the end of predictor stage for the following "//&
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_dynamics_split_RK2b.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@ subroutine initialize_dyn_split_RK2b(u, v, h, tv, uh, vh, eta, Time, G, GV, US,
"If true, visc_rem_[uv] in split mode is incorrectly calculated or accounted "//&
"for in two places. This parameter controls the defaults of two individual "//&
"flags, VISC_REM_TIMESTEP_BUG in MOM_dynamics_split_RK2(b) and "//&
"VISC_REM_BT_WEIGHT_BUG in MOM_barotropic.", default=enable_bugs)
"VISC_REM_BT_WEIGHT_BUG in MOM_barotropic.", default=.false.)
call get_param(param_file, mdl, "VISC_REM_TIMESTEP_BUG", CS%visc_rem_dt_bug, &
"If true, recover a bug that uses dt_pred rather than dt in "//&
"vertvisc_remnant() at the end of predictor stage for the following "//&
Expand Down
30 changes: 0 additions & 30 deletions src/core/MOM_dynamics_unsplit.F90
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,6 @@ subroutine initialize_dyn_unsplit(u, v, h, tv, Time, G, GV, US, param_file, diag
character(len=48) :: flux_units
! This include declares and sets the variable "version".
# include "version_variable.h"
logical :: use_correct_dt_visc
logical :: test_value ! This is used to determine whether a logical parameter is being set explicitly.
logical :: explicit_bug, explicit_fix ! These indicate which parameters are set explicitly.
integer :: isd, ied, jsd, jed, nz, IsdB, IedB, JsdB, JedB
isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed ; nz = GV%ke
IsdB = G%IsdB ; IedB = G%IedB ; JsdB = G%JsdB ; JedB = G%JedB
Expand All @@ -655,33 +652,6 @@ subroutine initialize_dyn_unsplit(u, v, h, tv, Time, G, GV, US, param_file, diag
call log_version(param_file, mdl, version, "")

call get_param(param_file, mdl, "UNSPLIT_DT_VISC_BUG", CS%dt_visc_bug, &
"If false, use the correct timestep in the viscous terms applied in the first "//&
"predictor step with the unsplit time stepping scheme, and in the calculation "//&
"of the turbulent mixed layer properties for viscosity with unsplit or "//&
"unsplit_RK2. If true, an older incorrect value is used.", &
default=.false., do_not_log=.true.)
! This is used to test whether UNSPLIT_DT_VISC_BUG is being actively set.
call get_param(param_file, mdl, "UNSPLIT_DT_VISC_BUG", test_value, default=.true., do_not_log=.true.)
explicit_bug = CS%dt_visc_bug .eqv. test_value
call get_param(param_file, mdl, "FIX_UNSPLIT_DT_VISC_BUG", use_correct_dt_visc, &
"If true, use the correct timestep in the viscous terms applied in the first "//&
"predictor step with the unsplit time stepping scheme, and in the calculation "//&
"of the turbulent mixed layer properties for viscosity with unsplit or "//&
"unsplit_RK2.", default=.true., do_not_log=.true.)
call get_param(param_file, mdl, "FIX_UNSPLIT_DT_VISC_BUG", test_value, default=.false., do_not_log=.true.)
explicit_fix = use_correct_dt_visc .eqv. test_value

if (explicit_bug .and. explicit_fix .and. (use_correct_dt_visc .eqv. CS%dt_visc_bug)) then
! UNSPLIT_DT_VISC_BUG is being explicitly set, and should not be changed.
call MOM_error(FATAL, "UNSPLIT_DT_VISC_BUG and FIX_UNSPLIT_DT_VISC_BUG are both being set "//&
"with inconsistent values. FIX_UNSPLIT_DT_VISC_BUG is an obsolete "//&
"parameter and should be removed.")
elseif (explicit_fix) then
call MOM_error(WARNING, "FIX_UNSPLIT_DT_VISC_BUG is an obsolete parameter. "//&
"Use UNSPLIT_DT_VISC_BUG instead (noting that it has the opposite sense).")
CS%dt_visc_bug = .not.use_correct_dt_visc
endif
call log_param(param_file, mdl, "UNSPLIT_DT_VISC_BUG", CS%dt_visc_bug, &
"If false, use the correct timestep in the viscous terms applied in the first "//&
"predictor step with the unsplit time stepping scheme, and in the calculation "//&
"of the turbulent mixed layer properties for viscosity with unsplit or "//&
Expand Down
Loading
Loading