fill_tracer_ghosts_meridional Subroutine

private pure subroutine fill_tracer_ghosts_meridional(hTr, h_layer, v_layer, nx_total, ny_total, nz, i_w, i_e, j_s, j_n, nghost, bc_s, bc_n, clamped_tr_s, clamped_tr_n)

Upwind-aware tracer ghost fill for south and north open edges.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: hTr(nx_total,ny_total,nz)
real(kind=wp), intent(in) :: h_layer(nx_total,ny_total,nz)
real(kind=wp), intent(in) :: v_layer(nx_total,ny_total+1,nz)
integer, intent(in) :: nx_total
integer, intent(in) :: ny_total
integer, intent(in) :: nz
integer, intent(in) :: i_w
integer, intent(in) :: i_e
integer, intent(in) :: j_s
integer, intent(in) :: j_n
integer, intent(in) :: nghost
integer, intent(in) :: bc_s
integer, intent(in) :: bc_n
real(kind=wp), intent(in) :: clamped_tr_s
real(kind=wp), intent(in) :: clamped_tr_n

Calls

proc~~fill_tracer_ghosts_meridional~~CallsGraph proc~fill_tracer_ghosts_meridional fill_tracer_ghosts_meridional local local proc~fill_tracer_ghosts_meridional->local proc~is_open_ish is_open_ish proc~fill_tracer_ghosts_meridional->proc~is_open_ish

Variables

Type Visibility Attributes Name Initial
integer, private :: g
real(kind=wp), private :: hTr_bc
real(kind=wp), private :: hTr_int
integer, private :: i
integer, private :: k

Source Code

   pure subroutine fill_tracer_ghosts_meridional(hTr, h_layer, v_layer, &
                                                 nx_total, ny_total, nz, &
                                                 i_w, i_e, j_s, j_n, nghost, &
                                                 bc_s, bc_n, &
                                                 clamped_tr_s, clamped_tr_n)
      !! Upwind-aware tracer ghost fill for south and north open edges.
      integer, intent(in) :: nx_total, ny_total, nz, nghost
      real(wp), intent(inout) :: hTr(nx_total, ny_total, nz)
      real(wp), intent(in)    :: h_layer(nx_total, ny_total, nz)
      real(wp), intent(in)    :: v_layer(nx_total, ny_total + 1, nz)
      integer, intent(in) :: i_w, i_e, j_s, j_n
      integer, intent(in) :: bc_s, bc_n
      real(wp), intent(in) :: clamped_tr_s, clamped_tr_n

      integer :: i, k, g
      real(wp) :: hTr_bc, hTr_int

      ! South ghosts
      if (is_open_ish(bc_s)) then
         do concurrent(k=1:nz, i=i_w:i_e, g=1:nghost) local(hTr_bc, hTr_int)
            ! South inflow = v > 0 (northward into domain).
            if (v_layer(i, j_s, k) > 0.0_wp) then
               hTr_bc = clamped_tr_s*h_layer(i, g, k)
               hTr(i, g, k) = hTr_bc
            else
               hTr_int = hTr(i, j_s, k)
               hTr(i, g, k) = hTr_int
            end if
         end do
      end if

      ! North ghosts
      if (is_open_ish(bc_n)) then
         do concurrent(k=1:nz, i=i_w:i_e, g=1:nghost) local(hTr_bc, hTr_int)
            ! North inflow = v < 0 (southward into domain from north).
            if (v_layer(i, j_n + 1, k) < 0.0_wp) then
               hTr_bc = clamped_tr_n*h_layer(i, ny_total - g + 1, k)
               hTr(i, ny_total - g + 1, k) = hTr_bc
            else
               hTr_int = hTr(i, j_n, k)
               hTr(i, ny_total - g + 1, k) = hTr_int
            end if
         end do
      end if
   end subroutine fill_tracer_ghosts_meridional