From 380e4c8d7e532d0335b64565fcabb7255fea22ef Mon Sep 17 00:00:00 2001
From: Grzegorz Kowal <grzegorz@amuncode.org>
Date: Tue, 9 Nov 2021 15:59:34 -0300
Subject: [PATCH] EVOLUTION: Synchronize status among processes in
 update_variables().

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
---
 sources/evolution.F90 | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sources/evolution.F90 b/sources/evolution.F90
index 758def9..6ddcec3 100644
--- a/sources/evolution.F90
+++ b/sources/evolution.F90
@@ -3625,6 +3625,9 @@ module evolution
     use boundaries, only : boundary_variables
     use equations , only : update_primitive_variables
     use equations , only : fix_unphysical_cells, correct_unphysical_states
+#ifdef MPI
+    use mpitools  , only : reduce_maximum
+#endif /* MPI */
     use shapes    , only : update_shapes
 
     implicit none
@@ -3655,6 +3658,12 @@ module evolution
       pdata => pdata%next
     end do
 
+    100 continue
+#ifdef MPI
+    call reduce_maximum(status)
+#endif /* MPI */
+    if (status /= 0) go to 200
+
     call boundary_variables(tm, dtm)
 
     pdata => list_data
@@ -3694,7 +3703,7 @@ module evolution
       end do
     end if
 
-    100 continue
+    200 continue
 
 #ifdef PROFILE
     call stop_timer(imv)