MOM6
mom_ale_sponge::initialize_ale_sponge Interface Reference

Detailed Description

Ddetermine 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.

Definition at line 49 of file MOM_ALE_sponge.F90.

Private functions

subroutine initialize_ale_sponge_fixed (Iresttime, G, param_file, CS, data_h, nz_data)
 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. More...
 
subroutine initialize_ale_sponge_varying (Iresttime, G, param_file, CS)
 This subroutine determines the number of points which are to be restoref in the computational domain. Only points that have positive values of Iresttime and which mask2dT indicates are ocean points are included in the sponges. More...
 

Detailed Description

Ddetermine 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.

Definition at line 49 of file MOM_ALE_sponge.F90.

Functions and subroutines

◆ initialize_ale_sponge_fixed()

subroutine mom_ale_sponge::initialize_ale_sponge::initialize_ale_sponge_fixed ( real, dimension(szi_(g),szj_(g)), intent(in)  Iresttime,
type(ocean_grid_type), intent(in)  G,
type(param_file_type), intent(in)  param_file,
type(ale_sponge_cs), pointer  CS,
real, dimension(szi_(g),szj_(g),nz_data), intent(in)  data_h,
integer, intent(in)  nz_data 
)
private

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.

Parameters
[in]gThe ocean's grid structure.
[in]nz_dataThe total number of sponge input layers.
[in]iresttimeThe inverse of the restoring time [T-1 ~> s-1].
[in]param_fileA structure indicating the open file to parse for model parameter values.
csA pointer that is set to point to the control structure for this module (in/out).
[in]data_hThe thicknesses of the sponge input layers [H ~> m or kg m-2].

Definition at line 149 of file MOM_ALE_sponge.F90.

