12 implicit none ;
private
14 #include <MOM_memory.h>
15 #include "version_variable.h"
18 character(len=40) ::
mdl =
"baroclinic_zone_initialization"
30 subroutine bcz_params(G, GV, US, param_file, S_ref, dSdz, delta_S, dSdx, T_ref, dTdz, &
31 delta_T, dTdx, L_zone, just_read_params)
36 real,
intent(out) :: S_ref
37 real,
intent(out) :: dSdz
38 real,
intent(out) :: delta_S
39 real,
intent(out) :: dSdx
40 real,
intent(out) :: T_ref
41 real,
intent(out) :: dTdz
42 real,
intent(out) :: delta_T
43 real,
intent(out) :: dTdx
44 real,
intent(out) :: L_zone
45 logical,
optional,
intent(in) :: just_read_params
50 just_read = .false. ;
if (
present(just_read_params)) just_read = just_read_params
53 call log_version(param_file,
mdl, version,
'Initialization of an analytic baroclinic zone')
55 call get_param(param_file,
mdl,
"S_REF", s_ref,
'Reference salinity', units=
'ppt', &
56 default=35., do_not_log=just_read)
57 call get_param(param_file,
mdl,
"DSDZ", dsdz,
'Salinity stratification', &
58 units=
'ppt/m', default=0.0, scale=us%Z_to_m, do_not_log=just_read)
59 call get_param(param_file,
mdl,
"DELTA_S",delta_s,
'Salinity difference across baroclinic zone', &
60 units=
'ppt', default=0.0, do_not_log=just_read)
61 call get_param(param_file,
mdl,
"DSDX",dsdx,
'Meridional salinity difference', &
62 units=
'ppt/'//trim(g%x_axis_units), default=0.0, do_not_log=just_read)
63 call get_param(param_file,
mdl,
"T_REF",t_ref,
'Reference temperature',units=
'C', &
64 default=10., do_not_log=just_read)
65 call get_param(param_file,
mdl,
"DTDZ", dtdz,
'Temperature stratification', &
66 units=
'C/m', default=0.0, scale=us%Z_to_m, do_not_log=just_read)
67 call get_param(param_file,
mdl,
"DELTA_T",delta_t,
'Temperature difference across baroclinic zone', &
68 units=
'C', default=0.0, do_not_log=just_read)
69 call get_param(param_file,
mdl,
"DTDX",dtdx,
'Meridional temperature difference', &
70 units=
'C/'//trim(g%x_axis_units), default=0.0, do_not_log=just_read)
71 call get_param(param_file,
mdl,
"L_ZONE",l_zone,
'Width of baroclinic zone', &
72 units=g%x_axis_units, default=0.5*g%len_lat, do_not_log=just_read)
83 real,
dimension(SZI_(G),SZJ_(G), SZK_(G)),
intent(out) :: t
84 real,
dimension(SZI_(G),SZJ_(G), SZK_(G)),
intent(out) :: s
85 real,
dimension(SZI_(G),SZJ_(G), SZK_(G)),
intent(in) :: h
87 logical,
optional,
intent(in) :: just_read_params
90 integer :: i, j, k, is, ie, js, je, nz
91 real :: t_ref, dtdz, dtdx, delta_t
92 real :: s_ref, dsdz, dsdx, delta_s
95 real :: x, xd, xs, y, yd, fn
99 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
100 just_read = .false. ;
if (
present(just_read_params)) just_read = just_read_params
102 call bcz_params(g, gv, us, param_file, s_ref, dsdz, delta_s, dsdx, t_ref, dtdz, &
103 delta_t, dtdx, l_zone, just_read_params)
105 if (just_read)
return
111 do j = g%jsc,g%jec ;
do i = g%isc,g%iec
113 x = g%geoLonT(i,j) - (g%west_lon + 0.5*g%len_lon)
115 y = g%geoLatT(i,j) - (g%south_lat + 0.5*g%len_lat)
118 xs = min(1., max(-1., x/l_zone))
119 fn = sin((0.5*pi)*xs)
125 zc = zi + 0.5*h(i,j,k)*gv%H_to_Z
126 zi = zi + h(i,j,k)*gv%H_to_Z
127 t(i,j,k) = t_ref + dtdz * zc &
130 s(i,j,k) = s_ref + dsdz * zc &