evp_wrap_corner_impl Subroutine

private pure subroutine evp_wrap_corner_impl(fld, nx_face, ny_face, nx_phys, ny_phys, nghost, wrap_x, wrap_y)

Periodic ghost-wrap for a corner-staggered field (e.g. str_s), shape (nx_total+1, ny_total+1). No corner-wrap helper exists in rdb_ocean_periodic (only centre/face_x/face_y) — this is the EVP-local twin, same two-pass (x-then-y) structure.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: fld(nx_face,ny_face)
integer, intent(in) :: nx_face
integer, intent(in) :: ny_face
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: nghost
logical, intent(in) :: wrap_x
logical, intent(in) :: wrap_y

Called by

proc~~evp_wrap_corner_impl~~CalledByGraph proc~evp_wrap_corner_impl evp_wrap_corner_impl proc~ice_evp_dynamics_impl ice_evp_dynamics_impl proc~ice_evp_dynamics_impl->proc~evp_wrap_corner_impl proc~ice_evp_dynamics ice_evp_dynamics proc~ice_evp_dynamics->proc~ice_evp_dynamics_impl proc~ice_evp_step ice_evp_step proc~ice_evp_step->proc~ice_evp_dynamics proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ice_evp_step proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step_ice proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step_ice

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: i_e
integer, private :: i_w
integer, private :: j
integer, private :: j_n
integer, private :: j_s

Source Code

   pure subroutine evp_wrap_corner_impl(fld, nx_face, ny_face, nx_phys, ny_phys, nghost, &
                                        wrap_x, wrap_y)
      !! Periodic ghost-wrap for a corner-staggered field (e.g. `str_s`),
      !! shape (nx_total+1, ny_total+1). No corner-wrap helper exists in
      !! `rdb_ocean_periodic` (only centre/face_x/face_y) — this is the
      !! EVP-local twin, same two-pass (x-then-y) structure.
      integer, intent(in) :: nx_face, ny_face, nx_phys, ny_phys, nghost
      real(wp), intent(inout) :: fld(nx_face, ny_face)
      logical, intent(in) :: wrap_x, wrap_y
      integer :: i, j
      integer :: i_w, i_e, j_s, j_n

      i_w = nghost + 1
      i_e = nghost + nx_phys + 1
      j_s = nghost + 1
      j_n = nghost + ny_phys + 1

      if (wrap_x) then
         do concurrent(j=1:ny_face, i=1:nx_face)
            if (i <= nghost) then
               fld(i, j) = fld(i + nx_phys, j)
            end if
            if (i > nx_phys + nghost + 1) then
               fld(i, j) = fld(i - nx_phys, j)
            end if
            if (i == i_e) fld(i, j) = fld(i_w, j)
         end do
      end if
      if (wrap_y) then
         do concurrent(j=1:ny_face, i=1:nx_face)
            if (j <= nghost) then
               fld(i, j) = fld(i, j + ny_phys)
            end if
            if (j > ny_phys + nghost + 1) then
               fld(i, j) = fld(i, j - ny_phys)
            end if
            if (j == j_n) fld(i, j) = fld(i, j_s)
         end do
      end if
   end subroutine evp_wrap_corner_impl