function compute_total_tracer(hTr, areaT, nghost) result(total)
!! `Σ hTr(i,j,k)·areaT(i,j)` over PHYSICAL cells (ghosts excluded).
!! Same explicit-reduction pattern as `compute_total_h`.
real(wp), intent(in) :: hTr(:, :, :)
real(wp), intent(in) :: areaT(:, :)
integer, intent(in) :: nghost
real(wp) :: total
real(wp) :: acc
integer :: i, j, k, nx, ny, nz, i_lo, i_hi, j_lo, j_hi
nx = min(size(hTr, 1), size(areaT, 1))
ny = min(size(hTr, 2), size(areaT, 2))
nz = size(hTr, 3)
i_lo = nghost + 1
i_hi = nx - nghost
j_lo = nghost + 1
j_hi = ny - nghost
acc = 0.0_wp
!$acc parallel loop collapse(3) reduction(+:acc) present(hTr, areaT)
do k = 1, nz
do j = j_lo, j_hi
do i = i_lo, i_hi
acc = acc + hTr(i, j, k)*areaT(i, j)
end do
end do
end do
total = acc
end function compute_total_tracer