149 
150  type(ocean_grid_type), intent(in) :: g !< The ocean's grid structure.
151  integer, intent(in) :: nz_data !< The total number of sponge input layers.
152  real, dimension(SZI_(G),SZJ_(G)), intent(in) :: iresttime !< The inverse of the restoring time [T-1 ~> s-1].
153  type(param_file_type), intent(in) :: param_file !< A structure indicating the open file
154  !! to parse for model parameter values.
155  type(ale_sponge_cs), pointer :: cs !< A pointer that is set to point to the control
156  !! structure for this module (in/out).
157  real, dimension(SZI_(G),SZJ_(G),nz_data), intent(in) :: data_h !< The thicknesses of the sponge
158  !! input layers [H ~> m or kg m-2].
159 
160 
161 ! This include declares and sets the variable "version".
162 #include "version_variable.h"
163  character(len=40) :: mdl = "MOM_sponge" ! This module's name.
164  logical :: use_sponge
165  real, allocatable, dimension(:,:,:) :: data_hu !< thickness at u points [H ~> m or kg m-2]
166  real, allocatable, dimension(:,:,:) :: data_hv !< thickness at v points [H ~> m or kg m-2]
167  real, allocatable, dimension(:,:) :: iresttime_u !< inverse of the restoring time at u points [T-1 ~> s-1]
168  real, allocatable, dimension(:,:) :: iresttime_v !< inverse of the restoring time at v points [T-1 ~> s-1]
169  logical :: bndextrapolation = .true. ! If true, extrapolate boundaries
170  logical :: default_2018_answers
171  integer :: i, j, k, col, total_sponge_cols, total_sponge_cols_u, total_sponge_cols_v
172  character(len=10) :: remapscheme
173  if (associated(cs)) then
174  call mom_error(warning, "initialize_ALE_sponge_fixed called with an associated "// &
175  "control structure.")
176  return
177  endif
178 
179 ! Set default, read and log parameters
180  call log_version(param_file, mdl, version, "")
181  call get_param(param_file, mdl, "SPONGE", use_sponge, &
182  "If true, sponges may be applied anywhere in the domain. "//&
183  "The exact location and properties of those sponges are "//&
184  "specified from MOM_initialization.F90.", default=.false.)
185 
186  if (.not.use_sponge) return
187 
188  allocate(cs)
189 
190  call get_param(param_file, mdl, "SPONGE_UV", cs%sponge_uv, &
191  "Apply sponges in u and v, in addition to tracers.", &
192  default=.false.)
193 
194  call get_param(param_file, mdl, "REMAPPING_SCHEME", remapscheme, &
195  "This sets the reconstruction scheme used "//&
196  " for vertical remapping for all variables.", &
197  default="PLM", do_not_log=.true.)
198 
199  call get_param(param_file, mdl, "BOUNDARY_EXTRAPOLATION", bndextrapolation, &
200  "When defined, a proper high-order reconstruction "//&
201  "scheme is used within boundary cells rather "//&
202  "than PCM. E.g., if PPM is used for remapping, a "//&
203  "PPM reconstruction will also be used within boundary cells.", &
204  default=.false., do_not_log=.true.)
205  call get_param(param_file, mdl, "DEFAULT_2018_ANSWERS", default_2018_answers, &
206  "This sets the default value for the various _2018_ANSWERS parameters.", &
207  default=.false.)
208  call get_param(param_file, mdl, "REMAPPING_2018_ANSWERS", cs%remap_answers_2018, &
209  "If true, use the order of arithmetic and expressions that recover the "//&
210  "answers from the end of 2018. Otherwise, use updated and more robust "//&
211  "forms of the same expressions.", default=default_2018_answers)
212  call get_param(param_file, mdl, "HOR_REGRID_2018_ANSWERS", cs%hor_regrid_answers_2018, &
213  "If true, use the order of arithmetic for horizonal regridding that recovers "//&
214  "the answers from the end of 2018. Otherwise, use rotationally symmetric "//&
215  "forms of the same expressions.", default=default_2018_answers)
216 
217  cs%time_varying_sponges = .false.
218  cs%nz = g%ke
219  cs%isc = g%isc ; cs%iec = g%iec ; cs%jsc = g%jsc ; cs%jec = g%jec
220  cs%isd = g%isd ; cs%ied = g%ied ; cs%jsd = g%jsd ; cs%jed = g%jed
221  cs%iscB = g%iscB ; cs%iecB = g%iecB; cs%jscB = g%jscB ; cs%jecB = g%jecB
222 
223  ! number of columns to be restored
224  cs%num_col = 0 ; cs%fldno = 0
225  do j=g%jsc,g%jec ; do i=g%isc,g%iec
226  if ((iresttime(i,j)>0.0) .and. (g%mask2dT(i,j)>0)) &
227  cs%num_col = cs%num_col + 1
228  enddo ; enddo
229 
230  if (cs%num_col > 0) then
231  allocate(cs%Iresttime_col(cs%num_col)) ; cs%Iresttime_col = 0.0
232  allocate(cs%col_i(cs%num_col)) ; cs%col_i = 0
233  allocate(cs%col_j(cs%num_col)) ; cs%col_j = 0
234  ! pass indices, restoring time to the CS structure
235  col = 1
236  do j=g%jsc,g%jec ; do i=g%isc,g%iec
237  if ((iresttime(i,j)>0.0) .and. (g%mask2dT(i,j)>0)) then
238  cs%col_i(col) = i ; cs%col_j(col) = j
239  cs%Iresttime_col(col) = iresttime(i,j)
240  col = col +1
241  endif
242  enddo ; enddo
243  ! same for total number of arbritary layers and correspondent data
244  cs%nz_data = nz_data
245  allocate(cs%Ref_h%p(cs%nz_data,cs%num_col))
246  do col=1,cs%num_col ; do k=1,cs%nz_data
247  cs%Ref_h%p(k,col) = data_h(cs%col_i(col),cs%col_j(col),k)
248  enddo ; enddo
249  endif
250 
251  total_sponge_cols = cs%num_col
252  call sum_across_pes(total_sponge_cols)
253 
254 ! Call the constructor for remapping control structure
255  call initialize_remapping(cs%remap_cs, remapscheme, boundary_extrapolation=bndextrapolation, &
256  answers_2018=cs%remap_answers_2018)
257 
258  call log_param(param_file, mdl, "!Total sponge columns at h points", total_sponge_cols, &
259  "The total number of columns where sponges are applied at h points.", like_default=.true.)
260 
261  if (cs%sponge_uv) then
262 
263  allocate(data_hu(g%isdB:g%iedB,g%jsd:g%jed,nz_data)) ; data_hu(:,:,:) = 0.0
264  allocate(data_hv(g%isd:g%ied,g%jsdB:g%jedB,nz_data)) ; data_hv(:,:,:) = 0.0
265  allocate(iresttime_u(g%isdB:g%iedB,g%jsd:g%jed)) ; iresttime_u(:,:) = 0.0
266  allocate(iresttime_v(g%isd:g%ied,g%jsdB:g%jedB)) ; iresttime_v(:,:) = 0.0
267 
268  ! u points
269  cs%num_col_u = 0 ; !CS%fldno_u = 0
270  do j=cs%jsc,cs%jec ; do i=cs%iscB,cs%iecB
271  data_hu(i,j,:) = 0.5 * (data_h(i,j,:) + data_h(i+1,j,:))
272  iresttime_u(i,j) = 0.5 * (iresttime(i,j) + iresttime(i+1,j))
273  if ((iresttime_u(i,j)>0.0) .and. (g%mask2dCu(i,j)>0)) &
274  cs%num_col_u = cs%num_col_u + 1
275  enddo ; enddo
276 
277  if (cs%num_col_u > 0) then
278 
279  allocate(cs%Iresttime_col_u(cs%num_col_u)) ; cs%Iresttime_col_u(:) = 0.0
280  allocate(cs%col_i_u(cs%num_col_u)) ; cs%col_i_u(:) = 0
281  allocate(cs%col_j_u(cs%num_col_u)) ; cs%col_j_u(:) = 0
282 
283  ! pass indices, restoring time to the CS structure
284  col = 1
285  do j=cs%jsc,cs%jec ; do i=cs%iscB,cs%iecB
286  if ((iresttime_u(i,j)>0.0) .and. (g%mask2dCu(i,j)>0)) then
287  cs%col_i_u(col) = i ; cs%col_j_u(col) = j
288  cs%Iresttime_col_u(col) = iresttime_u(i,j)
289  col = col + 1
290  endif
291  enddo ; enddo
292 
293  ! same for total number of arbritary layers and correspondent data
294 
295  allocate(cs%Ref_hu%p(cs%nz_data,cs%num_col_u))
296  do col=1,cs%num_col_u ; do k=1,cs%nz_data
297  cs%Ref_hu%p(k,col) = data_hu(cs%col_i_u(col),cs%col_j_u(col),k)
298  enddo ; enddo
299  endif
300  total_sponge_cols_u = cs%num_col_u
301  call sum_across_pes(total_sponge_cols_u)
302  call log_param(param_file, mdl, "!Total sponge columns at u points", total_sponge_cols_u, &
303  "The total number of columns where sponges are applied at u points.", like_default=.true.)
304 
305  ! v points
306  cs%num_col_v = 0 ; !CS%fldno_v = 0
307  do j=cs%jscB,cs%jecB; do i=cs%isc,cs%iec
308  data_hv(i,j,:) = 0.5 * (data_h(i,j,:) + data_h(i,j+1,:))
309  iresttime_v(i,j) = 0.5 * (iresttime(i,j) + iresttime(i,j+1))
310  if ((iresttime_v(i,j)>0.0) .and. (g%mask2dCv(i,j)>0)) &
311  cs%num_col_v = cs%num_col_v + 1
312  enddo ; enddo
313 
314  if (cs%num_col_v > 0) then
315 
316  allocate(cs%Iresttime_col_v(cs%num_col_v)) ; cs%Iresttime_col_v = 0.0
317  allocate(cs%col_i_v(cs%num_col_v)) ; cs%col_i_v = 0
318  allocate(cs%col_j_v(cs%num_col_v)) ; cs%col_j_v = 0
319 
320  ! pass indices, restoring time to the CS structure
321  col = 1
322  do j=cs%jscB,cs%jecB ; do i=cs%isc,cs%iec
323  if ((iresttime_v(i,j)>0.0) .and. (g%mask2dCv(i,j)>0)) then
324  cs%col_i_v(col) = i ; cs%col_j_v(col) = j
325  cs%Iresttime_col_v(col) = iresttime_v(i,j)
326  col = col + 1
327  endif
328  enddo ; enddo
329 
330  ! same for total number of arbritary layers and correspondent data
331  allocate(cs%Ref_hv%p(cs%nz_data,cs%num_col_v))
332  do col=1,cs%num_col_v ; do k=1,cs%nz_data
333  cs%Ref_hv%p(k,col) = data_hv(cs%col_i_v(col),cs%col_j_v(col),k)
334  enddo ; enddo
335  endif
336  total_sponge_cols_v = cs%num_col_v
337  call sum_across_pes(total_sponge_cols_v)
338  call log_param(param_file, mdl, "!Total sponge columns at v points", total_sponge_cols_v, &
339  "The total number of columns where sponges are applied at v points.", like_default=.true.)
340  endif
341 

