Skip to content

Commit 6c7ba8f

Browse files
Theresa MorrisonTheresa Morrison
Theresa Morrison
authored and
Theresa Morrison
committed
Add fatal errors
Add fatal errors if PHA_MLD_CALC is true, but a method is not specified.
1 parent 0a97d48 commit 6c7ba8f

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

src/tracer/MOM_generic_tracer.F90

+24-16
Original file line numberDiff line numberDiff line change
@@ -436,28 +436,36 @@ subroutine initialize_MOM_generic_tracer(restart, day, G, GV, US, h, tv, param_f
436436
"If false, use a fixed value for the photoacclimation mixed layer depth within the "//&
437437
"generic tracer update. This MLD is only used for photoacclimation. This variable should "//&
438438
"be set to true if using COBALTv3 for the BGC.", default=.false.)
439-
if (.not.CS%mld_pha_calc) then
440-
call get_param(param_file, "MOM", "PHA_MLD_VAL", CS%mld_pha_val, &
441-
"The depth of photoacclimation if fixed depth is used [m].", &
442-
units='m', default=0.0, scale=US%m_to_Z)
443-
else
439+
if (CS%mld_pha_calc) then
444440
call get_param(param_file, "MOM", "PHA_MLD_USE_DELTA_RHO", CS%mld_pha_use_delta_rho, &
445441
"If true, use a density difference to find the photoacclimation mixed layer depth "//&
446442
"within the generic tracer update. This MLD is only used for photoacclimation.", default=.false.)
447-
call get_param(param_file, "MOM", "PHA_MLD_HREF", CS%mld_pha_href, &
448-
"The reference depth for a density difference based photoacclimation MLD [m].", &
449-
units='m', default=0.0, scale=US%m_to_Z, do_not_log=.not.CS%mld_pha_use_delta_rho)
450-
call get_param(param_file, "MOM", "PHA_MLD_DRHO", CS%mld_pha_drho, &
451-
"The density difference for a density difference based photoacclimation MLD [kg m-3].", &
452-
units='kg/m3', default=0.03, scale=US%kg_m3_to_R, do_not_log=.not.CS%mld_pha_use_delta_rho)
453-
454443
call get_param(param_file, "MOM", "PHA_MLD_USE_DELTA_ENG", CS%mld_pha_use_delta_eng, &
455444
"If true, use an energy difference to find the photoacclimation mixed layer depth "//&
456445
"with the generic tracer update. This MLD is only used for photoacclimation.", default=.false.)
457-
call get_param(param_file, "MOM", "PHA_MLD_DENG", CS%mld_pha_deng, &
458-
"The energy for an energy difference based photoacclimation MLD.", default=25.0, &
459-
units='J/m2',scale=US%W_m2_to_RZ3_T3*US%s_to_T, do_not_log=.not.CS%mld_pha_use_delta_eng)
460-
446+
if (CS%mld_pha_use_delta_rho .and. CS%mld_pha_use_delta_eng) then
447+
call MOM_error(FATAL, "PHA_MLD_CALC is set to true and PHA_MLD_USE_DELTA_RHO and PHA_MLD_USE_DELTA_ENG "// &
448+
"are both true. Choose only one option for the calculated photoacclimation MLD!")
449+
elseif ((.not.CS%mld_pha_use_delta_rho) .and. (.not.CS%mld_pha_use_delta_eng)) then
450+
call MOM_error(FATAL, "PHA_MLD_CALC is set to true but PHA_MLD_USE_DELTA_RHO and PHA_MLD_USE_DELTA_ENG "// &
451+
"are both false. Choose an option for the calculated photoacclimation MLD!")
452+
endif
453+
if (CS%mld_pha_use_delta_rho) then
454+
call get_param(param_file, "MOM", "PHA_MLD_HREF", CS%mld_pha_href, &
455+
"The reference depth for a density difference based photoacclimation MLD [m].", &
456+
units='m', default=0.0, scale=US%m_to_Z, do_not_log=.not.CS%mld_pha_use_delta_rho)
457+
call get_param(param_file, "MOM", "PHA_MLD_DRHO", CS%mld_pha_drho, &
458+
"The density difference for a density difference based photoacclimation MLD [kg m-3].", &
459+
units='kg/m3', default=0.03, scale=US%kg_m3_to_R, do_not_log=.not.CS%mld_pha_use_delta_rho)
460+
elseif (CS%mld_pha_use_delta_eng) then
461+
call get_param(param_file, "MOM", "PHA_MLD_DENG", CS%mld_pha_deng, &
462+
"The energy for an energy difference based photoacclimation MLD.", default=25.0, &
463+
units='J/m2',scale=US%W_m2_to_RZ3_T3*US%s_to_T, do_not_log=.not.CS%mld_pha_use_delta_eng)
464+
endif
465+
else
466+
call get_param(param_file, "MOM", "PHA_MLD_VAL", CS%mld_pha_val, &
467+
"The depth of photoacclimation if fixed depth is used [m].", &
468+
units='m', default=0.0, scale=US%m_to_Z)
461469
endif
462470

463471

0 commit comments

Comments
 (0)