This subroutine determines the number of points which are within sponges in this computational domain. Only points that have positive values of Iresttime and which mask2dT indicates are ocean points are included in the sponges. It also stores the target interface heights.
142 type(ocean_grid_type),
intent(in) :: G
143 integer,
intent(in) :: nz_data
144 real,
dimension(SZI_(G),SZJ_(G)),
intent(in) :: Iresttime
145 type(param_file_type),
intent(in) :: param_file
147 type(ALE_sponge_CS),
pointer :: CS
149 real,
dimension(SZI_(G),SZJ_(G),nz_data),
intent(in) :: data_h
154 #include "version_variable.h"
155 character(len=40) :: mdl =
"MOM_sponge"
156 logical :: use_sponge
157 real,
allocatable,
dimension(:,:,:) :: data_hu
158 real,
allocatable,
dimension(:,:,:) :: data_hv
159 real,
allocatable,
dimension(:,:) :: Iresttime_u
160 real,
allocatable,
dimension(:,:) :: Iresttime_v
161 logical :: bndExtrapolation = .true.
162 integer :: i, j, k, col, total_sponge_cols, total_sponge_cols_u, total_sponge_cols_v
163 character(len=10) :: remapScheme
164 if (
associated(cs))
then
165 call mom_error(warning,
"initialize_sponge called with an associated "// &
166 "control structure.")
171 call log_version(param_file, mdl, version,
"")
172 call get_param(param_file, mdl,
"SPONGE", use_sponge, &
173 "If true, sponges may be applied anywhere in the domain. "//&
174 "The exact location and properties of those sponges are "//&
175 "specified from MOM_initialization.F90.", default=.false.)
177 if (.not.use_sponge)
return
181 call get_param(param_file, mdl,
"SPONGE_UV", cs%sponge_uv, &
182 "Apply sponges in u and v, in addition to tracers.", &
185 call get_param(param_file, mdl,
"REMAPPING_SCHEME", remapscheme, &
186 "This sets the reconstruction scheme used "//&
187 " for vertical remapping for all variables.", &
188 default=
"PLM", do_not_log=.true.)
190 call get_param(param_file, mdl,
"BOUNDARY_EXTRAPOLATION", bndextrapolation, &
191 "When defined, a proper high-order reconstruction "//&
192 "scheme is used within boundary cells rather "//&
193 "than PCM. E.g., if PPM is used for remapping, a "//&
194 "PPM reconstruction will also be used within boundary cells.", &
195 default=.false., do_not_log=.true.)
197 cs%time_varying_sponges = .false.
199 cs%isc = g%isc ; cs%iec = g%iec ; cs%jsc = g%jsc ; cs%jec = g%jec
200 cs%isd = g%isd ; cs%ied = g%ied ; cs%jsd = g%jsd ; cs%jed = g%jed
201 cs%iscB = g%iscB ; cs%iecB = g%iecB; cs%jscB = g%jscB ; cs%jecB = g%jecB
204 cs%num_col = 0 ; cs%fldno = 0
205 do j=g%jsc,g%jec ;
do i=g%isc,g%iec
206 if ((iresttime(i,j)>0.0) .and. (g%mask2dT(i,j)>0)) &
207 cs%num_col = cs%num_col + 1
210 if (cs%num_col > 0)
then
211 allocate(cs%Iresttime_col(cs%num_col)) ; cs%Iresttime_col = 0.0
212 allocate(cs%col_i(cs%num_col)) ; cs%col_i = 0
213 allocate(cs%col_j(cs%num_col)) ; cs%col_j = 0
216 do j=g%jsc,g%jec ;
do i=g%isc,g%iec
217 if ((iresttime(i,j)>0.0) .and. (g%mask2dT(i,j)>0))
then
218 cs%col_i(col) = i ; cs%col_j(col) = j
219 cs%Iresttime_col(col) = g%US%T_to_s*iresttime(i,j)
225 allocate(cs%Ref_h%p(cs%nz_data,cs%num_col))
226 do col=1,cs%num_col ;
do k=1,cs%nz_data
227 cs%Ref_h%p(k,col) = data_h(cs%col_i(col),cs%col_j(col),k)
231 total_sponge_cols = cs%num_col
232 call sum_across_pes(total_sponge_cols)
235 call initialize_remapping(cs%remap_cs, remapscheme, boundary_extrapolation=bndextrapolation)
237 call log_param(param_file, mdl,
"!Total sponge columns at h points", total_sponge_cols, &
238 "The total number of columns where sponges are applied at h points.")
240 if (cs%sponge_uv)
then
242 allocate(data_hu(g%isdB:g%iedB,g%jsd:g%jed,nz_data)); data_hu(:,:,:)=0.0
243 allocate(data_hv(g%isd:g%ied,g%jsdB:g%jedB,nz_data)); data_hv(:,:,:)=0.0
244 allocate(iresttime_u(g%isdB:g%iedB,g%jsd:g%jed)); iresttime_u(:,:)=0.0
245 allocate(iresttime_v(g%isd:g%ied,g%jsdB:g%jedB)); iresttime_v(:,:)=0.0
249 do j=cs%jsc,cs%jec;
do i=cs%iscB,cs%iecB
250 data_hu(i,j,:) = 0.5 * (data_h(i,j,:) + data_h(i+1,j,:))
251 iresttime_u(i,j) = 0.5 * (iresttime(i,j) + iresttime(i+1,j))
252 if ((iresttime_u(i,j)>0.0) .and. (g%mask2dCu(i,j)>0)) &
253 cs%num_col_u = cs%num_col_u + 1
256 if (cs%num_col_u > 0)
then
258 allocate(cs%Iresttime_col_u(cs%num_col_u)) ; cs%Iresttime_col_u = 0.0
259 allocate(cs%col_i_u(cs%num_col_u)) ; cs%col_i_u = 0
260 allocate(cs%col_j_u(cs%num_col_u)) ; cs%col_j_u = 0
264 do j=cs%jsc,cs%jec ;
do i=cs%iscB,cs%iecB
265 if ((iresttime_u(i,j)>0.0) .and. (g%mask2dCu(i,j)>0))
then
266 cs%col_i_u(col) = i ; cs%col_j_u(col) = j
267 cs%Iresttime_col_u(col) = g%US%T_to_s*iresttime_u(i,j)
274 allocate(cs%Ref_hu%p(cs%nz_data,cs%num_col_u))
275 do col=1,cs%num_col_u ;
do k=1,cs%nz_data
276 cs%Ref_hu%p(k,col) = data_hu(cs%col_i_u(col),cs%col_j_u(col),k)
279 total_sponge_cols_u = cs%num_col_u
280 call sum_across_pes(total_sponge_cols_u)
281 call log_param(param_file, mdl,
"!Total sponge columns at u points", total_sponge_cols_u, &
282 "The total number of columns where sponges are applied at u points.")
286 do j=cs%jscB,cs%jecB;
do i=cs%isc,cs%iec
287 data_hv(i,j,:) = 0.5 * (data_h(i,j,:) + data_h(i,j+1,:))
288 iresttime_v(i,j) = 0.5 * (iresttime(i,j) + iresttime(i,j+1))
289 if ((iresttime_v(i,j)>0.0) .and. (g%mask2dCv(i,j)>0)) &
290 cs%num_col_v = cs%num_col_v + 1
293 if (cs%num_col_v > 0)
then
295 allocate(cs%Iresttime_col_v(cs%num_col_v)) ; cs%Iresttime_col_v = 0.0
296 allocate(cs%col_i_v(cs%num_col_v)) ; cs%col_i_v = 0
297 allocate(cs%col_j_v(cs%num_col_v)) ; cs%col_j_v = 0
301 do j=cs%jscB,cs%jecB ;
do i=cs%isc,cs%iec
302 if ((iresttime_v(i,j)>0.0) .and. (g%mask2dCv(i,j)>0))
then
303 cs%col_i_v(col) = i ; cs%col_j_v(col) = j
304 cs%Iresttime_col_v(col) = g%US%T_to_s*iresttime_v(i,j)
310 allocate(cs%Ref_hv%p(cs%nz_data,cs%num_col_v))
311 do col=1,cs%num_col_v ;
do k=1,cs%nz_data
312 cs%Ref_hv%p(k,col) = data_hv(cs%col_i_v(col),cs%col_j_v(col),k)
315 total_sponge_cols_v = cs%num_col_v
316 call sum_across_pes(total_sponge_cols_v)
317 call log_param(param_file, mdl,
"!Total sponge columns at v points", total_sponge_cols_v, &
318 "The total number of columns where sponges are applied at v points.")