Skip to content

Commit

Permalink
+Obsolete ETA_TOLERANCE_AUX
Browse files Browse the repository at this point in the history
  The runtime parameter ETA_TOLERANCE_AUX was being read but was never used, so
it is being obsoleted.  However, because some experiments were using this and
there are effectively no changes in behavior, a warning will be issued instead
of a fatal error if this parameter is set.  All answers are bitwise identical,
but there are changes to some MOM_parameter_doc files.
  • Loading branch information
Hallberg-NOAA authored and marshallward committed Dec 9, 2021
1 parent 3f46b6a commit ec553aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
22 changes: 5 additions & 17 deletions src/core/MOM_continuity_PPM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ module MOM_continuity_PPM
real :: tol_vel !< The tolerance for barotropic velocity
!! discrepancies between the barotropic solution and
!! the sum of the layer thicknesses [L T-1 ~> m s-1].
real :: tol_eta_aux !< The tolerance for free-surface height
!! discrepancies between the barotropic solution and
!! the sum of the layer thicknesses when calculating
!! the auxiliary corrected velocities [H ~> m or kg m-2].
real :: CFL_limit_adjust !< The maximum CFL of the adjusted velocities [nondim]
logical :: aggress_adjust !< If true, allow the adjusted velocities to have a
!! relative CFL change up to 0.5. False by default.
Expand Down Expand Up @@ -2234,9 +2230,9 @@ subroutine continuity_PPM_init(Time, G, GV, US, param_file, diag, CS)
type(diag_ctrl), target, intent(inout) :: diag !< A structure that is used to
!! regulate diagnostic output.
type(continuity_PPM_CS), intent(inout) :: CS !< Module's control structure.
!> This include declares and sets the variable "version".
#include "version_variable.h"
real :: tol_eta_m ! An unscaled version of tol_eta [m].

!> This include declares and sets the variable "version".
# include "version_variable.h"
character(len=40) :: mdl = "MOM_continuity_PPM" ! This module's name.

CS%initialized = .true.
Expand Down Expand Up @@ -2267,16 +2263,8 @@ subroutine continuity_PPM_init(Time, G, GV, US, param_file, diag, CS)
"tolerance for SSH is 4 times this value. The default "//&
"is 0.5*NK*ANGSTROM, and this should not be set less "//&
"than about 10^-15*MAXIMUM_DEPTH.", units="m", scale=GV%m_to_H, &
default=0.5*GV%ke*GV%Angstrom_m, unscaled=tol_eta_m)

!### ETA_TOLERANCE_AUX can be obsoleted.
call get_param(param_file, mdl, "ETA_TOLERANCE_AUX", CS%tol_eta_aux, &
"The tolerance for free-surface height discrepancies "//&
"between the barotropic solution and the sum of the "//&
"layer thicknesses when calculating the auxiliary "//&
"corrected velocities. By default, this is the same as "//&
"ETA_TOLERANCE, but can be made larger for efficiency.", &
units="m", default=tol_eta_m, scale=GV%m_to_H)
default=0.5*GV%ke*GV%Angstrom_m)

call get_param(param_file, mdl, "VELOCITY_TOLERANCE", CS%tol_vel, &
"The tolerance for barotropic velocity discrepancies "//&
"between the barotropic solution and the sum of the "//&
Expand Down
9 changes: 7 additions & 2 deletions src/diagnostics/MOM_obsolete_params.F90
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ subroutine find_obsolete_params(param_file)
"find_obsolete_params: #define DYNAMIC_SURFACE_PRESSURE is not yet "//&
"implemented without #define SPLIT.")

call obsolete_real(param_file, "ETA_TOLERANCE_AUX", only_warn=.true.)
call obsolete_real(param_file, "BT_MASS_SOURCE_LIMIT", 0.0)

call obsolete_int(param_file, "SEAMOUNT_LENGTH_SCALE", hint="Use SEAMOUNT_X_LENGTH_SCALE instead.")
Expand Down Expand Up @@ -174,21 +175,25 @@ subroutine obsolete_char(param_file, varname, warning_val, hint)
end subroutine obsolete_char

!> Test for presence of obsolete REAL in parameter file.
subroutine obsolete_real(param_file, varname, warning_val, hint)
subroutine obsolete_real(param_file, varname, warning_val, hint, only_warn)
type(param_file_type), intent(in) :: param_file !< Structure containing parameter file data.
character(len=*), intent(in) :: varname !< Name of obsolete REAL parameter.
real, optional, intent(in) :: warning_val !< An allowed value that causes a warning instead of an error.
character(len=*), optional, intent(in) :: hint !< A hint to the user about what to do.
logical, optional, intent(in) :: only_warn !< If present and true, issue warnings instead of fatal errors.

! Local variables
real :: test_val, warn_val
logical :: issue_warning
character(len=128) :: hint_msg

test_val = -9e35; call read_param(param_file, varname, test_val)
warn_val = -9e35; if (present(warning_val)) warn_val = warning_val
hint_msg = " " ; if (present(hint)) hint_msg = hint
issue_warning = .false. ; if (present(only_warn)) issue_warning = only_warn

if (test_val /= -9e35) then
if (test_val == warn_val) then
if ((test_val == warn_val) .or. issue_warning) then
call MOM_ERROR(WARNING, "MOM_obsolete_params: "//trim(varname)// &
" is an obsolete run-time flag. "//trim(hint_msg))
else
Expand Down

0 comments on commit ec553aa

Please sign in to comment.