Skip to content

Commit 8f0a593

Browse files
Hallberg-NOAAadcroft
authored andcommitted
+Add EPBL_MLD_ITER_BUG runtime parameter
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.
1 parent af76c6c commit 8f0a593

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

src/parameterizations/vertical/MOM_energetic_PBL.F90

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ module MOM_energetic_PBL
5959
!! self-consistent mixed layer depth. Otherwise use the false position
6060
!! after a maximum and minimum bound have been evaluated and the
6161
!! returned value from the previous guess or bisection before this.
62+
logical :: MLD_iter_bug !< If true use buggy logic that gives the wrong bounds for the next
63+
!! iteration when successive guesses increase by exactly EPBL_MLD_TOLERANCE.
6264
integer :: max_MLD_its !< The maximum number of iterations that can be used to find a
6365
!! self-consistent mixed layer depth with Use_MLD_iteration.
6466
real :: MixLenExponent !< Exponent in the mixing length shape-function [nondim].
@@ -1516,14 +1518,27 @@ subroutine ePBL_column(h, dz, u, v, T0, S0, dSV_dT, dSV_dS, SpV_dt, TKE_forcing,
15161518
! is now dependent on the ML, and therefore the ML needs to be estimated
15171519
! more precisely than the grid spacing.
15181520

1519-
!New method uses ML_DEPTH as computed in ePBL routine
1521+
! New method uses ML_DEPTH as computed in ePBL routine
15201522
MLD_found = MLD_output
1521-
if (MLD_found - MLD_guess > CS%MLD_tol) then
1522-
min_MLD = MLD_guess ; dMLD_min = MLD_found - MLD_guess
1523-
elseif (abs(MLD_found - MLD_guess) < CS%MLD_tol) then
1524-
OBL_converged = .true. ! Break convergence loop
1525-
else ! We know this guess was too deep
1526-
max_MLD = MLD_guess ; dMLD_max = MLD_found - MLD_guess ! < -CS%MLD_tol
1523+
1524+
! Find out whether to do another iteration and the new bounds on it.
1525+
if (CS%MLD_iter_bug) then
1526+
! There is a bug in the logic here if (MLD_found - MLD_guess == CS%MLD_tol).
1527+
if (MLD_found - MLD_guess > CS%MLD_tol) then
1528+
min_MLD = MLD_guess ; dMLD_min = MLD_found - MLD_guess
1529+
elseif (abs(MLD_found - MLD_guess) < CS%MLD_tol) then
1530+
OBL_converged = .true. ! Break convergence loop
1531+
else ! We know this guess was too deep
1532+
max_MLD = MLD_guess ; dMLD_max = MLD_found - MLD_guess ! < -CS%MLD_tol
1533+
endif
1534+
else
1535+
if (abs(MLD_found - MLD_guess) < CS%MLD_tol) then
1536+
OBL_converged = .true. ! Break convergence loop
1537+
elseif (MLD_found > MLD_guess) then ! This guess was too shallow
1538+
min_MLD = MLD_guess ; dMLD_min = MLD_found - MLD_guess
1539+
else ! We know this guess was too deep
1540+
max_MLD = MLD_guess ; dMLD_max = MLD_found - MLD_guess ! < -CS%MLD_tol
1541+
endif
15271542
endif
15281543

15291544
if (.not.OBL_converged) then ; if (CS%MLD_bisection) then
@@ -2276,6 +2291,10 @@ subroutine energetic_PBL_init(Time, G, GV, US, param_file, diag, CS)
22762291
"mixed layer depth. Otherwise use the false position after a maximum and minimum "//&
22772292
"bound have been evaluated and the returned value or bisection before this.", &
22782293
default=.false., do_not_log=.not.CS%Use_MLD_iteration)
2294+
call get_param(param_file, mdl, "EPBL_MLD_ITER_BUG", CS%MLD_iter_bug, &
2295+
"If true, use buggy logic that gives the wrong bounds for the next iteration "//&
2296+
"when successive guesses increase by exactly EPBL_MLD_TOLERANCE.", &
2297+
default=.true., do_not_log=.not.CS%Use_MLD_iteration) ! The default should be changed to .false.
22792298
call get_param(param_file, mdl, "EPBL_MLD_MAX_ITS", CS%max_MLD_its, &
22802299
"The maximum number of iterations that can be used to find a self-consistent "//&
22812300
"mixed layer depth. If EPBL_MLD_BISECTION is true, the maximum number "//&

0 commit comments

Comments
 (0)