MOM6
MOM_obsolete_params.F90
Go to the documentation of this file.
1 !> Methods for testing for, and list of, obsolete run-time parameters.
3 
4 ! This file is part of MOM6. See LICENSE.md for the license.
5 ! This module was first conceived and written by Robert Hallberg, July 2010.
6 
7 use mom_error_handler, only : mom_error, fatal, warning, is_root_pe
9 
10 implicit none ; private
11 
12 #include <MOM_memory.h>
13 
16 
17 contains
18 
19 !> Scans input parameter file for list obsolete parameters.
20 subroutine find_obsolete_params(param_file)
21  type(param_file_type), intent(in) :: param_file !< Structure containing parameter file data.
22  ! Local variables
23  character(len=40) :: mdl = "find_obsolete_params" ! This module's name.
24 ! This include declares and sets the variable "version".
25 #include "version_variable.h"
26  integer :: test_int, l_seg, nseg
27  logical :: test_logic, test_logic2, test_logic3, split
28  character(len=40) :: temp_string
29 
30  if (.not.is_root_pe()) return
31 
32  call obsolete_int(param_file, "NTSTEP", &
33  hint="Instead use DT_THERM to set the thermodynamic time-step.")
34 
35  call obsolete_logical(param_file, "JACOBIAN_PGF", .false., &
36  hint="Instead use ANALYTIC_FV_PGF.")
37 
38  call obsolete_logical(param_file, "SADOURNY", &
39  hint="Instead use CORIOLIS_SCHEME='SADOURNY'.")
40 
41  call obsolete_logical(param_file, "ARITHMETIC_BT_THICK", &
42  hint="Instead use BT_THICK_SCHEME='ARITHMETIC'.")
43 
44  call obsolete_logical(param_file, "HYBRID_BT_THICK", &
45  hint="Instead use BT_THICK_SCHEME='HYBRID'.")
46 
47  call obsolete_logical(param_file, "BT_CONT_BT_THICK", &
48  hint="Instead use BT_THICK_SCHEME='FROM_BT_CONT'.")
49 
50  call obsolete_logical(param_file, "ADD_KV_SLOW", &
51  hint="This option is no longer needed, nor supported.")
52 
53  call obsolete_logical(param_file, "APPLY_OBC_U", &
54  hint="Instead use OBC_NUMBER_SEGMENTS>0 and use the new segments protocol.")
55  call obsolete_logical(param_file, "APPLY_OBC_V", &
56  hint="Instead use OBC_NUMBER_SEGMENTS>0 and use the new segments protocol.")
57  call obsolete_logical(param_file, "APPLY_OBC_V_FLATHER_NORTH", &
58  hint="Instead use OBC_NUMBER_SEGMENTS>0 and use the new segments protocol.")
59  call obsolete_logical(param_file, "APPLY_OBC_V_FLATHER_SOUTH", &
60  hint="Instead use OBC_NUMBER_SEGMENTS>0 and use the new segments protocol.")
61  call obsolete_logical(param_file, "APPLY_OBC_U_FLATHER_EAST", &
62  hint="Instead use OBC_NUMBER_SEGMENTS>0 and use the new segments protocol.")
63  call obsolete_logical(param_file, "APPLY_OBC_U_FLATHER_WEST", &
64  hint="Instead use OBC_NUMBER_SEGMENTS>0 and use the new segments protocol.")
65  call obsolete_char(param_file, "OBC_CONFIG", &
66  hint="Instead use OBC_USER_CONFIG and use the new segments protocol.")
67  call obsolete_char(param_file, "READ_OBC_ETA", &
68  hint="Instead use OBC_SEGMENT_XXX_DATA.")
69  call obsolete_char(param_file, "READ_OBC_UV", &
70  hint="Instead use OBC_SEGMENT_XXX_DATA.")
71  call obsolete_char(param_file, "READ_OBC_TS", &
72  hint="Instead use OBC_SEGMENT_XXX_DATA.")
73  call obsolete_char(param_file, "EXTEND_OBC_SEGMENTS", &
74  hint="This option is no longer needed, nor supported.")
75  call obsolete_char(param_file, "MEKE_VISCOSITY_COEFF", &
76  hint="This option has been replaced by MEKE_VISCOSITY_COEFF_KU and \n" //&
77  " MEKE_VISCOSITY_COEFF_AU. Please set these parameters instead.")
78  nseg = 0
79  call read_param(param_file, "OBC_NUMBER_OF_SEGMENTS", nseg)
80  do l_seg = 1,nseg
81  write(temp_string(1:22),"('OBC_SEGMENT_',i3.3,'_TNUDGE')") l_seg
82  call obsolete_real(param_file, temp_string, &
83  hint="Instead use OBC_SEGMENT_xxx_VELOCITY_NUDGING_TIMESCALES.")
84  enddo
85 
86  test_logic3 = .true. ; call read_param(param_file,"ENABLE_THERMODYNAMICS",test_logic3)
87  test_logic = .true. ; call read_param(param_file,"TEMPERATURE",test_logic)
88  test_logic2 = .false. ; call read_param(param_file,"TEMPERATURE",test_logic2)
89  if (test_logic .eqv. test_logic2) then ; if (test_logic .eqv. test_logic3) then
90  call mom_error(warning, "find_obsolete_params: "// &
91  "TEMPERATURE is an obsolete run-time flag, but is set consistently with \n"//&
92  " ENABLE_THERMODYNAMICS.")
93  else
94  call mom_error(fatal, "find_obsolete_params: "// &
95  "TEMPERATURE is an obsolete run-time flag. Use ENABLE_THERMODYNAMICS instead.")
96  endif ; endif
97 
98  test_logic = test_logic3 ; call read_param(param_file,"NONLINEAR_EOS",test_logic)
99  if (test_logic .neqv. test_logic3) then
100  call mom_error(warning, "find_obsolete_params: "// &
101  "NONLINEAR_EOS is an obsolete option. Instead define " // &
102  "USE_EOS to use an equation of state to calculate density.")
103  endif
104 
105 ! test_logic = .true. ; call read_param(param_file,"USE_RIVER_HEAT_CONTENT",test_logic)
106 ! test_logic2 = .false. ; call read_param(param_file,"USE_RIVER_HEAT_CONTENT",test_logic2)
107 ! if (test_logic .eqv. test_logic2) call MOM_ERROR(FATAL, "find_obsolete_params: "// &
108 ! "USE_RIVER_HEAT_CONTENT, is an obsolete run-time flag.")
109 
110 ! test_logic = .true. ; call read_param(param_file,"USE_CALVING_HEAT_CONTENT",test_logic)
111 ! test_logic2 = .false. ; call read_param(param_file,"USE_CALVING_HEAT_CONTENT",test_logic2)
112 ! if (test_logic .eqv. test_logic2) call MOM_ERROR(FATAL, "find_obsolete_params: "// &
113 ! "USE_CALVING_HEAT_CONTENT, is an obsolete run-time flag.")
114 
115  call obsolete_int(param_file, "NXTOT")
116  call obsolete_int(param_file, "NYTOT")
117  call obsolete_int(param_file, "NZ")
118  call obsolete_int(param_file, "NXPROC")
119  call obsolete_int(param_file, "NYPROC")
120  call obsolete_int(param_file, "NXPROC_IO")
121  call obsolete_int(param_file, "NYPROC_IO")
122  call obsolete_int(param_file, "NXHALO")
123  call obsolete_int(param_file, "NYHALO")
124  call obsolete_int(param_file, "ML_PRESORT_NZ_CONV_ADJ")
125 
126  call obsolete_int(param_file, "NIPROC_IO", hint="Use IO_LAYOUT=#,# instead.")
127  call obsolete_int(param_file, "NJPROC_IO", hint="Use IO_LAYOUT=#,# instead.")
128 
129  call obsolete_real(param_file, "BT_COR_SLOW_RATE", 0.0)
130  call obsolete_real(param_file, "BT_COR_FRAC", 1.0)
131 
132  call obsolete_logical(param_file, "MASK_MASSLESS_TRACERS", .false.)
133 
134  call obsolete_logical(param_file, "BT_INCLUDE_UDHDT", .false.)
135 
136  call obsolete_logical(param_file, "RIGA_SET_DIFFUSIVITY", .false.)
137  call obsolete_logical(param_file, "RIGA_ITIDE_BUGS", .false.)
138  call obsolete_logical(param_file, "RIGA_ENTRAINMENT_FOIBLES", .false.)
139  call obsolete_logical(param_file, "RIGA_TRACER_DIFFUSE_BUGS", .false.)
140  call obsolete_logical(param_file, "RIGA_KAPPA_SHEAR_BUGS1", .false.)
141  call obsolete_logical(param_file, "RIGA_KAPPA_SHEAR_BUGS2", .false.)
142  call obsolete_logical(param_file, "CONT_PPM_RIGA_BUGS", .false.)
143  call obsolete_logical(param_file, "USE_REPRODUCING_SUM", .true.)
144  call obsolete_logical(param_file, "SLOW_BITWISE_GLOBAL_FORCING_SUMS", .false.)
145  call obsolete_logical(param_file, "ALWAYS_WRITE_GEOM")
146  call obsolete_real(param_file, "I_ZETA")
147 
148  call obsolete_logical(param_file, "REF_COMPRESS_3D")
149  call obsolete_char(param_file, "COMPRESS_FILE")
150  call obsolete_char(param_file, "REF_COMPRESS_FILE_TEMP")
151  call obsolete_char(param_file, "REF_COMPRESS_FILE_SALT")
152  call obsolete_char(param_file, "REF_COMPRESS_FILE_DEPTH")
153  call obsolete_char(param_file, "DIAG_REMAP_Z_GRID_DEF", "Use NUM_DIAG_COORDS, DIAG_COORDS and DIAG_COORD_DEF_Z")
154 
155  call obsolete_logical(param_file, "OLD_RESTRAT_PARAM", .false.)
156  call obsolete_real(param_file, "ML_RESTRAT_COEF", 0.0)
157  call obsolete_logical(param_file, "FULL_THICKNESSDIFFUSE", .true.)
158  call obsolete_logical(param_file, "DIFFUSE_ISOPYCNALS", .true.)
159 
160  call obsolete_logical(param_file, "MOREL_PEN_SW")
161  call obsolete_logical(param_file, "MANIZZA_PEN_SW")
162 
163  call obsolete_logical(param_file, "USE_H2000_SHEAR_MIXING", .false.)
164  call obsolete_real(param_file, "SHEARMIX_LAT_EQ", 0.0)
165  call obsolete_real(param_file, "RINO_CRIT_EQ")
166  call obsolete_real(param_file, "SHEARMIX_RATE_EQ")
167 
168  call obsolete_real(param_file, "VSTAR_SCALE_FACTOR", hint="Use EPBL_VEL_SCALE_FACTOR instead.")
169  call obsolete_logical(param_file, "ORIG_MLD_ITERATION", .false.)
170 
171  call obsolete_logical(param_file, "CONTINUITY_PPM", .true.)
172 
173  call obsolete_logical(param_file, "USE_LOCAL_PREF", .true.)
174  call obsolete_logical(param_file, "USE_LOCAL_PREF_CORRECT", .true.)
175  test_logic = .false. ; call read_param(param_file, "USE_JACKSON_PARAM", test_logic)
176  call obsolete_logical(param_file, "RINOMIX", test_logic)
177  call obsolete_logical(param_file, "NORMALIZED_SUM_OUT", .true.)
178 
179  call obsolete_real(param_file, "RLAY_RANGE")
180  call obsolete_real(param_file, "RLAY_REF")
181 
182  call obsolete_real(param_file, "HMIX")
183  call obsolete_real(param_file, "VSTAR_SCALE_COEF")
184  call obsolete_real(param_file, "ZSTAR_RIGID_SURFACE_THRESHOLD")
185 
186  test_int = -1 ; call read_param(param_file,"ML_RADIATION_CODING",test_int)
187  if (test_int == 1) call mom_error(fatal, "find_obsolete_params: "// &
188  "ML_RADIATION_CODING is an obsolete option and the code previously "//&
189  "used by setting it to 1 has been eliminated.")
190  if (test_int /= -1) call mom_error(warning, "find_obsolete_params: "// &
191  "ML_RADIATION_CODING is an obsolete option.")
192 
193  ! Test for inconsistent parameter settings.
194  split = .true. ; test_logic = .false.
195  call read_param(param_file,"SPLIT",split)
196  call read_param(param_file,"DYNAMIC_SURFACE_PRESSURE",test_logic)
197  if (test_logic .and. .not.split) call mom_error(fatal, &
198  "find_obsolete_params: #define DYNAMIC_SURFACE_PRESSURE is not yet "//&
199  "implemented without #define SPLIT.")
200 
201  call obsolete_logical(param_file, "USE_LEGACY_SPLIT", .false.)
202 
203  call obsolete_logical(param_file, "FLUX_BT_COUPLING", .false.)
204  call obsolete_logical(param_file, "READJUST_BT_TRANS", .false.)
205  call obsolete_logical(param_file, "RESCALE_BT_FACE_AREAS", .false.)
206  call obsolete_logical(param_file, "APPLY_BT_DRAG", .true.)
207  call obsolete_real(param_file, "BT_MASS_SOURCE_LIMIT", 0.0)
208 
209  call obsolete_int(param_file, "SEAMOUNT_LENGTH_SCALE", hint="Use SEAMOUNT_X_LENGTH_SCALE instead.")
210 
211  call obsolete_logical(param_file, "MSTAR_FIXED", hint="Instead use MSTAR_MODE.")
212  call obsolete_logical(param_file, "USE_VISBECK_SLOPE_BUG", .false.)
213 
214  call obsolete_real(param_file, "MIN_Z_DIAG_INTERVAL")
215  call obsolete_char(param_file, "Z_OUTPUT_GRID_FILE")
216 
217  ! Write the file version number to the model log.
218  call log_version(param_file, mdl, version)
219 
220 end subroutine find_obsolete_params
221 
222 !> Test for presence of obsolete LOGICAL in parameter file.
223 subroutine obsolete_logical(param_file, varname, warning_val, hint)
224  type(param_file_type), intent(in) :: param_file !< Structure containing parameter file data.
225  character(len=*), intent(in) :: varname !< Name of obsolete LOGICAL parameter.
226  logical, optional, intent(in) :: warning_val !< An allowed value that causes a warning instead of an error.
227  character(len=*), optional, intent(in) :: hint !< A hint to the user about what to do.
228  ! Local variables
229  logical :: test_logic, fatal_err
230  character(len=128) :: hint_msg
231 
232  test_logic = .false. ; call read_param(param_file, varname,test_logic)
233  fatal_err = .true.
234  if (present(warning_val)) fatal_err = (warning_val .neqv. .true.)
235  hint_msg = " " ; if (present(hint)) hint_msg = hint
236 
237  if (test_logic) then
238  if (fatal_err) then
239  call mom_error(fatal, "MOM_obsolete_params: "//trim(varname)// &
240  " is an obsolete run-time flag, and should not be used. "// &
241  trim(hint_msg))
242  else
243  call mom_error(warning, "MOM_obsolete_params: "//trim(varname)// &
244  " is an obsolete run-time flag. "//trim(hint_msg))
245  endif
246  endif
247 
248  test_logic = .true. ; call read_param(param_file, varname, test_logic)
249  fatal_err = .true.
250  if (present(warning_val)) fatal_err = (warning_val .neqv. .false.)
251 
252  if (.not.test_logic) then
253  if (fatal_err) then
254  call mom_error(fatal, "MOM_obsolete_params: "//trim(varname)// &
255  " is an obsolete run-time flag, and should not be used. "// &
256  trim(hint_msg))
257  else
258  call mom_error(warning, "MOM_obsolete_params: "//trim(varname)// &
259  " is an obsolete run-time flag. "//trim(hint_msg))
260  endif
261  endif
262 
263 end subroutine obsolete_logical
264 
265 !> Test for presence of obsolete STRING in parameter file.
266 subroutine obsolete_char(param_file, varname, hint)
267  type(param_file_type), intent(in) :: param_file !< Structure containing parameter file data.
268  character(len=*), intent(in) :: varname !< Name of obsolete STRING parameter.
269  character(len=*), optional, intent(in) :: hint !< A hint to the user about what to do.
270  ! Local variables
271  character(len=200) :: test_string, hint_msg
272 
273  test_string = ''; call read_param(param_file, varname, test_string)
274  hint_msg = " " ; if (present(hint)) hint_msg = hint
275 
276  if (len_trim(test_string) > 0) call mom_error(fatal, &
277  "MOM_obsolete_params: "//trim(varname)// &
278  " is an obsolete run-time flag, and should not be used. "// &
279  trim(hint_msg))
280 
281 end subroutine obsolete_char
282 
283 !> Test for presence of obsolete REAL in parameter file.
284 subroutine obsolete_real(param_file, varname, warning_val, hint)
285  type(param_file_type), intent(in) :: param_file !< Structure containing parameter file data.
286  character(len=*), intent(in) :: varname !< Name of obsolete REAL parameter.
287  real, optional, intent(in) :: warning_val !< An allowed value that causes a warning instead of an error.
288  character(len=*), optional, intent(in) :: hint !< A hint to the user about what to do.
289  ! Local variables
290  real :: test_val, warn_val
291  character(len=128) :: hint_msg
292 
293  test_val = -9e35; call read_param(param_file, varname, test_val)
294  warn_val = -9e35; if (present(warning_val)) warn_val = warning_val
295  hint_msg = " " ; if (present(hint)) hint_msg = hint
296 
297  if (test_val /= -9e35) then
298  if (test_val == warn_val) then
299  call mom_error(warning, "MOM_obsolete_params: "//trim(varname)// &
300  " is an obsolete run-time flag. "//trim(hint_msg))
301  else
302  call mom_error(fatal, "MOM_obsolete_params: "//trim(varname)// &
303  " is an obsolete run-time flag, and should not be used. "// &
304  trim(hint_msg))
305  endif
306  endif
307 end subroutine obsolete_real
308 
309 !> Test for presence of obsolete INTEGER in parameter file.
310 subroutine obsolete_int(param_file, varname, warning_val, hint)
311  type(param_file_type), intent(in) :: param_file !< Structure containing parameter file data.
312  character(len=*), intent(in) :: varname !< Name of obsolete INTEGER parameter.
313  integer, optional, intent(in) :: warning_val !< An allowed value that causes a warning instead of an error.
314  character(len=*), optional, intent(in) :: hint !< A hint to the user about what to do.
315  ! Local variables
316  integer :: test_val, warn_val
317  character(len=128) :: hint_msg
318 
319  test_val = -123456788; call read_param(param_file, varname, test_val)
320  warn_val = -123456788; if (present(warning_val)) warn_val = warning_val
321  hint_msg = " " ; if (present(hint)) hint_msg = hint
322 
323  if (test_val /= -123456788) then
324  if (test_val == warn_val) then
325  call mom_error(warning, "MOM_obsolete_params: "//trim(varname)// &
326  " is an obsolete run-time flag. "//trim(hint_msg))
327  else
328  call mom_error(fatal, "MOM_obsolete_params: "//trim(varname)// &
329  " is an obsolete run-time flag, and should not be used. "// &
330  trim(hint_msg))
331  endif
332  endif
333 end subroutine obsolete_int
334 
335 end module mom_obsolete_params
mom_obsolete_params::obsolete_int
subroutine, public obsolete_int(param_file, varname, warning_val, hint)
Test for presence of obsolete INTEGER in parameter file.
Definition: MOM_obsolete_params.F90:311
mom_file_parser::log_version
An overloaded interface to log version information about modules.
Definition: MOM_file_parser.F90:109
mom_obsolete_params::obsolete_logical
subroutine, public obsolete_logical(param_file, varname, warning_val, hint)
Test for presence of obsolete LOGICAL in parameter file.
Definition: MOM_obsolete_params.F90:224
mom_file_parser::param_file_type
A structure that can be parsed to read and document run-time parameters.
Definition: MOM_file_parser.F90:54
mom_obsolete_params::obsolete_real
subroutine, public obsolete_real(param_file, varname, warning_val, hint)
Test for presence of obsolete REAL in parameter file.
Definition: MOM_obsolete_params.F90:285
mom_obsolete_params::find_obsolete_params
subroutine, public find_obsolete_params(param_file)
Scans input parameter file for list obsolete parameters.
Definition: MOM_obsolete_params.F90:21
mom_file_parser
The MOM6 facility to parse input files for runtime parameters.
Definition: MOM_file_parser.F90:2
mom_error_handler::is_root_pe
logical function, public is_root_pe()
This returns .true. if the current PE is the root PE.
Definition: MOM_error_handler.F90:44
mom_error_handler::mom_error
subroutine, public mom_error(level, message, all_print)
This provides a convenient interface for writing an mpp_error message with run-time filter based on a...
Definition: MOM_error_handler.F90:72
mom_obsolete_params
Methods for testing for, and list of, obsolete run-time parameters.
Definition: MOM_obsolete_params.F90:2
mom_error_handler
Routines for error handling and I/O management.
Definition: MOM_error_handler.F90:2
mom_obsolete_params::obsolete_char
subroutine, public obsolete_char(param_file, varname, hint)
Test for presence of obsolete STRING in parameter file.
Definition: MOM_obsolete_params.F90:267
mom_file_parser::read_param
An overloaded interface to read various types of parameters.
Definition: MOM_file_parser.F90:90