20 implicit none ;
private 22 #include <MOM_memory.h> 30 character(len=40) ::
mdl =
"DOME2D_initialization" 38 real,
dimension(G%isd:G%ied,G%jsd:G%jed), &
41 real,
intent(in) :: max_depth
44 real :: x, bay_depth, l1, l2
45 real :: dome2d_width_bay, dome2d_width_bottom, dome2d_depth_bay
47 #include "version_variable.h" 50 call get_param(param_file,
mdl,
"DOME2D_SHELF_WIDTH", dome2d_width_bay, &
51 'Width of shelf, as fraction of domain, in 2d DOME configuration.', &
52 units=
'nondim',default=0.1)
53 call get_param(param_file,
mdl,
"DOME2D_BASIN_WIDTH", dome2d_width_bottom, &
54 'Width of deep ocean basin, as fraction of domain, in 2d DOME configuration.', &
55 units=
'nondim',default=0.3)
56 call get_param(param_file,
mdl,
"DOME2D_SHELF_DEPTH", dome2d_depth_bay, &
57 'Depth of shelf, as fraction of basin depth, in 2d DOME configuration.', &
58 units=
'nondim',default=0.2)
64 l2 = 1.0 - dome2d_width_bottom
66 bay_depth = dome2d_depth_bay
72 x = ( g%geoLonT(i,j) - g%west_lon ) / g%len_lon;
75 d(i,j) = bay_depth * max_depth
76 else if (( x .gt. l1 ) .and. ( x .lt. l2 ))
then 77 d(i,j) = bay_depth * max_depth + (1.0-bay_depth) * max_depth * &
78 ( x - l1 ) / (l2 - l1)
91 real,
dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
95 logical,
optional,
intent(in) :: just_read_params
101 real :: eta1D(szk_(gv)+1)
103 integer :: i, j, k, is, ie, js, je, nz
106 real :: min_thickness
107 real :: dome2d_width_bay, dome2d_width_bottom, dome2d_depth_bay
109 character(len=40) :: verticalCoordinate
111 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
113 just_read = .false. ;
if (
present(just_read_params)) just_read = just_read_params
115 if (.not.just_read) &
116 call mom_mesg(
"MOM_initialization.F90, DOME2d_initialize_thickness: setting thickness")
118 call get_param(param_file,
mdl,
"MIN_THICKNESS",min_thickness, &
119 default=1.e-3, do_not_log=.true.)
120 call get_param(param_file,
mdl,
"REGRIDDING_COORDINATE_MODE", verticalcoordinate, &
121 default=default_coordinate_mode, do_not_log=.true.)
122 call get_param(param_file,
mdl,
"DOME2D_SHELF_WIDTH", dome2d_width_bay, &
123 default=0.1, do_not_log=.true.)
124 call get_param(param_file,
mdl,
"DOME2D_BASIN_WIDTH", dome2d_width_bottom, &
125 default=0.3, do_not_log=.true.)
126 call get_param(param_file,
mdl,
"DOME2D_SHELF_DEPTH", dome2d_depth_bay, &
127 default=0.2, do_not_log=.true.)
129 if (just_read)
return 139 e0(k) = -g%max_depth *
real(k-1) /
real(nz)
142 select case ( coordinatemode(verticalcoordinate) )
146 do j=js,je ;
do i=is,ie
147 eta1d(nz+1) = -1.0*g%bathyT(i,j)
150 if (eta1d(k) < (eta1d(k+1) + gv%Angstrom_z))
then 151 eta1d(k) = eta1d(k+1) + gv%Angstrom_z
152 h(i,j,k) = gv%Angstrom_z
154 h(i,j,k) = eta1d(k) - eta1d(k+1)
158 x = ( g%geoLonT(i,j) - g%west_lon ) / g%len_lon;
159 if ( x .le. dome2d_width_bay )
then 160 h(i,j,1:nz-1) = gv%Angstrom;
161 h(i,j,nz) = dome2d_depth_bay * g%max_depth - (nz-1) * gv%Angstrom;
188 case ( regridding_zstar )
190 do j=js,je ;
do i=is,ie
191 eta1d(nz+1) = -1.0*g%bathyT(i,j)
194 if (eta1d(k) < (eta1d(k+1) + min_thickness))
then 195 eta1d(k) = eta1d(k+1) + min_thickness
196 h(i,j,k) = min_thickness
198 h(i,j,k) = eta1d(k) - eta1d(k+1)
204 do j=js,je ;
do i=is,ie
205 delta_h = g%bathyT(i,j) / nz;
210 call mom_error(fatal,
"dome2d_initialize: "// &
211 "Unrecognized i.c. setup - set REGRIDDING_COORDINATE_MODE")
220 eqn_of_state, just_read_params)
222 real,
dimension(SZI_(G),SZJ_(G), SZK_(G)),
intent(out) :: T
223 real,
dimension(SZI_(G),SZJ_(G), SZK_(G)),
intent(out) :: S
224 real,
dimension(SZI_(G),SZJ_(G), SZK_(G)),
intent(in) :: h
226 type(
eos_type),
pointer :: eqn_of_state
227 logical,
optional,
intent(in) :: just_read_params
231 integer :: i, j, k, is, ie, js, je, nz
233 integer :: index_bay_z;
234 real :: delta_S, delta_T;
235 real :: S_ref, T_ref;
236 real :: S_range, T_range;
239 character(len=40) :: verticalCoordinate
240 real :: dome2d_width_bay, dome2d_width_bottom, dome2d_depth_bay
242 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
244 just_read = .false. ;
if (
present(just_read_params)) just_read = just_read_params
246 call get_param(param_file,
mdl,
"REGRIDDING_COORDINATE_MODE", verticalcoordinate, &
247 default=default_coordinate_mode, do_not_log=.true.)
248 call get_param(param_file,
mdl,
"DOME2D_SHELF_WIDTH", dome2d_width_bay, &
249 default=0.1, do_not_log=.true.)
250 call get_param(param_file,
mdl,
"DOME2D_BASIN_WIDTH", dome2d_width_bottom, &
251 default=0.3, do_not_log=.true.)
252 call get_param(param_file,
mdl,
"DOME2D_SHELF_DEPTH", dome2d_depth_bay, &
253 default=0.2, do_not_log=.true.)
254 call get_param(param_file,
mdl,
"S_REF",s_ref,
'Reference salinity',units=
'1e-3', &
255 fail_if_missing=.not.just_read, do_not_log=just_read)
256 call get_param(param_file,
mdl,
"T_REF",t_ref,
'Refernce temperature',units=
'C', &
257 fail_if_missing=.not.just_read, do_not_log=just_read)
258 call get_param(param_file,
mdl,
"S_RANGE",s_range,
'Initial salinity range', &
259 units=
'1e-3', default=2.0, do_not_log=just_read)
260 call get_param(param_file,
mdl,
"T_RANGE",t_range,
'Initial temperature range', &
261 units=
'1e-3', default=0.0, do_not_log=just_read)
263 if (just_read)
return 270 select case ( coordinatemode(verticalcoordinate) )
274 do j=js,je ;
do i=is,ie
277 xi1 = xi0 + h(i,j,k) / g%max_depth;
278 s(i,j,k) = 34.0 + 0.5 * s_range * (xi0 + xi1);
285 do j=js,je ;
do i=is,ie
288 xi1 = xi0 + h(i,j,k) / g%max_depth;
289 s(i,j,k) = 34.0 + 0.5 * s_range * (xi0 + xi1);
292 x = ( g%geoLonT(i,j) - g%west_lon ) / g%len_lon;
293 if ( x .le. dome2d_width_bay )
then 294 s(i,j,nz) = 34.0 + s_range;
298 case ( regridding_layer )
300 delta_s = s_range / ( g%ke - 1.0 );
303 s(:,:,k) = s(:,:,k-1) + delta_s;
307 call mom_error(fatal,
"dome2d_initialize: "// &
308 "Unrecognized i.c. setup - set REGRIDDING_COORDINATE_MODE")
313 if ( coordinatemode(verticalcoordinate) .eq. regridding_zstar )
then 314 index_bay_z = nint( dome2d_depth_bay * g%ke );
315 do j = g%jsc,g%jec ;
do i = g%isc,g%iec
316 x = ( g%geoLonT(i,j) - g%west_lon ) / g%len_lon;
317 if ( x .le. dome2d_width_bay )
then 318 s(i,j,1:index_bay_z) = s_ref + s_range;
319 t(i,j,1:index_bay_z) = 1.0;
326 do i = g%isc,g%iec ;
do j = g%jsc,g%jec
327 x = ( g%geoLonT(i,j) - g%west_lon ) / g%len_lon;
328 if ( x .le. dome2d_width_bay )
then 329 s(i,j,1:g%ke) = s_ref + s_range;
336 t(g%isc:g%iec,g%jsc:g%jec,1:g%ke) = 0.0;
337 if (( coordinatemode(verticalcoordinate) .eq.
regridding_rho ) .or. ( coordinatemode(verticalcoordinate) .eq. regridding_layer ))
then 338 do i = g%isc,g%iec ;
do j = g%jsc,g%jec
339 x = ( g%geoLonT(i,j) - g%west_lon ) / g%len_lon;
340 if ( x .le. dome2d_width_bay )
then 354 logical,
intent(in) :: use_ALE
358 real :: T(szi_(g),szj_(g),szk_(g))
359 real :: S(szi_(g),szj_(g),szk_(g))
360 real :: RHO(szi_(g),szj_(g),szk_(g))
361 real :: h(szi_(g),szj_(g),szk_(g))
362 real :: eta(szi_(g),szj_(g),szk_(g)+1)
363 real :: Idamp(szi_(g),szj_(g))
365 real :: S_range, T_range
366 real :: e0(szk_(g)+1)
368 real :: eta1D(szk_(g)+1)
370 real :: dome2d_width_bay, dome2d_width_bottom, dome2d_depth_bay
371 real :: dome2d_west_sponge_time_scale, dome2d_east_sponge_time_scale
372 real :: dome2d_west_sponge_width, dome2d_east_sponge_width
374 integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
376 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
377 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
379 call get_param(param_file,
mdl,
"DOME2D_WEST_SPONGE_TIME_SCALE", dome2d_west_sponge_time_scale, &
380 'The time-scale on the west edge of the domain for restoring T/S\n' //&
381 'in the sponge. If zero, the western sponge is disabled', &
382 units=
's', default=0.)
383 call get_param(param_file,
mdl,
"DOME2D_EAST_SPONGE_TIME_SCALE", dome2d_east_sponge_time_scale, &
384 'The time-scale on the east edge of the domain for restoring T/S\n' //&
385 'in the sponge. If zero, the eastern sponge is disabled', &
386 units=
's', default=0.)
387 call get_param(param_file,
mdl,
"DOME2D_WEST_SPONGE_WIDTH", dome2d_west_sponge_width, &
388 'The fraction of the domain in which the western sponge for restoring T/S\n' //&
390 units=
'nondim', default=0.1)
391 call get_param(param_file,
mdl,
"DOME2D_EAST_SPONGE_WIDTH", dome2d_east_sponge_width, &
392 'The fraction of the domain in which the eastern sponge for restoring T/S\n' //&
394 units=
'nondim', default=0.1)
397 if (dome2d_west_sponge_time_scale <= 0. .and. dome2d_east_sponge_time_scale <= 0.)
return 399 if (
associated(csp))
call mom_error(fatal, &
400 "DOME2d_initialize_sponges called with an associated control structure.")
401 if (
associated(acsp))
call mom_error(fatal, &
402 "DOME2d_initialize_sponges called with an associated ALE-sponge control structure.")
404 call get_param(param_file,
mdl,
"DOME2D_SHELF_WIDTH", dome2d_width_bay, &
405 default=0.1, do_not_log=.true.)
406 call get_param(param_file,
mdl,
"DOME2D_BASIN_WIDTH", dome2d_width_bottom, &
407 default=0.3, do_not_log=.true.)
408 call get_param(param_file,
mdl,
"DOME2D_SHELF_DEPTH", dome2d_depth_bay, &
409 default=0.2, do_not_log=.true.)
412 call get_param(param_file,
mdl,
"S_RANGE",s_range,default=2.0)
413 call get_param(param_file,
mdl,
"T_RANGE",t_range,default=0.0)
418 do j=js,je ;
do i=is,ie
419 if (g%mask2dT(i,j) > 0.)
then 420 x = ( g%geoLonT(i,j) - g%west_lon ) / g%len_lon
421 if ( dome2d_west_sponge_time_scale > 0. .and. x < dome2d_west_sponge_width )
then 423 dummy1 = 1. - x / dome2d_west_sponge_width
424 idamp(i,j) = 1./dome2d_west_sponge_time_scale * max(0., min(1., dummy1))
425 elseif ( dome2d_east_sponge_time_scale > 0. .and. x > ( 1. - dome2d_east_sponge_width ) )
then 427 dummy1 = 1. - ( 1. - x ) / dome2d_east_sponge_width
428 idamp(i,j) = 1./dome2d_east_sponge_time_scale * max(0., min(1., dummy1))
442 e0(k) = -g%max_depth * (
real(k-1) /
real(nz) )
444 e0(nz+1) = -g%max_depth
445 do j=js,je ;
do i=is,ie
446 eta1d(nz+1) = -1.0*g%bathyT(i,j)
449 if (eta1d(k) < (eta1d(k+1) + gv%Angstrom_z))
then 450 eta1d(k) = eta1d(k+1) + gv%Angstrom_z
451 h(i,j,k) = gv%Angstrom_z
453 h(i,j,k) = eta1d(k) - eta1d(k+1)
461 t(:,:,:) = 0.0 ; s(:,:,:) = 0.0
462 do j=js,je ;
do i=is,ie
465 z = z + 0.5 * h(i,j,k)
466 s(i,j,k) = 34.0 - 1.0 * (z/g%max_depth)
467 if ( ( g%geoLonT(i,j) - g%west_lon ) / g%len_lon < dome2d_west_sponge_width ) s(i,j,k) = s_ref + s_range
468 z = z + 0.5 * h(i,j,k)
472 if (
associated(tv%T) )
then 475 if (
associated(tv%S) )
then 482 do j=js,je ;
do i=is,ie
483 eta1d(nz+1) = -1.0*g%bathyT(i,j)
485 eta1d(k) = -g%max_depth *
real(k-1) /
real(nz)
486 if (eta1d(k) < (eta1d(k+1) + gv%Angstrom_z))
then 487 eta1d(k) = eta1d(k+1) + gv%Angstrom_z
488 h(i,j,k) = gv%Angstrom_z
490 h(i,j,k) = eta1d(k) - eta1d(k+1)
494 x = ( g%geoLonT(i,j) - g%west_lon ) / g%len_lon;
495 if ( x .le. dome2d_width_bay )
then 496 h(i,j,1:nz-1) = gv%Angstrom;
497 h(i,j,nz) = dome2d_depth_bay * g%max_depth - (nz-1) * gv%Angstrom;
500 eta(i,j,nz+1) = -g%bathyT(i,j)
502 eta(i,j,k) = eta(i,j,k+1) + h(i,j,k)
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.
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=40) mdl
This module's name.
character(len= *), parameter default_coordinate_mode
Default coordinate mode.
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 dome2d_initialize_thickness(h, G, GV, param_file, just_read_params)
Initialize thicknesses according to coordinate mode.
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)
subroutine, public dome2d_initialize_sponges(G, GV, tv, param_file, use_ALE, CSp, ACSp)
Set up sponges in 2d DOME configuration.
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.
integer, parameter regridding_zstar
z* coordinates
The thermo_var_ptrs structure contains pointers to an assortment of thermodynamic fields that may be ...
Contains constants for interpreting input parameters that control regridding.
subroutine, public dome2d_initialize_temperature_salinity(T, S, h, G, param_file, eqn_of_state, just_read_params)
Initialize temperature and salinity in the 2d DOME configuration.
subroutine, public dome2d_initialize_topography(D, G, param_file, max_depth)
Initialize topography with a shelf and slope in a 2D domain.
subroutine, public mom_error(level, message, all_print)
integer, parameter regridding_rho
Target interface densities.
A control structure for the equation of state.