Skip to content

Commit dbb3601

Browse files
herrwang0adcroft
authored andcommitted
Rename VISC_REM bugfix parameters
VISC_REM_TIMESTEP_FIX -> VISC_REM_TIMESTEP_BUG VISC_REM_BT_WEIGHT_FIX -> VISC_REM_BT_WEIGHT_BUG The "signs" of the flags are flipped accordingly.
1 parent 76915ff commit dbb3601

File tree

3 files changed

+33
-35
lines changed

3 files changed

+33
-35
lines changed

src/core/MOM_barotropic.F90

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ module MOM_barotropic
289289
logical :: tidal_sal_flather !< Apply adjustment to external gravity wave speed
290290
!! consistent with tidal self-attraction and loading
291291
!! used within the barotropic solver
292-
logical :: wt_uv_fix !< If true, use a normalized wt_[uv] for vertical averages.
292+
logical :: wt_uv_bug = .true. !< If true, recover a bug that wt_[uv] that is not normalized.
293293
type(time_type), pointer :: Time => NULL() !< A pointer to the ocean models clock.
294294
type(diag_ctrl), pointer :: diag => NULL() !< A structure that is used to regulate
295295
!! the timing of diagnostic output.
@@ -1070,7 +1070,7 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
10701070
wt_v(i,J,k) = CS%frhatv(i,J,k) * visc_rem
10711071
enddo ; enddo ; enddo
10721072

