From d4305c3327bd14d73e163fb0d7eb7677b81b7fa5 Mon Sep 17 00:00:00 2001 From: Robert Hallberg Date: Fri, 2 Jul 2021 10:22:51 -0400 Subject: [PATCH] Flag inconsistent parameters if ADIABATIC = True Add checks for inconsistent parameter settings in adiabatic_driver_init() when ADIABATIC = True, and issue instructive error messages if any are found. This PR addresses MOM6 issue #1417. All answers are bitwise identical, although some cases where the inconsistent parameter settings were previously ignored may now issue fatal errors and will not run. --- .../vertical/MOM_diabatic_driver.F90 | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/parameterizations/vertical/MOM_diabatic_driver.F90 b/src/parameterizations/vertical/MOM_diabatic_driver.F90 index 7a75802a84..83027914ba 100644 --- a/src/parameterizations/vertical/MOM_diabatic_driver.F90 +++ b/src/parameterizations/vertical/MOM_diabatic_driver.F90 @@ -2745,8 +2745,8 @@ subroutine adiabatic_driver_init(Time, G, param_file, diag, CS, & type(tracer_flow_control_CS), pointer :: tracer_flow_CSp !< pointer to control structure of the !! tracer flow control module -! This "include" declares and sets the variable "version". -#include "version_variable.h" + ! This "include" declares and sets the variable "version". +# include "version_variable.h" character(len=40) :: mdl = "MOM_diabatic_driver" ! This module's name. if (associated(CS)) then @@ -2758,10 +2758,35 @@ subroutine adiabatic_driver_init(Time, G, param_file, diag, CS, & CS%diag => diag if (associated(tracer_flow_CSp)) CS%tracer_flow_CSp => tracer_flow_CSp -! Set default, read and log parameters + ! Set default, read and log parameters call log_version(param_file, mdl, version, & "The following parameters are used for diabatic processes.") + ! Check for any subsidiary parameters that are inconsistent with the adiabatic mode. + call get_param(param_file, mdl, "SPONGE", CS%use_sponge, & + "If true, sponges may be applied anywhere in the domain. "//& + "The exact location and properties of those sponges are "//& + "specified via calls to initialize_sponge and possibly "//& + "set_up_sponge_field.", default=.false., do_not_log=.true.) + call get_param(param_file, mdl, "ENERGETICS_SFC_PBL", CS%use_energetic_PBL, & + "If true, use an implied energetics planetary boundary "//& + "layer scheme to determine the diffusivity and viscosity "//& + "in the surface boundary layer.", default=.false., do_not_log=.true.) + call get_param(param_file, mdl, "USE_KPP", CS%use_KPP, & + "If true, turns on the [CVMix] KPP scheme of Large et al., 1994, "//& + "to calculate diffusivities and non-local transport in the OBL.", & + default=.false., do_not_log=.true.) + + if (CS%use_sponge) call MOM_error(WARNING, & + "When ADIABATIC = True, it is inconsistent to set SPONGE = True.") + if (CS%use_energetic_PBL) call MOM_error(WARNING, & + "When ADIABATIC = True, it is inconsistent to set ENERGETICS_SFC_PBL = True.") + if (CS%use_KPP) call MOM_error(WARNING, & + "When ADIABATIC = True, it is inconsistent to set USE_KPP = True.") + + if (CS%use_sponge .or. CS%use_energetic_PBL .or. CS%use_KPP) & + call MOM_error(FATAL, "adiabatic_driver_init is aborting due to inconsistent parameter settings.") + end subroutine adiabatic_driver_init @@ -2785,13 +2810,14 @@ subroutine diabatic_driver_init(Time, G, GV, US, param_file, useALEalgorithm, di type(sponge_CS), pointer :: sponge_CSp !< pointer to the sponge module control structure type(ALE_sponge_CS), pointer :: ALE_sponge_CSp !< pointer to the ALE sponge module control structure + ! Local variables real :: Kd ! A diffusivity used in the default for other tracer diffusivities, in MKS units [m2 s-1] integer :: num_mode logical :: use_temperature character(len=20) :: EN1, EN2, EN3 -! This "include" declares and sets the variable "version". -#include "version_variable.h" + ! This "include" declares and sets the variable "version". +# include "version_variable.h" character(len=40) :: mdl = "MOM_diabatic_driver" ! This module's name. character(len=48) :: thickness_units character(len=40) :: var_name