Initialization and configures a regridding control structure based on customizable run-time parameters.
177 type(regridding_CS),
intent(inout) :: CS
178 type(verticalGrid_type),
intent(in) :: GV
179 type(unit_scale_type),
intent(in) :: US
180 real,
intent(in) :: max_depth
181 type(param_file_type),
intent(in) :: param_file
182 character(len=*),
intent(in) :: mdl
183 character(len=*),
intent(in) :: coord_mode
184 character(len=*),
intent(in) :: param_prefix
186 character(len=*),
intent(in) :: param_suffix
190 character(len=80) :: string, string2, varName
191 character(len=40) :: coord_units, param_name, coord_res_param
192 character(len=200) :: inputdir, fileName
193 character(len=320) :: message
194 character(len=12) :: expected_units
195 logical :: tmpLogical, fix_haloclines, set_max, do_sum, main_parameters
196 logical :: coord_is_state_dependent, ierr
197 real :: filt_len, strat_tol, index_scale, tmpReal
198 real :: maximum_depth
199 real :: dz_fixed_sfc, Rho_avg_depth, nlay_sfc_int
200 real :: adaptTimeRatio, adaptZoom, adaptZoomCoeff, adaptBuoyCoeff, adaptAlpha
201 integer :: nz_fixed_sfc, k, nzf(4)
202 real,
dimension(:),
allocatable :: dz
204 real,
dimension(:),
allocatable :: h_max
205 real,
dimension(:),
allocatable :: z_max
207 real,
dimension(:),
allocatable :: dz_max
209 real,
dimension(:),
allocatable :: rho_target
211 real,
dimension(40) :: woa09_dz = (/ 5., 10., 10., 15., 22.5, 25., 25., 25., &
212 37.5, 50., 50., 75., 100., 100., 100., 100., &
213 100., 100., 100., 100., 100., 100., 100., 175., &
214 250., 375., 500., 500., 500., 500., 500., 500., &
215 500., 500., 500., 500., 500., 500., 500., 500. /)
217 call get_param(param_file, mdl,
"INPUTDIR", inputdir, default=
".")
218 inputdir = slasher(inputdir)
220 main_parameters=.false.
221 if (len_trim(param_prefix)==0) main_parameters=.true.
222 if (main_parameters .and. len_trim(param_suffix)>0)
call mom_error(fatal,trim(mdl)//
', initialize_regridding: '// &
223 'Suffix provided without prefix for parameter names!')
226 cs%regridding_scheme = coordinatemode(coord_mode)
227 coord_is_state_dependent = state_dependent(coord_mode)
228 maximum_depth = us%Z_to_m*max_depth
230 if (main_parameters)
then
232 call get_param(param_file, mdl,
"REGRIDDING_COORDINATE_UNITS", coord_units, &
233 "Units of the regridding coordinate.", default=coordinateunits(coord_mode))
235 coord_units=coordinateunits(coord_mode)
238 if (coord_is_state_dependent)
then
239 if (main_parameters)
then
240 param_name =
"INTERPOLATION_SCHEME"
241 string2 = regriddingdefaultinterpscheme
243 param_name = trim(param_prefix)//
"_INTERP_SCHEME_"//trim(param_suffix)
246 call get_param(param_file, mdl,
"INTERPOLATION_SCHEME", string, &
247 "This sets the interpolation scheme to use to "//&
248 "determine the new grid. These parameters are "//&
249 "only relevant when REGRIDDING_COORDINATE_MODE is "//&
250 "set to a function of state. Otherwise, it is not "//&
251 "used. It can be one of the following schemes: "//&
252 trim(regriddinginterpschemedoc), default=trim(string2))
253 call set_regrid_params(cs, interp_scheme=string)
256 if (main_parameters .and. coord_is_state_dependent)
then
257 call get_param(param_file, mdl,
"BOUNDARY_EXTRAPOLATION", tmplogical, &
258 "When defined, a proper high-order reconstruction "//&
259 "scheme is used within boundary cells rather "//&
260 "than PCM. E.g., if PPM is used for remapping, a "//&
261 "PPM reconstruction will also be used within "//&
262 "boundary cells.", default=regriddingdefaultboundaryextrapolation)
263 call set_regrid_params(cs, boundary_extrapolation=tmplogical)
265 call set_regrid_params(cs, boundary_extrapolation=.false.)
269 if (main_parameters)
then
270 param_name =
"ALE_COORDINATE_CONFIG"
271 coord_res_param =
"ALE_RESOLUTION"
274 param_name = trim(param_prefix)//
"_DEF_"//trim(param_suffix)
275 coord_res_param = trim(param_prefix)//
"_RES_"//trim(param_suffix)
277 if (maximum_depth>3000.) string2=
'WOA09'
279 call get_param(param_file, mdl, param_name, string, &
280 "Determines how to specify the coordinate "//&
281 "resolution. Valid options are:\n"//&
282 " PARAM - use the vector-parameter "//trim(coord_res_param)//
"\n"//&
283 " UNIFORM[:N] - uniformly distributed\n"//&
284 " FILE:string - read from a file. The string specifies\n"//&
285 " the filename and variable name, separated\n"//&
286 " by a comma or space, e.g. FILE:lev.nc,dz\n"//&
287 " or FILE:lev.nc,interfaces=zw\n"//&
288 " WOA09[:N] - the WOA09 vertical grid (approximately)\n"//&
289 " FNC1:string - FNC1:dz_min,H_total,power,precision\n"//&
290 " HYBRID:string - read from a file. The string specifies\n"//&
291 " the filename and two variable names, separated\n"//&
292 " by a comma or space, for sigma-2 and dz. e.g.\n"//&
293 " HYBRID:vgrid.nc,sigma2,dz",&
294 default=trim(string2))
295 message =
"The distribution of vertical resolution for the target\n"//&
296 "grid used for Eulerian-like coordinates. For example,\n"//&
297 "in z-coordinate mode, the parameter is a list of level\n"//&
298 "thicknesses (in m). In sigma-coordinate mode, the list\n"//&
299 "is of non-dimensional fractions of the water column."
300 if (index(trim(string),
'UNIFORM')==1)
then
301 if (len_trim(string)==7)
then
303 tmpreal = maximum_depth
304 elseif (index(trim(string),
'UNIFORM:')==1 .and. len_trim(string)>8)
then
306 ke = extract_integer(string(9:len_trim(string)),
'',1)
307 tmpreal = extract_real(string(9:len_trim(string)),
',',2,missing_value=maximum_depth)
309 call mom_error(fatal,trim(mdl)//
', initialize_regridding: '// &
310 'Unable to interpret "'//trim(string)//
'".')
314 dz(:) = uniformresolution(ke, coord_mode, tmpreal, gv%Rlay(1), gv%Rlay(1))
316 dz(:) = uniformresolution(ke, coord_mode, tmpreal, &
317 gv%Rlay(1)+0.5*(gv%Rlay(1)-gv%Rlay(2)), &
318 gv%Rlay(ke)+0.5*(gv%Rlay(ke)-gv%Rlay(ke-1)) )
320 if (main_parameters)
call log_param(param_file, mdl,
"!"//coord_res_param, dz, &
321 trim(message), units=trim(coord_units))
322 elseif (trim(string)==
'PARAM')
then
326 call get_param(param_file, mdl, coord_res_param, dz, &
327 trim(message), units=trim(coord_units), fail_if_missing=.true.)
328 elseif (index(trim(string),
'FILE:')==1)
then
331 if (string(6:6)==
'.' .or. string(6:6)==
'/')
then
333 filename = trim( extractword(trim(string(6:80)), 1) )
336 filename = trim(inputdir) // trim( extractword(trim(string(6:80)), 1) )
338 if (.not. file_exists(filename))
call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
339 "Specified file not found: Looking for '"//trim(filename)//
"' ("//trim(string)//
")")
341 varname = trim( extractword(trim(string(6:)), 2) )
342 if (len_trim(varname)==0)
then
343 if (field_exists(filename,
'dz')) then; varname =
'dz'
344 elseif (field_exists(filename,
'dsigma')) then; varname =
'dsigma'
345 elseif (field_exists(filename,
'ztest')) then; varname =
'ztest'
346 else ;
call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
347 "Coordinate variable not specified and none could be guessed.")
353 if (cs%regridding_scheme == regridding_sigma)
then
354 expected_units =
'nondim'
355 elseif (cs%regridding_scheme == regridding_rho)
then
356 expected_units =
'kg m-3'
358 expected_units =
'meters'
360 if (index(trim(varname),
'interfaces=')==1)
then
361 varname=trim(varname(12:))
362 call check_grid_def(filename, varname, expected_units, message, ierr)
363 if (ierr)
call mom_error(fatal,trim(mdl)//
", initialize_regridding: "//&
364 "Unsupported format in grid definition '"//trim(filename)//
"'. Error message "//trim(message))
365 call field_size(trim(filename), trim(varname), nzf)
367 if (cs%regridding_scheme == regridding_rho)
then
368 allocate(rho_target(ke+1))
369 call mom_read_data(trim(filename), trim(varname), rho_target)
372 allocate(z_max(ke+1))
373 call mom_read_data(trim(filename), trim(varname), z_max)
374 dz(:) = abs(z_max(1:ke) - z_max(2:ke+1))
379 call field_size(trim(filename), trim(varname), nzf)
382 call mom_read_data(trim(filename), trim(varname), dz)
384 if (main_parameters .and. ke/=gv%ke)
then
385 call mom_error(fatal,trim(mdl)//
', initialize_regridding: '// &
386 'Mismatch in number of model levels and "'//trim(string)//
'".')
388 if (main_parameters)
call log_param(param_file, mdl,
"!"//coord_res_param, dz, &
389 trim(message), units=coordinateunits(coord_mode))
390 elseif (index(trim(string),
'FNC1:')==1)
then
391 ke = gv%ke;
allocate(dz(ke))
392 call dz_function1( trim(string(6:)), dz )
393 if (main_parameters)
call log_param(param_file, mdl,
"!"//coord_res_param, dz, &
394 trim(message), units=coordinateunits(coord_mode))
395 elseif (index(trim(string),
'RFNC1:')==1)
then
397 ke = rho_function1( trim(string(7:)), rho_target )
398 elseif (index(trim(string),
'HYBRID:')==1)
then
399 ke = gv%ke;
allocate(dz(ke))
401 allocate(rho_target(ke+1))
402 filename = trim( extractword(trim(string(8:)), 1) )
403 if (filename(1:1)/=
'.' .and. filename(1:1)/=
'/') filename = trim(inputdir) // trim( filename )
404 if (.not. file_exists(filename))
call mom_error(fatal,trim(mdl)//
", initialize_regridding: HYBRID "// &
405 "Specified file not found: Looking for '"//trim(filename)//
"' ("//trim(string)//
")")
406 varname = trim( extractword(trim(string(8:)), 2) )
407 if (.not. field_exists(filename,varname))
call mom_error(fatal,trim(mdl)//
", initialize_regridding: HYBRID "// &
408 "Specified field not found: Looking for '"//trim(varname)//
"' ("//trim(string)//
")")
409 call mom_read_data(trim(filename), trim(varname), rho_target)
410 varname = trim( extractword(trim(string(8:)), 3) )
411 if (varname(1:5) ==
'FNC1:')
then
412 call dz_function1( trim(string((index(trim(string),
'FNC1:')+5):)), dz )
414 if (.not. field_exists(filename,varname))
call mom_error(fatal,trim(mdl)//
", initialize_regridding: HYBRID "// &
415 "Specified field not found: Looking for '"//trim(varname)//
"' ("//trim(string)//
")")
416 call mom_read_data(trim(filename), trim(varname), dz)
418 if (main_parameters)
then
419 call log_param(param_file, mdl,
"!"//coord_res_param, dz, &
420 trim(message), units=coordinateunits(coord_mode))
421 call log_param(param_file, mdl,
"!TARGET_DENSITIES", rho_target, &
422 'HYBRID target densities for interfaces', units=coordinateunits(coord_mode))
424 elseif (index(trim(string),
'WOA09')==1)
then
425 if (len_trim(string)==5)
then
426 tmpreal = 0. ; ke = 0
427 do while (tmpreal<maximum_depth)
429 tmpreal = tmpreal + woa09_dz(ke)
431 elseif (index(trim(string),
'WOA09:')==1)
then
432 if (len_trim(string)==6)
call mom_error(fatal,trim(mdl)//
', initialize_regridding: '// &
433 'Expected string of form "WOA09:N" but got "'//trim(string)//
'".')
434 ke = extract_integer(string(7:len_trim(string)),
'',1)
436 if (ke>40 .or. ke<1)
call mom_error(fatal,trim(mdl)//
', initialize_regridding: '// &
437 'For "WOA05:N" N must 0<N<41 but got "'//trim(string)//
'".')
439 dz(1:ke) = woa09_dz(1:ke)
441 call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
442 "Unrecognized coordinate configuration"//trim(string))
445 if (main_parameters)
then
447 if (coordinatemode(coord_mode) == regridding_zstar .or. &
448 coordinatemode(coord_mode) == regridding_hycom1 .or. &
449 coordinatemode(coord_mode) == regridding_slight .or. &
450 coordinatemode(coord_mode) == regridding_adaptive)
then
452 tmpreal = sum( dz(:) )
453 if (tmpreal < maximum_depth)
then
454 dz(ke) = dz(ke) + ( maximum_depth - tmpreal )
455 elseif (tmpreal > maximum_depth)
then
456 if ( dz(ke) + ( maximum_depth - tmpreal ) > 0. )
then
457 dz(ke) = dz(ke) + ( maximum_depth - tmpreal )
459 call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
460 "MAXIMUM_DEPTH was too shallow to adjust bottom layer of DZ!"//trim(string))
469 allocate( cs%coordinateResolution(cs%nk) ); cs%coordinateResolution(:) = -1.e30
470 if (state_dependent(cs%regridding_scheme))
then
472 allocate( cs%target_density(cs%nk+1) ); cs%target_density(:) = -1.e30
475 if (
allocated(dz))
then
476 if ((coordinatemode(coord_mode) == regridding_sigma) .or. &
477 (coordinatemode(coord_mode) == regridding_rho))
then
478 call setcoordinateresolution(dz, cs, scale=1.0)
479 elseif (coordinatemode(coord_mode) == regridding_adaptive)
then
480 call setcoordinateresolution(dz, cs, scale=gv%m_to_H)
481 cs%coord_scale = gv%H_to_m
483 call setcoordinateresolution(dz, cs, scale=us%m_to_Z)
484 cs%coord_scale = us%Z_to_m
488 if (
allocated(rho_target))
then
489 call set_target_densities(cs, rho_target)
490 deallocate(rho_target)
493 elseif (coordinatemode(coord_mode) == regridding_rho)
then
494 call set_target_densities_from_gv(gv, cs)
495 call log_param(param_file, mdl,
"!TARGET_DENSITIES", cs%target_density, &
496 'RHO target densities for interfaces', units=coordinateunits(coord_mode))
500 call initcoord(cs, gv, coord_mode)
502 if (main_parameters .and. coord_is_state_dependent)
then
503 call get_param(param_file, mdl,
"REGRID_COMPRESSIBILITY_FRACTION", tmpreal, &
504 "When interpolating potential density profiles we can add "//&
505 "some artificial compressibility solely to make homogeneous "//&
506 "regions appear stratified.", default=0.)
507 call set_regrid_params(cs, compress_fraction=tmpreal)
510 if (main_parameters)
then
511 call get_param(param_file, mdl,
"MIN_THICKNESS", tmpreal, &
512 "When regridding, this is the minimum layer "//&
513 "thickness allowed.", units=
"m", scale=gv%m_to_H, &
514 default=regriddingdefaultminthickness )
515 call set_regrid_params(cs, min_thickness=tmpreal)
517 call set_regrid_params(cs, min_thickness=0.)
520 if (coordinatemode(coord_mode) == regridding_slight)
then
522 call get_param(param_file, mdl,
"SLIGHT_DZ_SURFACE", dz_fixed_sfc, &
523 "The nominal thickness of fixed thickness near-surface "//&
524 "layers with the SLight coordinate.", units=
"m", default=1.0, scale=gv%m_to_H)
525 call get_param(param_file, mdl,
"SLIGHT_NZ_SURFACE_FIXED", nz_fixed_sfc, &
526 "The number of fixed-depth surface layers with the SLight "//&
527 "coordinate.", units=
"nondimensional", default=2)
528 call get_param(param_file, mdl,
"SLIGHT_SURFACE_AVG_DEPTH", rho_avg_depth, &
529 "The thickness of the surface region over which to average "//&
530 "when calculating the density to use to define the interior "//&
531 "with the SLight coordinate.", units=
"m", default=1.0, scale=gv%m_to_H)
532 call get_param(param_file, mdl,
"SLIGHT_NLAY_TO_INTERIOR", nlay_sfc_int, &
533 "The number of layers to offset the surface density when "//&
534 "defining where the interior ocean starts with SLight.", &
535 units=
"nondimensional", default=2.0)
536 call get_param(param_file, mdl,
"SLIGHT_FIX_HALOCLINES", fix_haloclines, &
537 "If true, identify regions above the reference pressure "//&
538 "where the reference pressure systematically underestimates "//&
539 "the stratification and use this in the definition of the "//&
540 "interior with the SLight coordinate.", default=.false.)
542 call set_regrid_params(cs, dz_min_surface=dz_fixed_sfc, &
543 nz_fixed_surface=nz_fixed_sfc, rho_ml_avg_depth=rho_avg_depth, &
544 nlay_ml_to_interior=nlay_sfc_int, fix_haloclines=fix_haloclines)
545 if (fix_haloclines)
then
547 call get_param(param_file, mdl,
"HALOCLINE_FILTER_LENGTH", filt_len, &
548 "A length scale over which to smooth the temperature and "//&
549 "salinity before identifying erroneously unstable haloclines.", &
550 units=
"m", default=2.0)
551 call get_param(param_file, mdl,
"HALOCLINE_STRAT_TOL", strat_tol, &
552 "A tolerance for the ratio of the stratification of the "//&
553 "apparent coordinate stratification to the actual value "//&
554 "that is used to identify erroneously unstable haloclines. "//&
555 "This ratio is 1 when they are equal, and sensible values "//&
556 "are between 0 and 0.5.", units=
"nondimensional", default=0.2)
557 call set_regrid_params(cs, halocline_filt_len=filt_len, &
558 halocline_strat_tol=strat_tol)
563 if (coordinatemode(coord_mode) == regridding_adaptive)
then
564 call get_param(param_file, mdl,
"ADAPT_TIME_RATIO", adapttimeratio, &
565 "Ratio of ALE timestep to grid timescale.", units=
"s", default=1e-1)
566 call get_param(param_file, mdl,
"ADAPT_ZOOM_DEPTH", adaptzoom, &
567 "Depth of near-surface zooming region.", units=
"m", default=200.0, scale=gv%m_to_H)
568 call get_param(param_file, mdl,
"ADAPT_ZOOM_COEFF", adaptzoomcoeff, &
569 "Coefficient of near-surface zooming diffusivity.", &
570 units=
"nondim", default=0.2)
571 call get_param(param_file, mdl,
"ADAPT_BUOY_COEFF", adaptbuoycoeff, &
572 "Coefficient of buoyancy diffusivity.", &
573 units=
"nondim", default=0.8)
574 call get_param(param_file, mdl,
"ADAPT_ALPHA", adaptalpha, &
575 "Scaling on optimization tendency.", &
576 units=
"nondim", default=1.0)
577 call get_param(param_file, mdl,
"ADAPT_DO_MIN_DEPTH", tmplogical, &
578 "If true, make a HyCOM-like mixed layer by preventing interfaces "//&
579 "from being shallower than the depths specified by the regridding coordinate.", &
582 call set_regrid_params(cs, adapttimeratio=adapttimeratio, adaptzoom=adaptzoom, &
583 adaptzoomcoeff=adaptzoomcoeff, adaptbuoycoeff=adaptbuoycoeff, adaptalpha=adaptalpha, &
584 adaptdomin=tmplogical)
587 if (main_parameters .and. coord_is_state_dependent)
then
588 call get_param(param_file, mdl,
"MAXIMUM_INT_DEPTH_CONFIG", string, &
589 "Determines how to specify the maximum interface depths.\n"//&
590 "Valid options are:\n"//&
591 " NONE - there are no maximum interface depths\n"//&
592 " PARAM - use the vector-parameter MAXIMUM_INTERFACE_DEPTHS\n"//&
593 " FILE:string - read from a file. The string specifies\n"//&
594 " the filename and variable name, separated\n"//&
595 " by a comma or space, e.g. FILE:lev.nc,Z\n"//&
596 " FNC1:string - FNC1:dz_min,H_total,power,precision",&
598 message =
"The list of maximum depths for each interface."
599 allocate(z_max(ke+1))
601 if ( trim(string) ==
"NONE")
then
603 elseif ( trim(string) ==
"PARAM")
then
604 call get_param(param_file, mdl,
"MAXIMUM_INTERFACE_DEPTHS", z_max, &
605 trim(message), units=
"m", scale=gv%m_to_H, fail_if_missing=.true.)
606 call set_regrid_max_depths(cs, z_max)
607 elseif (index(trim(string),
'FILE:')==1)
then
608 if (string(6:6)==
'.' .or. string(6:6)==
'/')
then
610 filename = trim( extractword(trim(string(6:80)), 1) )
613 filename = trim(inputdir) // trim( extractword(trim(string(6:80)), 1) )
615 if (.not. file_exists(filename))
call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
616 "Specified file not found: Looking for '"//trim(filename)//
"' ("//trim(string)//
")")
619 varname = trim( extractword(trim(string(6:)), 2) )
620 if (.not. field_exists(filename,varname))
call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
621 "Specified field not found: Looking for '"//trim(varname)//
"' ("//trim(string)//
")")
622 if (len_trim(varname)==0)
then
623 if (field_exists(filename,
'z_max')) then; varname =
'z_max'
624 elseif (field_exists(filename,
'dz')) then; varname =
'dz' ; do_sum = .true.
625 elseif (field_exists(filename,
'dz_max')) then; varname =
'dz_max' ; do_sum = .true.
626 else ;
call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
627 "MAXIMUM_INT_DEPTHS variable not specified and none could be guessed.")
631 call mom_read_data(trim(filename), trim(varname), dz_max)
632 z_max(1) = 0.0 ;
do k=1,ke ; z_max(k+1) = z_max(k) + dz_max(k) ;
enddo
634 call mom_read_data(trim(filename), trim(varname), z_max)
636 call log_param(param_file, mdl,
"!MAXIMUM_INT_DEPTHS", z_max, &
637 trim(message), units=coordinateunits(coord_mode))
638 call set_regrid_max_depths(cs, z_max, gv%m_to_H)
639 elseif (index(trim(string),
'FNC1:')==1)
then
640 call dz_function1( trim(string(6:)), dz_max )
641 if ((coordinatemode(coord_mode) == regridding_slight) .and. &
642 (dz_fixed_sfc > 0.0))
then
643 do k=1,nz_fixed_sfc ; dz_max(k) = dz_fixed_sfc ;
enddo
645 z_max(1) = 0.0 ;
do k=1,ke ; z_max(k+1) = z_max(k) + dz_max(k) ;
enddo
646 call log_param(param_file, mdl,
"!MAXIMUM_INT_DEPTHS", z_max, &
647 trim(message), units=coordinateunits(coord_mode))
648 call set_regrid_max_depths(cs, z_max, gv%m_to_H)
650 call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
651 "Unrecognized MAXIMUM_INT_DEPTH_CONFIG "//trim(string))
658 call get_param(param_file, mdl,
"MAX_LAYER_THICKNESS_CONFIG", string, &
659 "Determines how to specify the maximum layer thicknesses.\n"//&
660 "Valid options are:\n"//&
661 " NONE - there are no maximum layer thicknesses\n"//&
662 " PARAM - use the vector-parameter MAX_LAYER_THICKNESS\n"//&
663 " FILE:string - read from a file. The string specifies\n"//&
664 " the filename and variable name, separated\n"//&
665 " by a comma or space, e.g. FILE:lev.nc,Z\n"//&
666 " FNC1:string - FNC1:dz_min,H_total,power,precision",&
668 message =
"The list of maximum thickness for each layer."
670 if ( trim(string) ==
"NONE")
then
672 elseif ( trim(string) ==
"PARAM")
then
673 call get_param(param_file, mdl,
"MAX_LAYER_THICKNESS", h_max, &
674 trim(message), units=
"m", fail_if_missing=.true., scale=gv%m_to_H)
675 call set_regrid_max_thickness(cs, h_max)
676 elseif (index(trim(string),
'FILE:')==1)
then
677 if (string(6:6)==
'.' .or. string(6:6)==
'/')
then
679 filename = trim( extractword(trim(string(6:80)), 1) )
682 filename = trim(inputdir) // trim( extractword(trim(string(6:80)), 1) )
684 if (.not. file_exists(filename))
call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
685 "Specified file not found: Looking for '"//trim(filename)//
"' ("//trim(string)//
")")
687 varname = trim( extractword(trim(string(6:)), 2) )
688 if (.not. field_exists(filename,varname))
call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
689 "Specified field not found: Looking for '"//trim(varname)//
"' ("//trim(string)//
")")
690 if (len_trim(varname)==0)
then
691 if (field_exists(filename,
'h_max')) then; varname =
'h_max'
692 elseif (field_exists(filename,
'dz_max')) then; varname =
'dz_max'
693 else ;
call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
694 "MAXIMUM_INT_DEPTHS variable not specified and none could be guessed.")
697 call mom_read_data(trim(filename), trim(varname), h_max)
698 call log_param(param_file, mdl,
"!MAX_LAYER_THICKNESS", h_max, &
699 trim(message), units=coordinateunits(coord_mode))
700 call set_regrid_max_thickness(cs, h_max, gv%m_to_H)
701 elseif (index(trim(string),
'FNC1:')==1)
then
702 call dz_function1( trim(string(6:)), h_max )
703 call log_param(param_file, mdl,
"!MAX_LAYER_THICKNESS", h_max, &
704 trim(message), units=coordinateunits(coord_mode))
705 call set_regrid_max_thickness(cs, h_max, gv%m_to_H)
707 call mom_error(fatal,trim(mdl)//
", initialize_regridding: "// &
708 "Unrecognized MAX_LAYER_THICKNESS_CONFIG "//trim(string))
713 if (
allocated(dz))
deallocate(dz)