Fill ghost faces of a 2D y-face field (e.g. bt_vbt, shape ny_total+1). Also copies south physical-wall face onto north physical-wall face. ny_face = ny_total + 1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | fld(nx_total,ny_face) |
y-face field, shape (nx_total, ny_total+1). |
||
| integer, | intent(in) | :: | nx_total | |||
| 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 |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | i | ||||
| integer, | private | :: | j | ||||
| integer, | private | :: | j_n | ||||
| integer, | private | :: | j_s |
pure subroutine ocean_periodic_wrap_face_y_2d(fld, nx_total, ny_face, & nx_phys, ny_phys, nghost, & wrap_x, wrap_y) !! Fill ghost faces of a 2D y-face field (e.g. bt_vbt, shape ny_total+1). !! Also copies south physical-wall face onto north physical-wall face. !! ny_face = ny_total + 1. integer, intent(in) :: nx_total, ny_face, nx_phys, ny_phys, nghost real(wp), intent(inout) :: fld(nx_total, ny_face) !! y-face field, shape (nx_total, ny_total+1). logical, intent(in) :: wrap_x logical, intent(in) :: wrap_y integer :: i, j integer :: j_s, j_n j_s = nghost + 1 j_n = nghost + ny_phys + 1 ! Two-pass: X-wrap first, Y-wrap (+ belt-and-braces) second. if (wrap_x) then do concurrent(j=1:ny_face, i=1:nx_total) if (i <= nghost) then fld(i, j) = fld(i + nx_phys, j) end if if (i > nx_phys + nghost) then fld(i, j) = fld(i - nx_phys, j) end if end do end if if (wrap_y) then do concurrent(j=1:ny_face, i=1:nx_total) ! South ghost faces j=1..nghost ← interior face j+ny_phys if (j <= nghost) then fld(i, j) = fld(i, j + ny_phys) end if ! North ghost faces j=ny_phys+nghost+2..ny_face ← interior face j-ny_phys if (j > ny_phys + nghost + 1) then fld(i, j) = fld(i, j - ny_phys) end if ! Belt-and-braces: copy south wall face onto north wall face. if (j == j_n) fld(i, j) = fld(i, j_s) end do end if end subroutine ocean_periodic_wrap_face_y_2d