33 implicit none ;
private 35 #include <MOM_memory.h> 47 real,
dimension(G%isd:G%ied,G%jsd:G%jed), &
50 real,
intent(in) :: max_depth
59 #include "version_variable.h" 60 character(len=40) :: mdl =
"benchmark_initialize_topography" 61 integer :: i, j, is, ie, js, je, isd, ied, jsd, jed
62 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
63 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
65 call mom_mesg(
" benchmark_initialization.F90, benchmark_initialize_topography: setting topography", 5)
68 call get_param(param_file, mdl,
"MINIMUM_DEPTH", min_depth, &
69 "The minimum depth of the ocean.", units=
"m", default=0.0)
75 do i=is,ie ;
do j=js,je
76 x=(g%geoLonT(i,j)-g%west_lon)/g%len_lon
77 y=(g%geoLatT(i,j)-g%south_lat)/g%len_lat
79 d(i,j) = -d0 * ( y*(1.0 + 0.6*cos(4.0*pi*x)) &
81 + 0.05*cos(10.0*pi*x) - 0.7 )
82 if (d(i,j) > max_depth) d(i,j) = max_depth
83 if (d(i,j) < min_depth) d(i,j) = 0.
95 P_ref, just_read_params)
98 real,
dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
102 type(
eos_type),
pointer :: eqn_of_state
104 real,
intent(in) :: P_Ref
106 logical,
optional,
intent(in) :: just_read_params
109 real :: e0(szk_(gv)+1)
111 real :: e_pert(szk_(gv)+1)
113 real :: eta1D(szk_(gv)+1)
118 real :: thermocline_scale
119 real,
dimension(SZK_(GV)) :: T0, pres, S0, rho_guess, drho, drho_dT, drho_dS
128 character(len=40) :: mdl =
"benchmark_initialize_thickness" 129 integer :: i, j, k, k1, is, ie, js, je, nz, itt
131 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
133 just_read = .false. ;
if (
present(just_read_params)) just_read = just_read_params
135 if (just_read)
return 137 call mom_mesg(
" benchmark_initialization.F90, benchmark_initialize_thickness: setting thickness", 5)
139 k1 = gv%nk_rho_varies + 1
142 thermocline_scale = 500.0
148 pres(k) = p_ref ; s0(k) = 35.0
156 t0(k) = t0(k1) + (gv%Rlay(k) - rho_guess(k1)) / drho_dt(k1)
164 t0(k) = t0(k) + (gv%Rlay(k) - rho_guess(k)) / drho_dt(k)
169 i_ts = 1.0 / thermocline_scale
170 i_md = 1.0 / g%max_depth
171 do j=js,je ;
do i=is,ie
172 sst = 0.5*(t0(k1)+t0(nz)) - 0.9*0.5*(t0(k1)-t0(nz)) * &
173 cos(pi*(g%geoLatT(i,j)-g%south_lat)/(g%len_lat))
175 do k=1,nz ; e_pert(k) = 0.0 ;
enddo 184 eta1d(nz+1) = -1.0*g%bathyT(i,j)
187 t_int = 0.5*(t0(k) + t0(k-1))
188 t_frac = (t_int - t0(nz)) / (sst - t0(nz))
192 err = a_exp * exp(z*i_ts) + (1.0 - a_exp) * (z*i_md + 1.0) - t_frac
193 derr_dz = a_exp * i_ts * exp(z*i_ts) + (1.0 - a_exp) * i_md
194 z = z - err / derr_dz
199 eta1d(k) = e0(k) + e_pert(k)
201 if (eta1d(k) > -ml_depth) eta1d(k) = -ml_depth
203 if (eta1d(k) < eta1d(k+1) + gv%Angstrom_z) &
204 eta1d(k) = eta1d(k+1) + gv%Angstrom_z
206 h(i,j,k) = max(eta1d(k) - eta1d(k+1), gv%Angstrom_z)
208 h(i,j,1) = max(0.0 - eta1d(2), gv%Angstrom_z)
219 eqn_of_state, P_Ref, just_read_params)
222 real,
dimension(SZI_(G),SZJ_(G), SZK_(G)),
intent(out) :: T
224 real,
dimension(SZI_(G),SZJ_(G), SZK_(G)),
intent(out) :: S
229 type(
eos_type),
pointer :: eqn_of_state
231 real,
intent(in) :: P_Ref
233 logical,
optional,
intent(in) :: just_read_params
236 real :: T0(szk_(g)), S0(szk_(g))
237 real :: pres(szk_(g))
238 real :: drho_dT(szk_(g))
240 real :: drho_dS(szk_(g))
242 real :: rho_guess(szk_(g))
247 character(len=40) :: mdl =
"benchmark_init_temperature_salinity" 248 integer :: i, j, k, k1, is, ie, js, je, nz, itt
250 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
252 just_read = .false. ;
if (
present(just_read_params)) just_read = just_read_params
254 if (just_read)
return 256 k1 = gv%nk_rho_varies + 1
259 pres(k) = p_ref ; s0(k) = 35.0
268 t0(k) = t0(k1) + (gv%Rlay(k) - rho_guess(k1)) / drho_dt(k1)
276 t0(k) = t0(k) + (gv%Rlay(k) - rho_guess(k)) / drho_dt(k)
280 do k=1,nz ;
do i=is,ie ;
do j=js,je
283 enddo ;
enddo ;
enddo 285 do i=is,ie ;
do j=js,je
286 sst = 0.5*(t0(k1)+t0(nz)) - 0.9*0.5*(t0(k1)-t0(nz)) * &
287 cos(pi*(g%geoLatT(i,j)-g%south_lat)/(g%len_lat))
subroutine, public benchmark_init_temperature_salinity(T, S, G, GV, param_file, eqn_of_state, P_Ref, just_read_params)
This function puts the initial layer temperatures and salinities into T(:,:,:) and S(:...
Ocean grid type. See mom_grid for details.
Calculates density of sea water from T, S and P.
Provides the ocean grid type.
subroutine, public benchmark_initialize_topography(D, G, param_file, max_depth)
This subroutine sets up the benchmark test case topography.
This module contains the tracer_registry_type and the subroutines that handle registration of tracers...
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)
Type to carry basic tracer information.
logical function, public is_root_pe()
subroutine, public mom_mesg(message, verb, all_print)
Provides subroutines for quantities specific to the equation of state.
The thermo_var_ptrs structure contains pointers to an assortment of thermodynamic fields that may be ...
subroutine, public benchmark_initialize_thickness(h, G, GV, param_file, eqn_of_state, P_ref, just_read_params)
This subroutine initializes layer thicknesses for the benchmark test case, by finding the depths of i...
subroutine, public mom_error(level, message, all_print)
A control structure for the equation of state.