From 0ad6f71f8c6b57946f6ca039b6980f29e97a6f14 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Wed, 10 Nov 2021 16:54:19 +0100
Subject: [PATCH] [test] Adjust three tests to use Dumux::initialize

---
 test/porousmediumflow/1p/incompressible/main.cc | 9 +++++++--
 test/porousmediumflow/3p3c/infiltration/main.cc | 9 +++++++--
 test/porousmediumflow/richards/lens/main.cc     | 9 +++++++--
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/test/porousmediumflow/1p/incompressible/main.cc b/test/porousmediumflow/1p/incompressible/main.cc
index 111dc5a7bf..6c7ab96175 100644
--- a/test/porousmediumflow/1p/incompressible/main.cc
+++ b/test/porousmediumflow/1p/incompressible/main.cc
@@ -38,6 +38,7 @@
 #include <dumux/common/properties.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/dumuxmessage.hh>
+#include <dumux/common/initialize.hh>
 
 #include <dumux/io/vtkoutputmodule.hh>
 #include <dumux/io/grid/gridmanager.hh>
@@ -82,8 +83,12 @@ int main(int argc, char** argv)
 
     using TypeTag = Properties::TTag::TYPETAG;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // initialize Dumux (parallel helpers)
+    // always call this before any other code
+    Dumux::initialize(argc, argv);
+
+    // get an instance of the MPI helper
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/porousmediumflow/3p3c/infiltration/main.cc b/test/porousmediumflow/3p3c/infiltration/main.cc
index 6580f1b414..f2facd1039 100644
--- a/test/porousmediumflow/3p3c/infiltration/main.cc
+++ b/test/porousmediumflow/3p3c/infiltration/main.cc
@@ -31,6 +31,7 @@
 #include <dumux/common/properties.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/dumuxmessage.hh>
+#include <dumux/common/initialize.hh>
 #include <dumux/common/timeloop.hh>
 
 #include <dumux/linear/amgbackend.hh>
@@ -55,8 +56,12 @@ int main(int argc, char** argv)
     ////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // initialize Dumux (parallel helpers)
+    // always call this before any other code
+    Dumux::initialize(argc, argv);
+
+    // get an instance of the MPI helper
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/porousmediumflow/richards/lens/main.cc b/test/porousmediumflow/richards/lens/main.cc
index 0c0f3aafd7..cdf033b772 100644
--- a/test/porousmediumflow/richards/lens/main.cc
+++ b/test/porousmediumflow/richards/lens/main.cc
@@ -36,6 +36,7 @@
 #include <dumux/common/properties.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/dumuxmessage.hh>
+#include <dumux/common/initialize.hh>
 #include <dumux/linear/linearsolvertraits.hh>
 
 #if DUNE_VERSION_GTE(DUNE_ISTL,2,8)
@@ -68,8 +69,12 @@ int main(int argc, char** argv)
     // define the type tag for this problem
     using TypeTag = Properties::TTag::TYPETAG;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // initialize Dumux (parallel helpers)
+    // always call this before any other code
+    Dumux::initialize(argc, argv);
+
+    // get an instance of the MPI helper
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
-- 
GitLab