◆ initialize_ale_sponge_varying()

subroutine mom_ale_sponge::initialize_ale_sponge::initialize_ale_sponge_varying ( real, dimension( g %isd: g %ied, g %jsd: g %jed), intent(in)  Iresttime,
type(ocean_grid_type), intent(in)  G,
type(param_file_type), intent(in)  param_file,
type(ale_sponge_cs), pointer  CS 
)
private

This subroutine determines the number of points which are to be restoref in the computational domain. Only points that have positive values of Iresttime and which mask2dT indicates are ocean points are included in the sponges.

Parameters
[in]gThe ocean's grid structure.
[in]iresttimeThe inverse of the restoring time [T-1 ~> s-1].
[in]param_fileA structure indicating the open file to parse for model parameter values.
csA pointer that is set to point to the control structure for this module (in/out).

Definition at line 397 of file MOM_ALE_sponge.F90.

397 
398  type(ocean_grid_type), intent(in) :: g !< The ocean's grid structure.
399  real, dimension(SZI_(G),SZJ_(G)), intent(in) :: iresttime !< The inverse of the restoring time [T-1 ~> s-1].
400  type(param_file_type), intent(in) :: param_file !< A structure indicating the open file to parse
401  !! for model parameter values.
402  type(ale_sponge_cs), pointer :: cs !< A pointer that is set to point to the control
403  !! structure for this module (in/out).
404 
405 ! This include declares and sets the variable "version".
406 #include "version_variable.h"
407  character(len=40) :: mdl = "MOM_sponge" ! This module's name.
408  logical :: use_sponge
409  real, allocatable, dimension(:,:) :: iresttime_u !< inverse of the restoring time at u points [T-1 ~> s-1]
410  real, allocatable, dimension(:,:) :: iresttime_v !< inverse of the restoring time at v points [T-1 ~> s-1]
411  logical :: bndextrapolation = .true. ! If true, extrapolate boundaries
412  logical :: default_2018_answers
413  logical :: spongedataongrid = .false.
414  integer :: i, j, k, col, total_sponge_cols, total_sponge_cols_u, total_sponge_cols_v
415  character(len=10) :: remapscheme
416 
417  if (associated(cs)) then
418  call mom_error(warning, "initialize_ALE_sponge_varying called with an associated "// &
419  "control structure.")
420  return
421  endif
422 ! Set default, read and log parameters
423  call log_version(param_file, mdl, version, "")
424  call get_param(param_file, mdl, "SPONGE", use_sponge, &
425  "If true, sponges may be applied anywhere in the domain. "//&
426  "The exact location and properties of those sponges are "//&
427  "specified from MOM_initialization.F90.", default=.false.)
428  if (.not.use_sponge) return
429  allocate(cs)
430  call get_param(param_file, mdl, "SPONGE_UV", cs%sponge_uv, &
431  "Apply sponges in u and v, in addition to tracers.", &
432  default=.false.)
433  call get_param(param_file, mdl, "REMAPPING_SCHEME", remapscheme, &
434  "This sets the reconstruction scheme used "//&
435  " for vertical remapping for all variables.", &
436  default="PLM", do_not_log=.true.)
437  call get_param(param_file, mdl, "BOUNDARY_EXTRAPOLATION", bndextrapolation, &
438  "When defined, a proper high-order reconstruction "//&
439  "scheme is used within boundary cells rather "//&
440  "than PCM. E.g., if PPM is used for remapping, a "//&
441  "PPM reconstruction will also be used within boundary cells.", &
442  default=.false., do_not_log=.true.)
443  call get_param(param_file, mdl, "DEFAULT_2018_ANSWERS", default_2018_answers, &
444  "This sets the default value for the various _2018_ANSWERS parameters.", &
445  default=.false.)
446  call get_param(param_file, mdl, "REMAPPING_2018_ANSWERS", cs%remap_answers_2018, &
447  "If true, use the order of arithmetic and expressions that recover the "//&
448  "answers from the end of 2018. Otherwise, use updated and more robust "//&
449  "forms of the same expressions.", default=default_2018_answers)
450  call get_param(param_file, mdl, "SPONGE_DATA_ONGRID", cs%spongeDataOngrid, &
451  "When defined, the incoming sponge data are "//&
452  "assumed to be on the model grid " , &
453  default=.false.)
454  cs%time_varying_sponges = .true.
455  cs%nz = g%ke
456  cs%isc = g%isc ; cs%iec = g%iec ; cs%jsc = g%jsc ; cs%jec = g%jec
457  cs%isd = g%isd ; cs%ied = g%ied ; cs%jsd = g%jsd ; cs%jed = g%jed
458  cs%iscB = g%iscB ; cs%iecB = g%iecB; cs%jscB = g%jscB ; cs%jecB = g%jecB
459 
460  ! number of columns to be restored
461  cs%num_col = 0 ; cs%fldno = 0
462  do j=g%jsc,g%jec ; do i=g%isc,g%iec
463  if ((iresttime(i,j)>0.0) .and. (g%mask2dT(i,j)>0)) &
464  cs%num_col = cs%num_col + 1
465  enddo ; enddo
466  if (cs%num_col > 0) then
467  allocate(cs%Iresttime_col(cs%num_col)) ; cs%Iresttime_col = 0.0
468  allocate(cs%col_i(cs%num_col)) ; cs%col_i = 0
469  allocate(cs%col_j(cs%num_col)) ; cs%col_j = 0
470  ! pass indices, restoring time to the CS structure
471  col = 1
472  do j=g%jsc,g%jec ; do i=g%isc,g%iec
473  if ((iresttime(i,j)>0.0) .and. (g%mask2dT(i,j)>0)) then
474  cs%col_i(col) = i ; cs%col_j(col) = j
475  cs%Iresttime_col(col) = iresttime(i,j)
476  col = col +1
477  endif
478  enddo ; enddo
479  endif
480  total_sponge_cols = cs%num_col
481  call sum_across_pes(total_sponge_cols)
482 
483 ! Call the constructor for remapping control structure
484  call initialize_remapping(cs%remap_cs, remapscheme, boundary_extrapolation=bndextrapolation, &
485  answers_2018=cs%remap_answers_2018)
486  call log_param(param_file, mdl, "!Total sponge columns at h points", total_sponge_cols, &
487  "The total number of columns where sponges are applied at h points.", like_default=.true.)
488  if (cs%sponge_uv) then
489  allocate(iresttime_u(g%isdB:g%iedB,g%jsd:g%jed)) ; iresttime_u(:,:) = 0.0
490  allocate(iresttime_v(g%isd:g%ied,g%jsdB:g%jedB)) ; iresttime_v(:,:) = 0.0
491  ! u points
492  cs%num_col_u = 0 ; !CS%fldno_u = 0
493  do j=cs%jsc,cs%jec; do i=cs%iscB,cs%iecB
494  iresttime_u(i,j) = 0.5 * (iresttime(i,j) + iresttime(i+1,j))
495  if ((iresttime_u(i,j)>0.0) .and. (g%mask2dCu(i,j)>0)) &
496  cs%num_col_u = cs%num_col_u + 1
497  enddo ; enddo
498  if (cs%num_col_u > 0) then
499  allocate(cs%Iresttime_col_u(cs%num_col_u)) ; cs%Iresttime_col_u = 0.0
500  allocate(cs%col_i_u(cs%num_col_u)) ; cs%col_i_u = 0
501  allocate(cs%col_j_u(cs%num_col_u)) ; cs%col_j_u = 0
502  ! pass indices, restoring time to the CS structure
503  col = 1
504  do j=cs%jsc,cs%jec ; do i=cs%iscB,cs%iecB
505  if ((iresttime_u(i,j)>0.0) .and. (g%mask2dCu(i,j)>0)) then
506  cs%col_i_u(col) = i ; cs%col_j_u(col) = j
507  cs%Iresttime_col_u(col) = iresttime_u(i,j)
508  col = col +1
509  endif
510  enddo ; enddo
511  ! same for total number of arbritary layers and correspondent data
512  endif
513  total_sponge_cols_u = cs%num_col_u
514  call sum_across_pes(total_sponge_cols_u)
515  call log_param(param_file, mdl, "!Total sponge columns at u points", total_sponge_cols_u, &
516  "The total number of columns where sponges are applied at u points.", like_default=.true.)
517  ! v points
518  cs%num_col_v = 0 ; !CS%fldno_v = 0
519  do j=cs%jscB,cs%jecB; do i=cs%isc,cs%iec
520  iresttime_v(i,j) = 0.5 * (iresttime(i,j) + iresttime(i,j+1))
521  if ((iresttime_v(i,j)>0.0) .and. (g%mask2dCv(i,j)>0)) &
522  cs%num_col_v = cs%num_col_v + 1
523  enddo ; enddo
524  if (cs%num_col_v > 0) then
525  allocate(cs%Iresttime_col_v(cs%num_col_v)) ; cs%Iresttime_col_v = 0.0
526  allocate(cs%col_i_v(cs%num_col_v)) ; cs%col_i_v = 0
527  allocate(cs%col_j_v(cs%num_col_v)) ; cs%col_j_v = 0
528  ! pass indices, restoring time to the CS structure
529  col = 1
530  do j=cs%jscB,cs%jecB ; do i=cs%isc,cs%iec
531  if ((iresttime_v(i,j)>0.0) .and. (g%mask2dCv(i,j)>0)) then
532  cs%col_i_v(col) = i ; cs%col_j_v(col) = j
533  cs%Iresttime_col_v(col) = iresttime_v(i,j)
534  col = col +1
535  endif
536  enddo ; enddo
537  endif
538  total_sponge_cols_v = cs%num_col_v
539  call sum_across_pes(total_sponge_cols_v)
540  call log_param(param_file, mdl, "!Total sponge columns at v points", total_sponge_cols_v, &
541  "The total number of columns where sponges are applied at v points.", like_default=.true.)
542  endif
543 

The documentation for this interface was generated from the following file: