STATISTICS: Fix bug in integrating the injected energy and rate.

The injected energy and rate were added to the global array within the
loop over the blocks, essentially multiplying the energy by the number
of blocks for each process. This fix moves the injected energy
accounting out of the loop over the blocks.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2024-05-24 18:28:49 -03:00
parent 403a1e2f3f
commit 9ae03a4998

View File

@ -1199,13 +1199,6 @@ module statistics
end if ! track conservation
! sum up the injected energy and injection rate
!
if (forcing_enabled) then
lint(29) = einj
lint(30) = rinj
end if
gint = gint + lint
gavg = gavg + lavg
gmin = min(gmin, lmin)
@ -1217,6 +1210,13 @@ module statistics
work_in_use(nt) = .false.
!$omp end parallel
! sum up the injected energy and injection rate
!
if (forcing_enabled) then
gint(29) = gint(29) + einj
gint(30) = gint(30) + rinj
end if
#ifdef MPI
! sum the integral array from all processes
!