pure subroutine relax_band_y_impl(hTr, h_layer, nx_total, ny_total, nz, &
i0, i1, wall_face, band, side, strength, C_bc, dt, budget)
!! Cosine-ramp tracer relaxation in a south/north sponge band.
!! Mirror of `relax_band_x_impl` for the y-direction; see its
!! docstring for the optional `budget` mirror (PR-23).
integer, intent(in) :: nx_total, ny_total, nz, i0, i1, wall_face, band, side
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) :: strength, C_bc, dt
real(wp), intent(inout), optional :: budget(nx_total, ny_total, nz)
integer :: k, i, d, jj
real(wp) :: new_val
logical :: has_budget
has_budget = present(budget)
do concurrent(k=1:nz, i=i0:i1, d=0:band - 1) local(jj, new_val)
if (side > 0) then
jj = wall_face + d
else
jj = wall_face - d - 1
end if
new_val = relax_one(hTr(i, jj, k), C_bc*h_layer(i, jj, k), &
strength, d, band, dt)
if (has_budget) budget(i, jj, k) = budget(i, jj, k) + (new_val - hTr(i, jj, k))
hTr(i, jj, k) = new_val
end do
end subroutine relax_band_y_impl