pure subroutine fill_ghost_west_sign(hTr, h_layer, u_layer, &
nx_total, ny_total, nz, &
i_w, j0, j1, nghost, clamped_tr_w)
!! Sign-switch ghost fill for the west edge.
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) :: u_layer(nx_total + 1, ny_total, nz)
integer, intent(in) :: i_w, j0, j1
real(wp), intent(in) :: clamped_tr_w
integer :: j, k, g
real(wp) :: hTr_bc, hTr_int
do concurrent(k=1:nz, j=j0:j1, g=1:nghost) local(hTr_bc, hTr_int)
if (u_layer(i_w, j, k) > 0.0_wp) then
hTr_bc = clamped_tr_w*h_layer(g, j, k)
hTr(g, j, k) = hTr_bc
else
hTr_int = hTr(i_w, j, k)
hTr(g, j, k) = hTr_int
end if
end do
end subroutine fill_ghost_west_sign