39 implicit none ;
private 41 #include <MOM_memory.h> 47 character(len=40) ::
mdl =
"ISOMIP_initialization" 65 real,
dimension(G%isd:G%ied,G%jsd:G%jed), &
68 real,
intent(in) :: max_depth
89 #include "version_variable.h" 90 character(len=40) :: mdl =
"ISOMIP_initialize_topography" 91 integer :: i, j, is, ie, js, je, isd, ied, jsd, jed
92 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
93 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
96 call mom_mesg(
" ISOMIP_initialization.F90, ISOMIP_initialize_topography: setting topography", 5)
99 call get_param(param_file, mdl,
"MINIMUM_DEPTH", min_depth, &
100 "The minimum depth of the ocean.", units=
"m", default=0.0)
101 call get_param(param_file, mdl,
"ISOMIP_2D",is_2d,
'If true, use a 2D setup.', default=.false.)
104 bmax=720.0; b0=-150.0; b2=-728.8; b4=343.91; b6=-50.57
105 xbar=300.0e3; dc=500.0; fc=4.0e3; wc=24.0e3; ly=80.0e3
106 bx = 0.0; by = 0.0; xtil = 0.0
110 do j=js,je ;
do i=is,ie
112 xtil = g%geoLonT(i,j)*1.0e3/xbar
114 bx = b0+b2*xtil**2 + b4*xtil**4 + b6*xtil**6
119 by = (dc/(1.+exp(-2.*(40.0*1.0e3- ly/2. - wc)/fc))) + &
120 (dc/(1.+exp(2.*(40.0*1.0e3- ly/2. + wc)/fc)))
122 d(i,j) = -max(bx+by,-bmax)
123 if (d(i,j) > max_depth) d(i,j) = max_depth
124 if (d(i,j) < min_depth) d(i,j) = 0.5*min_depth
128 do j=js,je ;
do i=is,ie
138 xtil = g%geoLonT(i,j)*1.0e3/xbar
140 bx = b0+b2*xtil**2 + b4*xtil**4 + b6*xtil**6
141 by = (dc/(1.+exp(-2.*(g%geoLatT(i,j)*1.0e3- ly/2. - wc)/fc))) + &
142 (dc/(1.+exp(2.*(g%geoLatT(i,j)*1.0e3- ly/2. + wc)/fc)))
144 d(i,j) = -max(bx+by,-bmax)
145 if (d(i,j) > max_depth) d(i,j) = max_depth
146 if (d(i,j) < min_depth) d(i,j) = 0.5*min_depth
157 real,
dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
164 logical,
optional,
intent(in) :: just_read_params
168 real :: e0(szk_(g)+1)
170 real :: eta1D(szk_(g)+1)
172 integer :: i, j, k, is, ie, js, je, nz, tmp1
174 real :: delta_h, rho_range
175 real :: min_thickness, s_sur, s_bot, t_sur, t_bot, rho_sur, rho_bot
177 character(len=40) :: verticalCoordinate
179 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
181 just_read = .false. ;
if (
present(just_read_params)) just_read = just_read_params
183 if (.not.just_read) &
184 call mom_mesg(
"MOM_initialization.F90, initialize_thickness_uniform: setting thickness")
186 call get_param(param_file,
mdl,
"MIN_THICKNESS",min_thickness, &
187 'Minimum layer thickness', units=
'm', default=1.e-3, do_not_log=just_read)
188 call get_param(param_file,
mdl,
"REGRIDDING_COORDINATE_MODE", verticalcoordinate, &
189 default=default_coordinate_mode, do_not_log=just_read)
191 select case ( coordinatemode(verticalcoordinate) )
193 case ( regridding_layer, regridding_rho )
195 'Temperature at the surface (interface)', default=-1.9, do_not_log=just_read)
196 call get_param(param_file,
mdl,
"ISOMIP_S_SUR", s_sur, &
197 'Salinity at the surface (interface)', default=33.8, do_not_log=just_read)
198 call get_param(param_file,
mdl,
"ISOMIP_T_BOT", t_bot, &
199 'Temperature at the bottom (interface)', default=-1.9, do_not_log=just_read)
201 'Salinity at the bottom (interface)', default=34.55, do_not_log=just_read)
203 if (just_read)
return 210 rho_range = rho_bot - rho_sur
216 e0(k) = -g%max_depth * ( 0.5 * ( gv%Rlay(k-1) + gv%Rlay(k) ) - rho_sur ) / rho_range
217 e0(k) = min( 0., e0(k) )
218 e0(k) = max( -g%max_depth, e0(k) )
222 e0(nz+1) = -g%max_depth
225 do j=js,je ;
do i=is,ie
226 eta1d(nz+1) = -1.0*g%bathyT(i,j)
229 if (eta1d(k) < (eta1d(k+1) + gv%Angstrom_z))
then 230 eta1d(k) = eta1d(k+1) + gv%Angstrom_z
231 h(i,j,k) = gv%Angstrom_z
233 h(i,j,k) = eta1d(k) - eta1d(k+1)
239 if (just_read)
return 240 do j=js,je ;
do i=is,ie
241 eta1d(nz+1) = -1.0*g%bathyT(i,j)
243 eta1d(k) = -g%max_depth *
real(k-1) /
real(nz)
244 if (eta1d(k) < (eta1d(k+1) + min_thickness))
then 245 eta1d(k) = eta1d(k+1) + min_thickness
246 h(i,j,k) = min_thickness
248 h(i,j,k) = eta1d(k) - eta1d(k+1)
253 case ( regridding_sigma )
254 if (just_read)
return 255 do j=js,je ;
do i=is,ie
256 delta_h = g%bathyT(i,j) / dfloat(nz)
261 call mom_error(fatal,
"isomip_initialize: "// &
262 "Unrecognized i.c. setup - set REGRIDDING_COORDINATE_MODE")
270 eqn_of_state, just_read_params)
273 real,
dimension(SZI_(G),SZJ_(G), SZK_(G)),
intent(out) :: T
274 real,
dimension(SZI_(G),SZJ_(G), SZK_(G)),
intent(out) :: S
275 real,
dimension(SZI_(G),SZJ_(G), SZK_(G)),
intent(in) :: h
277 type(
eos_type),
pointer :: eqn_of_state
278 logical,
optional,
intent(in) :: just_read_params
282 integer :: i, j, k, is, ie, js, je, nz, itt
283 real :: x, ds, dt, rho_sur, rho_bot
284 real :: xi0, xi1, dxi, r, S_sur, T_sur, S_bot, T_bot, S_range, T_range
286 character(len=40) :: verticalCoordinate, density_profile
290 real :: T0(szk_(g)), S0(szk_(g))
291 real :: drho_dT(szk_(g))
292 real :: drho_dS(szk_(g))
293 real :: rho_guess(szk_(g))
294 real :: pres(szk_(g))
295 real :: drho_dT1, drho_dS1, T_Ref, S_Ref
296 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
299 just_read = .false. ;
if (
present(just_read_params)) just_read = just_read_params
301 call get_param(param_file,
mdl,
"REGRIDDING_COORDINATE_MODE", verticalcoordinate, &
302 default=default_coordinate_mode, do_not_log=just_read)
304 'Temperature at the surface (interface)', default=-1.9, do_not_log=just_read)
305 call get_param(param_file,
mdl,
"ISOMIP_S_SUR", s_sur, &
306 'Salinity at the surface (interface)', default=33.8, do_not_log=just_read)
307 call get_param(param_file,
mdl,
"ISOMIP_T_BOT", t_bot, &
308 'Temperature at the bottom (interface)', default=-1.9, do_not_log=just_read)
309 call get_param(param_file,
mdl,
"ISOMIP_S_BOT", s_bot, &
310 'Salinity at the bottom (interface)', default=34.55, do_not_log=just_read)
317 select case ( coordinatemode(verticalcoordinate) )
320 if (just_read)
return 322 s_range = s_sur - s_bot
323 t_range = t_sur - t_bot
326 s_range = s_range / g%max_depth
327 t_range = t_range / g%max_depth
328 do j=js,je ;
do i=is,ie
329 xi0 = -g%bathyT(i,j);
331 xi0 = xi0 + 0.5 * h(i,j,k)
332 s(i,j,k) = s_sur + s_range * xi0
333 t(i,j,k) = t_sur + t_range * xi0
334 xi0 = xi0 + 0.5 * h(i,j,k)
338 case ( regridding_layer )
339 call get_param(param_file,
mdl,
"FIT_SALINITY", fit_salin, &
340 "If true, accept the prescribed temperature and fit the \n"//&
341 "salinity; otherwise take salinity and fit temperature.", &
342 default=.false., do_not_log=just_read)
344 "Partial derivative of density with salinity.", &
345 units=
"kg m-3 PSU-1", fail_if_missing=.not.just_read, do_not_log=just_read)
347 "Partial derivative of density with temperature.", &
348 units=
"kg m-3 K-1", fail_if_missing=.not.just_read, do_not_log=just_read)
350 "A reference temperature used in initialization.", &
351 units=
"degC", fail_if_missing=.not.just_read, do_not_log=just_read)
353 "A reference salinity used in initialization.", units=
"PSU", &
354 default=35.0, do_not_log=just_read)
355 if (just_read)
return 359 s_range = s_bot - s_sur
360 t_range = t_bot - t_sur
362 s_range = s_range / g%max_depth
363 t_range = t_range / g%max_depth
365 do j=js,je ;
do i=is,ie
369 xi1 = xi0 + 0.5 * h(i,j,k);
370 s0(k) = s_sur + s_range * xi1;
371 t0(k) = t_sur + t_range * xi1;
372 xi0 = xi0 + h(i,j,k);
383 s0(k) = max(0.0, s0(1) + (gv%Rlay(k) - rho_guess(1)) / drho_ds1)
390 s0(k) = max(0.0, s0(k) + (gv%Rlay(k) - rho_guess(k)) / drho_ds1)
397 t0(k) = t0(1) + (gv%Rlay(k) - rho_guess(1)) / drho_dt1
404 t0(k) = t0(k) + (gv%Rlay(k) - rho_guess(k)) / drho_dt(k)
410 t(i,j,k) = t0(k) ; s(i,j,k) = s0(k)
416 call mom_error(fatal,
"isomip_initialize: "// &
417 "Unrecognized i.c. setup - set REGRIDDING_COORDINATE_MODE")
444 logical,
intent(in) :: use_ALE
449 real :: T(szi_(g),szj_(g),szk_(g))
450 real :: S(szi_(g),szj_(g),szk_(g))
451 real :: RHO(szi_(g),szj_(g),szk_(g))
452 real :: h(szi_(g),szj_(g),szk_(g))
453 real :: Idamp(szi_(g),szj_(g))
455 real :: S_sur, T_sur;
456 real :: S_bot, T_bot;
458 real :: rho_sur, rho_bot, rho_range, t_range, s_range
460 real :: e0(szk_(g)+1)
462 real :: eta1D(szk_(g)+1)
463 real :: eta(szi_(g),szj_(g),szk_(g)+1)
466 real :: min_depth, dummy1, z, delta_h
467 real :: damp, rho_dummy, min_thickness, rho_tmp, xi0
468 character(len=40) :: verticalCoordinate, filename, state_file
469 character(len=40) :: temp_var, salt_var, eta_var, inputdir
471 character(len=40) :: mdl =
"ISOMIP_initialize_sponges" 472 integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
474 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
475 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
477 call get_param(pf, mdl,
"MIN_THICKNESS",min_thickness,
'Minimum layer thickness',units=
'm',default=1.e-3)
479 call get_param(pf, mdl,
"REGRIDDING_COORDINATE_MODE", verticalcoordinate, &
480 default=default_coordinate_mode)
482 call get_param(pf, mdl,
"ISOMIP_TNUDG", tnudg,
'Nudging time scale for sponge layers (days)', default=0.0)
484 call get_param(pf, mdl,
"T_REF", t_ref,
'Reference temperature', default=10.0,&
487 call get_param(pf, mdl,
"S_REF", s_ref,
'Reference salinity', default=35.0,&
490 call get_param(pf, mdl,
"ISOMIP_S_SUR_SPONGE", s_sur,
'Surface salinity in sponge layer.', default=s_ref)
492 call get_param(pf, mdl,
"ISOMIP_S_BOT_SPONGE", s_bot,
'Bottom salinity in sponge layer.', default=s_ref)
494 call get_param(pf, mdl,
"ISOMIP_T_SUR_SPONGE", t_sur,
'Surface temperature in sponge layer.', default=t_ref)
496 call get_param(pf, mdl,
"ISOMIP_T_BOT_SPONGE", t_bot,
'Bottom temperature in sponge layer.', default=t_ref)
498 t(:,:,:) = 0.0 ; s(:,:,:) = 0.0 ; idamp(:,:) = 0.0; rho(:,:,:) = 0.0
499 s_range = s_sur - s_bot
500 t_range = t_sur - t_bot
503 call get_param(pf, mdl,
"MINIMUM_DEPTH", min_depth, &
504 "The minimum depth of the ocean.", units=
"m", default=0.0)
506 if (
associated(csp))
call mom_error(fatal, &
507 "ISOMIP_initialize_sponges called with an associated control structure.")
508 if (
associated(acsp))
call mom_error(fatal, &
509 "ISOMIP_initialize_sponges called with an associated ALE-sponge control structure.")
516 do i=is,ie;
do j=js,je
517 if (g%geoLonT(i,j) >= 790.0 .AND. g%geoLonT(i,j) <= 800.0)
then 520 dummy1=(g%geoLonT(i,j)-790.0)/(800.0-790.0)
521 damp = 1.0/tnudg * max(0.0,dummy1)
527 if (g%bathyT(i,j) > min_depth)
then 528 idamp(i,j) = damp/86400.0
529 else ; idamp(i,j) = 0.0 ;
endif 539 rho_range = rho_bot - rho_sur
544 select case ( coordinatemode(verticalcoordinate) )
546 case ( regridding_rho )
550 e0(k) = -g%max_depth * ( 0.5 * ( gv%Rlay(k-1) + gv%Rlay(k) ) - rho_sur ) / rho_range
551 e0(k) = min( 0., e0(k) )
552 e0(k) = max( -g%max_depth, e0(k) )
556 e0(nz+1) = -g%max_depth
559 do j=js,je ;
do i=is,ie
560 eta1d(nz+1) = -1.0*g%bathyT(i,j)
563 if (eta1d(k) < (eta1d(k+1) + gv%Angstrom_z))
then 564 eta1d(k) = eta1d(k+1) + gv%Angstrom_z
565 h(i,j,k) = gv%Angstrom_z
567 h(i,j,k) = eta1d(k) - eta1d(k+1)
573 do j=js,je ;
do i=is,ie
574 eta1d(nz+1) = -1.0*g%bathyT(i,j)
576 eta1d(k) = -g%max_depth *
real(k-1) /
real(nz)
577 if (eta1d(k) < (eta1d(k+1) + min_thickness))
then 578 eta1d(k) = eta1d(k+1) + min_thickness
579 h(i,j,k) = min_thickness
581 h(i,j,k) = eta1d(k) - eta1d(k+1)
586 case ( regridding_sigma )
587 do j=js,je ;
do i=is,ie
588 delta_h = g%bathyT(i,j) / dfloat(nz)
593 call mom_error(fatal,
"ISOMIP_initialize_sponges: "// &
594 "Unrecognized i.c. setup - set REGRIDDING_COORDINATE_MODE")
601 s_range = s_range / g%max_depth
602 t_range = t_range / g%max_depth
603 do j=js,je ;
do i=is,ie
604 xi0 = -g%bathyT(i,j);
606 xi0 = xi0 + 0.5 * h(i,j,k)
607 s(i,j,k) = s_sur + s_range * xi0
608 t(i,j,k) = t_sur + t_range * xi0
609 xi0 = xi0 + 0.5 * h(i,j,k)
624 if (
associated(tv%T) )
then 627 if (
associated(tv%S) )
then 633 call get_param(pf, mdl,
"INPUTDIR", inputdir, default=
".")
634 inputdir = slasher(inputdir)
640 call get_param(pf, mdl,
"ISOMIP_SPONGE_FILE", state_file, &
641 "The name of the file with temps., salts. and interfaces to \n"// &
642 " damp toward.", fail_if_missing=.true.)
643 call get_param(pf, mdl,
"SPONGE_PTEMP_VAR", temp_var, &
644 "The name of the potential temperature variable in \n"//&
645 "SPONGE_STATE_FILE.", default=
"Temp")
646 call get_param(pf, mdl,
"SPONGE_SALT_VAR", salt_var, &
647 "The name of the salinity variable in \n"//&
648 "SPONGE_STATE_FILE.", default=
"Salt")
649 call get_param(pf, mdl,
"SPONGE_ETA_VAR", eta_var, &
650 "The name of the interface height variable in \n"//&
651 "SPONGE_STATE_FILE.", default=
"eta")
654 filename = trim(inputdir)//trim(state_file)
656 call mom_error(fatal,
" ISOMIP_initialize_sponges: Unable to open "//trim(filename))
657 call read_data(filename,eta_var,eta(:,:,:), domain=g%Domain%mpp_domain)
658 call read_data(filename,temp_var,t(:,:,:), domain=g%Domain%mpp_domain)
659 call read_data(filename,salt_var,s(:,:,:), domain=g%Domain%mpp_domain)
integer, parameter regridding_layer
Layer mode.
subroutine, public read_axis_data(filename, axis_name, var)
integer function coordinatemode(string)
Parse a string parameter specifying the coordinate mode and return the appropriate enumerated integer...
integer, parameter regridding_sigma
Sigma coordinates.
subroutine, public isomip_initialize_temperature_salinity(T, S, h, G, GV, param_file, eqn_of_state, just_read_params)
Initial values for temperature and salinity.
subroutine, public isomip_initialize_thickness(h, G, GV, param_file, tv, just_read_params)
Initialization of thicknesses.
Ocean grid type. See mom_grid for details.
Calculates density of sea water from T, S and P.
Provides the ocean grid type.
character(len= *), parameter default_coordinate_mode
Default coordinate mode.
The module configures the ISOMIP test case.
This module contains I/O framework code.
subroutine, public set_up_ale_sponge_field(sp_val, G, f_ptr, CS)
This subroutine stores the reference profile at h points for the variable.
This module contains the routines used to apply sponge layers when using the ALE mode. Applying sponges requires the following: (1) initialize_ALE_sponge (2) set_up_ALE_sponge_field (tracers) and set_up_ALE_sponge_vel_field (vel) (3) apply_ALE_sponge (4) init_ALE_sponge_diags (not being used for now) (5) ALE_sponge_end (not being used for now)
SPONGE control structure.
subroutine, public calculate_density_derivs(T, S, pressure, drho_dT, drho_dS, start, npts, EOS)
Calls the appropriate subroutine to calculate density derivatives for 1-D array inputs.
subroutine, public initialize_sponge(Iresttime, int_height, G, param_file, CS, Iresttime_i_mean, int_height_i_mean)
subroutine, public set_up_sponge_field(sp_val, f_ptr, G, nlay, CS, sp_val_i_mean)
logical function, public is_root_pe()
subroutine, public initialize_ale_sponge(Iresttime, data_h, nz_data, G, param_file, CS)
This subroutine determines the number of points which are within.
subroutine, public mom_mesg(message, verb, all_print)
Provides subroutines for quantities specific to the equation of state.
Type for describing a variable, typically a tracer.
subroutine, public isomip_initialize_topography(D, G, param_file, max_depth)
Initialization of topography.
integer, parameter regridding_zstar
z* coordinates
subroutine, public isomip_initialize_sponges(G, GV, tv, PF, use_ALE, CSp, ACSp)
Sets up the the inverse restoration time (Idamp), and.
The thermo_var_ptrs structure contains pointers to an assortment of thermodynamic fields that may be ...
integer, parameter regridding_sigma_shelf_zstar
z* coordinates at the bottom, sigma-near the top lightest water, isopycnal below
Contains constants for interpreting input parameters that control regridding.
subroutine, public mom_error(level, message, all_print)
integer, parameter regridding_rho
Target interface densities.
A control structure for the equation of state.