From 9ae03a499857fa6af234a9c5251374322e8c141d Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Fri, 24 May 2024 18:28:49 -0300 Subject: [PATCH] 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 --- sources/statistics.F90 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sources/statistics.F90 b/sources/statistics.F90 index 50cbbbc..c3e9556 100644 --- a/sources/statistics.F90 +++ b/sources/statistics.F90 @@ -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 !