1073-
if (CS%wt_uv_fix) then
1073+
if (.not. CS%wt_uv_bug) then
10741074
do j=js,je ; do I=is-1,ie ; Iwt_u_tot(I,j) = wt_u(I,j,1) ; enddo ; enddo
10751075
do k=2,nz ; do j=js,je ; do I=is-1,ie
10761076
Iwt_u_tot(I,j) = Iwt_u_tot(I,j) + wt_u(I,j,k)
@@ -4652,11 +4652,10 @@ subroutine barotropic_init(u, v, h, eta, Time, G, GV, US, param_file, diag, CS,
46524652
if (.not.GV%Boussinesq) CS%answer_date = max(CS%answer_date, 20230701)
46534653

46544654
call get_param(param_file, mdl, "VISC_REM_BUG", visc_rem_bug, default=.true., do_not_log=.true.)
4655-
call get_param(param_file, mdl, "VISC_REM_BT_WEIGHT_FIX", CS%wt_uv_fix, &
4656-
"If true, use a normalized weight function for vertical averages of "//&
4657-
"baroclinic velocity and forcing. Default of this flag is set by "//&
4658-
"VISC_REM_BUG. This flag should be used with VISC_REM_TIMESTEP_FIX.", &
4659-
default=.not.visc_rem_bug)
4655+
call get_param(param_file, mdl, "VISC_REM_BT_WEIGHT_BUG", CS%wt_uv_bug, &
4656+
"If true, recover a bug in barotropic solver that uses an unnormalized weight "//&
4657+
"function for vertical averages of baroclinic velocity and forcing. Default "//&
4658+
"of this flag is set by VISC_REM_BUG.", default=visc_rem_bug)
46604659
call get_param(param_file, mdl, "TIDES", use_tides, &
46614660
"If true, apply tidal momentum forcing.", default=.false.)
46624661
if (use_tides .and. present(HA_CSp)) CS%HA_CSp => HA_CSp

src/core/MOM_dynamics_split_RK2.F90

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ module MOM_dynamics_split_RK2
178178
logical :: debug_OBC !< If true, do debugging calls for open boundary conditions.
179179
logical :: fpmix = .false. !< If true, applies profiles of momentum flux magnitude and direction.
180180
logical :: module_is_initialized = .false. !< Record whether this module has been initialized.
181-
logical :: visc_rem_dt_fix = .false. !<If true, use dt rather than dt_pred for vertvisc_rem at the end of predictor.
181+
logical :: visc_rem_dt_bug = .true. !< If true, recover a bug that uses dt_pred rather than dt for vertvisc_rem
182+
!! at the end of predictor.
182183

183184
!>@{ Diagnostic IDs
184185
integer :: id_uold = -1, id_vold = -1
@@ -736,10 +737,10 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f
736737
call start_group_pass(CS%pass_uvp, G%Domain, clock=id_clock_pass)
737738
call cpu_clock_begin(id_clock_vertvisc)
738739
endif
739-
if (CS%visc_rem_dt_fix) then
740-
call vertvisc_remnant(visc, CS%visc_rem_u, CS%visc_rem_v, dt, G, GV, US, CS%vertvisc_CSp)
741-
else
740+
if (CS%visc_rem_dt_bug) then
742741
call vertvisc_remnant(visc, CS%visc_rem_u, CS%visc_rem_v, dt_pred, G, GV, US, CS%vertvisc_CSp)
742+
else
743+
call vertvisc_remnant(visc, CS%visc_rem_u, CS%visc_rem_v, dt, G, GV, US, CS%vertvisc_CSp)
743744
endif
744745
call cpu_clock_end(id_clock_vertvisc)
745746

@@ -1439,16 +1440,14 @@ subroutine initialize_dyn_split_RK2(u, v, h, tv, uh, vh, eta, Time, G, GV, US, p
14391440
default=.false.)
14401441
call get_param(param_file, mdl, "VISC_REM_BUG", visc_rem_bug, &
14411442
"If true, visc_rem_[uv] in split mode is incorrectly calculated or accounted "//&
1442-
"for in three places. This parameter controls the defaults of three individual "//&
1443-
"flags, VISC_REM_TIMESTEP_FIX in MOM_dynamics_split_RK2(b), "//&
1444-
"VISC_REM_BT_WEIGHT_FIX in MOM_barotropic, and VISC_REM_CONT_HVEL_FIX in "//&
1445-
"MOM_continuity_PPM. Eventually, the three individual flags should be removed "//&
1446-
"after tests and the default of VISC_REM_BUG should be to False.", default=.true.)
1447-
call get_param(param_file, mdl, "VISC_REM_TIMESTEP_FIX", CS%visc_rem_dt_fix, &
1448-
"If true, use dt rather than dt_pred in vertvisc_remnant() at the end of "//&
1449-
"predictor stage for the following continuity() call and btstep() call "//&
1450-
"in the corrector step. This flag should be used with "//&
1451-
"VISC_REM_BT_WEIGHT_FIX.", default=.not.visc_rem_bug)
1443+
"for in two places. This parameter controls the defaults of two individual "//&
1444+
"flags, VISC_REM_TIMESTEP_BUG in MOM_dynamics_split_RK2(b) and "//&
1445+
"VISC_REM_BT_WEIGHT_BUG in MOM_barotropic.", default=.true.)
1446+
call get_param(param_file, mdl, "VISC_REM_TIMESTEP_BUG", CS%visc_rem_dt_bug, &
1447+
"If true, recover a bug that uses dt_pred rather than dt in "//&
1448+
"vertvisc_remnant() at the end of predictor stage for the following "//&
1449+
"continuity() and btstep() calls in the corrector step. Default of this flag "//&
1450+
"is set by VISC_REM_BUG", default=visc_rem_bug)
14521451

14531452
allocate(CS%taux_bot(IsdB:IedB,jsd:jed), source=0.0)
14541453
allocate(CS%tauy_bot(isd:ied,JsdB:JedB), source=0.0)

src/core/MOM_dynamics_split_RK2b.F90

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ module MOM_dynamics_split_RK2b
175175
logical :: debug_OBC !< If true, do debugging calls for open boundary conditions.
176176
logical :: fpmix = .false. !< If true, applies profiles of momentum flux magnitude and direction.
177177
logical :: module_is_initialized = .false. !< Record whether this module has been initialized.
178-
logical :: visc_rem_dt_fix = .false. !<If true, use dt rather than dt_pred for vertvisc_rem at the end of predictor.
178+
logical :: visc_rem_dt_bug = .true. !< If true, recover a bug that uses dt_pred rather than dt for vertvisc_rem
179+
!! at the end of predictor.
179180

180181
!>@{ Diagnostic IDs
181182
! integer :: id_uold = -1, id_vold = -1
@@ -754,10 +755,10 @@ subroutine step_MOM_dyn_split_RK2b(u_av, v_av, h, tv, visc, Time_local, dt, forc
754755
call start_group_pass(CS%pass_uvp, G%Domain, clock=id_clock_pass)
755756
call cpu_clock_begin(id_clock_vertvisc)
756757
endif
757-
if (CS%visc_rem_dt_fix) then
758-
call vertvisc_remnant(visc, CS%visc_rem_u, CS%visc_rem_v, dt, G, GV, US, CS%vertvisc_CSp)
759-
else
758+
if (CS%visc_rem_dt_bug) then
760759
call vertvisc_remnant(visc, CS%visc_rem_u, CS%visc_rem_v, dt_pred, G, GV, US, CS%vertvisc_CSp)
760+
else
761+
call vertvisc_remnant(visc, CS%visc_rem_u, CS%visc_rem_v, dt, G, GV, US, CS%vertvisc_CSp)
761762
endif
762763
call cpu_clock_end(id_clock_vertvisc)
763764

@@ -1355,16 +1356,15 @@ subroutine initialize_dyn_split_RK2b(u, v, h, tv, uh, vh, eta, Time, G, GV, US,
13551356
default=.false.)
13561357
call get_param(param_file, mdl, "VISC_REM_BUG", visc_rem_bug, &
13571358
"If true, visc_rem_[uv] in split mode is incorrectly calculated or accounted "//&
1358-
"for in three places. This parameter controls the defaults of three individual "//&
1359-
"flags, VISC_REM_TIMESTEP_FIX in MOM_dynamics_split_RK2(b), "//&
1360-
"VISC_REM_BT_WEIGHT_FIX in MOM_barotropic, and VISC_REM_CONT_HVEL_FIX in "//&
1361-
"MOM_continuity_PPM. Eventually, the three individual flags should be removed "//&
1362-
"after tests and the default of VISC_REM_BUG should be to False.", default=.true.)
1363-
call get_param(param_file, mdl, "VISC_REM_TIMESTEP_FIX", CS%visc_rem_dt_fix, &
1364-
"If true, use dt rather than dt_pred in vertvisc_remnant() at the end of "//&
1365-
"predictor stage for the following continuity() call and btstep() call "//&
1366-
"in the corrector step. Default of this flag is set by VISC_REM_BUG. "//&
1367-
"This flag should be used with VISC_REM_BT_WEIGHT_FIX.", default=.not.visc_rem_bug)
1359+
"for in two places. This parameter controls the defaults of two individual "//&
1360+
"flags, VISC_REM_TIMESTEP_BUG in MOM_dynamics_split_RK2(b) and "//&
1361+
"VISC_REM_BT_WEIGHT_BUG in MOM_barotropic.", default=.true.)
1362+
call get_param(param_file, mdl, "VISC_REM_TIMESTEP_BUG", CS%visc_rem_dt_bug, &
1363+
"If true, recover a bug that uses dt_pred rather than dt in "//&
1364+
"vertvisc_remnant() at the end of predictor stage for the following "//&
1365+
"continuity() and btstep() calls in the corrector step. Default of this flag "//&
1366+
"is set by VISC_REM_BUG", default=visc_rem_bug)
1367+
13681368

13691369
allocate(CS%taux_bot(IsdB:IedB,jsd:jed), source=0.0)
13701370
allocate(CS%tauy_bot(isd:ied,JsdB:JedB), source=0.0)

0 commit comments

Comments
 (0)