29 use mom_io, only : write_field, slasher
36 implicit none ;
private 38 #include <MOM_memory.h> 46 #include "version_variable.h" 54 real,
dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
58 logical,
optional,
intent(in) :: just_read_params
61 real :: eta0(szk_(g)+1)
62 real :: eta_im(szj_(g),szk_(g)+1)
63 real :: eta1D(szk_(g)+1)
65 real :: damp_rate, jet_width, jet_height, y_2
66 real :: half_strat, half_depth
68 character(len=40) :: mdl =
"Phillips_initialize_thickness" 69 integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
71 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
72 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
76 just_read = .false. ;
if (
present(just_read_params)) just_read = just_read_params
78 if (.not.just_read)
call log_version(param_file, mdl, version)
79 call get_param(param_file, mdl,
"HALF_STRAT_DEPTH", half_strat, &
80 "The maximum depth of the ocean.", units=
"nondim", &
81 default = 0.5, do_not_log=just_read)
82 call get_param(param_file, mdl,
"JET_WIDTH", jet_width, &
83 "The width of the zonal-mean jet.", units=
"km", &
84 fail_if_missing=.not.just_read, do_not_log=just_read)
85 call get_param(param_file, mdl,
"JET_HEIGHT", jet_height, &
86 "The interface height scale associated with the \n"//&
87 "zonal-mean jet.", units=
"m", &
88 fail_if_missing=.not.just_read, do_not_log=just_read)
92 half_depth = g%max_depth*half_strat
93 eta0(1) = 0.0 ; eta0(nz+1) = -g%max_depth
94 do k=2,1+nz/2 ; eta0(k) = -half_depth*(2.0*(k-1)/
real(nz)) ; enddo
96 eta0(k) = -g%max_depth - 2.0*(g%max_depth-half_depth) * ((k-(nz+1))/
real(nz))
100 eta_im(j,1) = 0.0 ; eta_im(j,nz+1) = -g%max_depth
102 do k=2,nz ;
do j=js,je
103 y_2 = g%geoLatT(is,j) - g%south_lat - 0.5*g%len_lat
104 eta_im(j,k) = eta0(k) + &
105 jet_height * tanh(y_2 / jet_width)
107 if (eta_im(j,k) > 0.0) eta_im(j,k) = 0.0
108 if (eta_im(j,k) < -g%max_depth) eta_im(j,k) = -g%max_depth
111 do j=js,je ;
do i=is,ie
117 eta1d(nz+1) = -1.0*g%bathyT(i,j)
119 eta1d(k) = eta_im(j,k)
120 if (eta1d(k) < (eta1d(k+1) + gv%Angstrom_z))
then 121 eta1d(k) = eta1d(k+1) + gv%Angstrom_z
122 h(i,j,k) = gv%Angstrom_z
124 h(i,j,k) = eta1d(k) - eta1d(k+1)
135 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
137 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
141 logical,
optional,
intent(in) :: just_read_params
144 real :: damp_rate, jet_width, jet_height, x_2, y_2
145 real :: velocity_amplitude, pi
146 integer :: i, j, k, is, ie, js, je, nz, m
148 character(len=40) :: mdl =
"Phillips_initialize_velocity" 149 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
151 just_read = .false. ;
if (
present(just_read_params)) just_read = just_read_params
153 if (.not.just_read)
call log_version(param_file, mdl, version)
154 call get_param(param_file, mdl,
"VELOCITY_IC_PERTURB_AMP", velocity_amplitude, &
155 "The magnitude of the initial velocity perturbation.", &
156 units=
"m s-1", default=0.001, do_not_log=just_read)
157 call get_param(param_file, mdl,
"JET_WIDTH", jet_width, &
158 "The width of the zonal-mean jet.", units=
"km", &
159 fail_if_missing=.not.just_read, do_not_log=just_read)
160 call get_param(param_file, mdl,
"JET_HEIGHT", jet_height, &
161 "The interface height scale associated with the \n"//&
162 "zonal-mean jet.", units=
"m", &
163 fail_if_missing=.not.just_read, do_not_log=just_read)
165 if (just_read)
return 173 do k=nz-1,1 ;
do j=js,je ;
do i=is-1,ie
174 y_2 = g%geoLatCu(i,j) - g%south_lat - 0.5*g%len_lat
180 u(i,j,k) = u(i,j,k+1) + (1e-3 * (jet_height / jet_width) * &
181 (
sech(y_2 / jet_width))**2 ) * &
182 (2.0 * gv%g_prime(k+1) / (g%CoriolisBu(i,j) + g%CoriolisBu(i,j-1)))
183 enddo ;
enddo ;
enddo 185 do k=1,nz ;
do j=js,je ;
do i=is-1,ie
186 y_2 = (g%geoLatCu(i,j) - g%south_lat - 0.5*g%len_lat) / g%len_lat
187 x_2 = (g%geoLonCu(i,j) - g%west_lon - 0.5*g%len_lon) / g%len_lon
188 if (g%geoLonCu(i,j) == g%west_lon)
then 192 x_2 = ((g%west_lon + g%len_lon*
REAL(g%ieg-(g%isg-1))/
REAL(g%domain%niglobal)) - &
193 G%west_lon - 0.5*G%len_lon) / g%len_lon
195 u(i,j,k) = u(i,j,k) + velocity_amplitude * ((
real(k)-0.5)/
real(nz)) * &
196 (0.5 - abs(2.0*x_2) + 0.1*abs(cos(10.0*pi*x_2)) - abs(sin(5.0*pi*y_2)))
198 u(i,j,k) = u(i,j,k) + 0.2*velocity_amplitude * ((
real(k)-0.5)/
real(nz)) * &
199 cos(2.0*m*pi*x_2 + 2*m) * cos(6.0*pi*y_2)
201 enddo ;
enddo ;
enddo 210 logical,
intent(in) :: use_temperature
222 real,
intent(in),
dimension(SZI_(G),SZJ_(G), SZK_(G)) :: h
224 real :: eta0(szk_(g)+1)
225 real :: eta(szi_(g),szj_(g),szk_(g)+1)
226 real :: temp(szi_(g),szj_(g),szk_(g))
227 real :: Idamp(szi_(g),szj_(g))
228 real :: eta_im(szj_(g),szk_(g)+1)
229 real :: Idamp_im(szj_(g))
230 real :: damp_rate, jet_width, jet_height, y_2
231 real :: half_strat, half_depth
232 character(len=40) :: mdl =
"Phillips_initialize_sponges" 234 integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
235 logical,
save :: first_call = .true.
237 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
238 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
240 eta(:,:,:) = 0.0 ; temp(:,:,:) = 0.0 ; idamp(:,:) = 0.0
241 eta_im(:,:) = 0.0 ; idamp_im(:) = 0.0
243 if (first_call)
call log_version(param_file, mdl, version)
245 call get_param(param_file, mdl,
"HALF_STRAT_DEPTH", half_strat, &
246 "The maximum depth of the ocean.", units=
"nondim", &
248 call get_param(param_file, mdl,
"SPONGE_RATE", damp_rate, &
249 "The rate at which the zonal-mean sponges damp.", units=
"s-1", &
250 default = 1.0/(10.0*86400.0))
252 call get_param(param_file, mdl,
"JET_WIDTH", jet_width, &
253 "The width of the zonal-mean jet.", units=
"km", &
254 fail_if_missing=.true.)
255 call get_param(param_file, mdl,
"JET_HEIGHT", jet_height, &
256 "The interface height scale associated with the \n"//&
257 "zonal-mean jet.", units=
"m", &
258 fail_if_missing=.true.)
260 half_depth = g%max_depth*half_strat
261 eta0(1) = 0.0 ; eta0(nz+1) = -g%max_depth
262 do k=2,1+nz/2 ; eta0(k) = -half_depth*(2.0*(k-1)/
real(nz)) ; enddo
264 eta0(k) = -g%max_depth - 2.0*(g%max_depth-half_depth) * ((k-(nz+1))/
real(nz))
268 idamp_im(j) = damp_rate
269 eta_im(j,1) = 0.0 ; eta_im(j,nz+1) = -g%max_depth
271 do k=2,nz ;
do j=js,je
272 y_2 = g%geoLatT(is,j) - g%south_lat - 0.5*g%len_lat
273 eta_im(j,k) = eta0(k) + &
274 jet_height * tanh(y_2 / jet_width)
276 if (eta_im(j,k) > 0.0) eta_im(j,k) = 0.0
277 if (eta_im(j,k) < -g%max_depth) eta_im(j,k) = -g%max_depth
286 real,
intent(in) :: x
290 if (abs(x) > 228.)
then 293 sech = 2.0 / (exp(x) + exp(-x))
300 real,
dimension(G%isd:G%ied,G%jsd:G%jed), &
303 real,
intent(in) :: max_depth
305 real :: PI, Htop, Wtop, Ltop, offset, dist, &
306 x1, x2, x3, x4, y1, y2
307 integer :: i,j,is,ie,js,je
308 character(len=40) :: mdl =
"Phillips_initialize_topography" 310 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
314 call get_param(param_file, mdl,
"PHILLIPS_HTOP", htop, &
315 "The maximum height of the topography.", units=
"m", &
316 fail_if_missing=.true.)
324 y1=g%south_lat+0.5*g%len_lat+offset-0.5*wtop; y2=y1+wtop
325 x1=g%west_lon+0.1*g%len_lon; x2=x1+ltop; x3=x1+dist; x4=x3+3.0/2.0*ltop
327 do i=is,ie ;
do j=js,je
329 if (g%geoLonT(i,j)>x1 .and. g%geoLonT(i,j)<x2)
then 330 d(i,j) = htop*sin(pi*(g%geoLonT(i,j)-x1)/(x2-x1))**2
331 if (g%geoLatT(i,j)>y1 .and. g%geoLatT(i,j)<y2)
then 332 d(i,j)=d(i,j)*(1-sin(pi*(g%geoLatT(i,j)-y1)/(y2-y1))**2)
334 else if (g%geoLonT(i,j)>x3 .and. g%geoLonT(i,j)<x4 .and. &
335 g%geoLatT(i,j)>y1 .and. g%geoLatT(i,j)<y2)
then 336 d(i,j) = 2.0/3.0*htop*sin(pi*(g%geoLonT(i,j)-x3)/(x4-x3))**2 &
337 *sin(pi*(g%geoLatT(i,j)-y1)/(y2-y1))**2
339 d(i,j)=max_depth-d(i,j)
subroutine, public read_axis_data(filename, axis_name, var)
Ocean grid type. See mom_grid for details.
Calculates density of sea water from T, S and P.
Provides the ocean grid type.
By Robert Hallberg, April 1994 - June 2002 *This subroutine initializes the fields for the simulation...
This module contains I/O framework code.
subroutine, public phillips_initialize_sponges(G, use_temperature, tv, param_file, CSp, h)
Sets up the the inverse restoration time (Idamp), and.
subroutine, public phillips_initialize_velocity(u, v, G, GV, param_file, just_read_params)
Initialize velocity fields.
subroutine, public phillips_initialize_thickness(h, G, GV, param_file, just_read_params)
Initialize thickness field.
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.
real function sech(x)
sech calculates the hyperbolic secant.
The thermo_var_ptrs structure contains pointers to an assortment of thermodynamic fields that may be ...
subroutine, public phillips_initialize_topography(D, G, param_file, max_depth)
Initialize topography.
subroutine, public mom_error(level, message, all_print)
A control structure for the equation of state.