From c7859d6c7b43b88fea537c21a67f30ad6825491d Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Fri, 22 Apr 2022 12:44:37 +0200
Subject: [PATCH] [test][freeflow] Use Dumux::initialize

---
 test/freeflow/navierstokes/angeli/main.cc              | 8 +++++---
 test/freeflow/navierstokes/channel/1d/main.cc          | 6 ++++--
 test/freeflow/navierstokes/channel/2d/main.cc          | 6 ++++--
 test/freeflow/navierstokes/channel/3d/main.cc          | 6 ++++--
 test/freeflow/navierstokes/channel/pipe/main.cc        | 6 ++++--
 test/freeflow/navierstokes/donea/main.cc               | 6 ++++--
 test/freeflow/navierstokes/donea/main_momentum.cc      | 5 ++++-
 test/freeflow/navierstokes/kovasznay/main.cc           | 6 ++++--
 test/freeflow/navierstokes/periodic/main.cc            | 6 ++++--
 test/freeflow/navierstokes/sincos/main.cc              | 6 ++++--
 test/freeflow/navierstokesnc/channel/main.cc           | 6 ++++--
 test/freeflow/navierstokesnc/densitydrivenflow/main.cc | 6 ++++--
 test/freeflow/navierstokesnc/maxwellstefan/main.cc     | 6 ++++--
 test/freeflow/rans/main.cc                             | 6 ++++--
 test/freeflow/ransnc/main.cc                           | 6 ++++--
 test/freeflow/shallowwater/bowl/main.cc                | 6 ++++--
 test/freeflow/shallowwater/dambreak/main.cc            | 8 ++++----
 test/freeflow/shallowwater/poiseuilleflow/main.cc      | 5 ++++-
 test/freeflow/shallowwater/roughchannel/main.cc        | 6 ++++--
 19 files changed, 77 insertions(+), 39 deletions(-)

diff --git a/test/freeflow/navierstokes/angeli/main.cc b/test/freeflow/navierstokes/angeli/main.cc
index 1911467ee6..6fc2168be6 100644
--- a/test/freeflow/navierstokes/angeli/main.cc
+++ b/test/freeflow/navierstokes/angeli/main.cc
@@ -32,6 +32,8 @@
 
 #include <dune/common/parallel/mpihelper.hh>
 #include <dune/common/timer.hh>
+
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -59,9 +61,9 @@ int main(int argc, char** argv)
     using MomentumTypeTag = Properties::TTag::AngeliTestMomentum;
     using MassTypeTag = Properties::TTag::AngeliTestMass;
 
-
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/navierstokes/channel/1d/main.cc b/test/freeflow/navierstokes/channel/1d/main.cc
index a6c9d6bd91..3846f43136 100644
--- a/test/freeflow/navierstokes/channel/1d/main.cc
+++ b/test/freeflow/navierstokes/channel/1d/main.cc
@@ -29,6 +29,7 @@
 #include <dune/common/parallel/mpihelper.hh>
 #include <dune/common/timer.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -56,8 +57,9 @@ int main(int argc, char** argv)
     using MomentumTypeTag = Properties::TTag::NavierStokesAnalyticMomentum;
     using MassTypeTag = Properties::TTag::NavierStokesAnalyticMass;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/navierstokes/channel/2d/main.cc b/test/freeflow/navierstokes/channel/2d/main.cc
index bf11543f8f..990ff82dfc 100644
--- a/test/freeflow/navierstokes/channel/2d/main.cc
+++ b/test/freeflow/navierstokes/channel/2d/main.cc
@@ -34,6 +34,7 @@
 #include <dune/common/parallel/mpihelper.hh>
 #include <dune/common/timer.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -60,8 +61,9 @@ int main(int argc, char** argv)
     using MomentumTypeTag = Properties::TTag::ChannelTestMomentum;
     using MassTypeTag = Properties::TTag::ChannelTestMass;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/navierstokes/channel/3d/main.cc b/test/freeflow/navierstokes/channel/3d/main.cc
index 4a3e6912a1..a01eb6b322 100644
--- a/test/freeflow/navierstokes/channel/3d/main.cc
+++ b/test/freeflow/navierstokes/channel/3d/main.cc
@@ -30,6 +30,7 @@
 #include <dune/common/parallel/mpihelper.hh>
 #include <dune/common/timer.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -56,8 +57,9 @@ int main(int argc, char** argv)
     using MomentumTypeTag = Properties::TTag::ThreeDChannelTestMomentum;
     using MassTypeTag = Properties::TTag::ThreeDChannelTestMass;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/navierstokes/channel/pipe/main.cc b/test/freeflow/navierstokes/channel/pipe/main.cc
index ca190e39c3..5931fd3068 100644
--- a/test/freeflow/navierstokes/channel/pipe/main.cc
+++ b/test/freeflow/navierstokes/channel/pipe/main.cc
@@ -24,6 +24,7 @@
 #include <dune/common/parallel/mpihelper.hh>
 #include <dune/common/float_cmp.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/properties.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/partial.hh>
@@ -57,8 +58,9 @@ int main(int argc, char** argv)
     using MomentumTypeTag = Properties::TTag::PipeFlowMomentum;
     using MassTypeTag = Properties::TTag::PipeFlowMass;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // parse command line arguments and input file
     Parameters::init(argc, argv);
diff --git a/test/freeflow/navierstokes/donea/main.cc b/test/freeflow/navierstokes/donea/main.cc
index 7986ac5af9..b73053a1f0 100644
--- a/test/freeflow/navierstokes/donea/main.cc
+++ b/test/freeflow/navierstokes/donea/main.cc
@@ -30,6 +30,7 @@
 #include <dune/common/parallel/mpihelper.hh>
 #include <dune/common/timer.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -56,8 +57,9 @@ int main(int argc, char** argv)
     using MomentumTypeTag = Properties::TTag::DoneaTestMomentum;
     using MassTypeTag = Properties::TTag::DoneaTestMass;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/navierstokes/donea/main_momentum.cc b/test/freeflow/navierstokes/donea/main_momentum.cc
index c9248abf19..531a4d77b7 100644
--- a/test/freeflow/navierstokes/donea/main_momentum.cc
+++ b/test/freeflow/navierstokes/donea/main_momentum.cc
@@ -27,6 +27,7 @@
 #include <iostream>
 #include <dune/common/parallel/mpihelper.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -88,7 +89,9 @@ int main(int argc, char** argv)
 
     using TypeTag = Properties::TTag::DoneaTestMomentum;
 
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     if (mpiHelper.rank() == 0)
         DumuxMessage::print(/*firstCall=*/true);
diff --git a/test/freeflow/navierstokes/kovasznay/main.cc b/test/freeflow/navierstokes/kovasznay/main.cc
index c8b054a9b2..bd183065ab 100644
--- a/test/freeflow/navierstokes/kovasznay/main.cc
+++ b/test/freeflow/navierstokes/kovasznay/main.cc
@@ -34,6 +34,7 @@
 
 #include <dumux/assembly/staggeredfvassembler.hh>
 #include <dumux/assembly/diffmethod.hh>
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -56,8 +57,9 @@ int main(int argc, char** argv)
     // define the type tag for this problem
     using TypeTag = Properties::TTag::KovasznayTest;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/navierstokes/periodic/main.cc b/test/freeflow/navierstokes/periodic/main.cc
index aa562e9e9b..5d16b04fb6 100644
--- a/test/freeflow/navierstokes/periodic/main.cc
+++ b/test/freeflow/navierstokes/periodic/main.cc
@@ -30,6 +30,7 @@
 #include <dune/common/parallel/mpihelper.hh>
 #include <dune/common/timer.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -55,8 +56,9 @@ int main(int argc, char** argv)
     using MomentumTypeTag = Properties::TTag::PeriodicTestMomentum;
     using MassTypeTag = Properties::TTag::PeriodicTestMass;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/navierstokes/sincos/main.cc b/test/freeflow/navierstokes/sincos/main.cc
index 563a6536b7..199d984b1f 100644
--- a/test/freeflow/navierstokes/sincos/main.cc
+++ b/test/freeflow/navierstokes/sincos/main.cc
@@ -33,6 +33,7 @@
 #include <dune/common/parallel/mpihelper.hh>
 #include <dune/common/timer.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -86,8 +87,9 @@ int main(int argc, char** argv)
     using MomentumTypeTag = Properties::TTag::SincosTestMomentum;
     using MassTypeTag = Properties::TTag::SincosTestMass;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/navierstokesnc/channel/main.cc b/test/freeflow/navierstokesnc/channel/main.cc
index c09c219c9b..c60a13c491 100644
--- a/test/freeflow/navierstokesnc/channel/main.cc
+++ b/test/freeflow/navierstokesnc/channel/main.cc
@@ -34,6 +34,7 @@
 
 #include <dumux/assembly/staggeredfvassembler.hh>
 #include <dumux/assembly/diffmethod.hh>
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -51,8 +52,9 @@ int main(int argc, char** argv)
     // define the type tag for this problem
     using TypeTag = Properties::TTag::ChannelNCTest;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/navierstokesnc/densitydrivenflow/main.cc b/test/freeflow/navierstokesnc/densitydrivenflow/main.cc
index b67b928577..73b5156314 100644
--- a/test/freeflow/navierstokesnc/densitydrivenflow/main.cc
+++ b/test/freeflow/navierstokesnc/densitydrivenflow/main.cc
@@ -34,6 +34,7 @@
 
 #include <dumux/assembly/staggeredfvassembler.hh>
 #include <dumux/assembly/diffmethod.hh>
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -51,8 +52,9 @@ int main(int argc, char** argv)
     // define the type tag for this problem
     using TypeTag = Properties::TTag::DensityDrivenFlow;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/navierstokesnc/maxwellstefan/main.cc b/test/freeflow/navierstokesnc/maxwellstefan/main.cc
index 85c094f25a..ab4d6a53f9 100644
--- a/test/freeflow/navierstokesnc/maxwellstefan/main.cc
+++ b/test/freeflow/navierstokesnc/maxwellstefan/main.cc
@@ -34,6 +34,7 @@
 
 #include <dumux/assembly/staggeredfvassembler.hh>
 #include <dumux/assembly/diffmethod.hh>
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -51,8 +52,9 @@ int main(int argc, char** argv)
     // define the type tag for this problem
     using TypeTag = Properties::TTag::MaxwellStefanNCTest;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/rans/main.cc b/test/freeflow/rans/main.cc
index 39e2a52fa7..9db95a1dbc 100644
--- a/test/freeflow/rans/main.cc
+++ b/test/freeflow/rans/main.cc
@@ -36,6 +36,7 @@
 
 #include <dumux/assembly/staggeredfvassembler.hh>
 #include <dumux/assembly/diffmethod.hh>
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -75,8 +76,9 @@ 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);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/ransnc/main.cc b/test/freeflow/ransnc/main.cc
index 518732f24b..130f2b7db3 100644
--- a/test/freeflow/ransnc/main.cc
+++ b/test/freeflow/ransnc/main.cc
@@ -34,6 +34,7 @@
 
 #include <dumux/assembly/staggeredfvassembler.hh>
 #include <dumux/assembly/diffmethod.hh>
+#include <dumux/common/initialize.hh>
 #include <dumux/common/dumuxmessage.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
@@ -73,8 +74,9 @@ 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);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/shallowwater/bowl/main.cc b/test/freeflow/shallowwater/bowl/main.cc
index 205b955904..8e86b68190 100644
--- a/test/freeflow/shallowwater/bowl/main.cc
+++ b/test/freeflow/shallowwater/bowl/main.cc
@@ -31,6 +31,7 @@
 #include <dune/grid/io/file/vtk.hh>
 #include <dumux/io/vtkoutputmodule.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/properties.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/dumuxmessage.hh>
@@ -130,8 +131,9 @@ int main(int argc, char** argv)
     // define the type tag for this problem
     using TypeTag = Properties::TTag::Bowl;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/shallowwater/dambreak/main.cc b/test/freeflow/shallowwater/dambreak/main.cc
index 3d9aa15439..e875a5ccb8 100644
--- a/test/freeflow/shallowwater/dambreak/main.cc
+++ b/test/freeflow/shallowwater/dambreak/main.cc
@@ -30,10 +30,9 @@
 #include <dune/common/version.hh>
 #include <dune/common/parallel/mpihelper.hh>
 #include <dune/common/timer.hh>
-#include <dune/grid/io/file/vtk.hh>
 #include <dumux/io/vtkoutputmodule.hh>
-#include <dune/istl/io.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/properties.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/dumuxmessage.hh>
@@ -64,8 +63,9 @@ int main(int argc, char** argv)
     // define the type tag for this problem
     using TypeTag = Properties::TTag::DamBreakWet;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
diff --git a/test/freeflow/shallowwater/poiseuilleflow/main.cc b/test/freeflow/shallowwater/poiseuilleflow/main.cc
index 8d31944398..33c3d9154e 100644
--- a/test/freeflow/shallowwater/poiseuilleflow/main.cc
+++ b/test/freeflow/shallowwater/poiseuilleflow/main.cc
@@ -22,6 +22,7 @@
 
 #include <dune/common/parallel/mpihelper.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/properties.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/dumuxmessage.hh>
@@ -42,7 +43,9 @@ int main(int argc, char** argv)
 {
     using namespace Dumux;
 
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // parse command line arguments and input file
     Parameters::init(argc, argv);
diff --git a/test/freeflow/shallowwater/roughchannel/main.cc b/test/freeflow/shallowwater/roughchannel/main.cc
index a1c1201043..37259eddcd 100644
--- a/test/freeflow/shallowwater/roughchannel/main.cc
+++ b/test/freeflow/shallowwater/roughchannel/main.cc
@@ -31,6 +31,7 @@
 #include <dune/grid/io/file/vtk.hh>
 #include <dumux/io/vtkoutputmodule.hh>
 
+#include <dumux/common/initialize.hh>
 #include <dumux/common/properties.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/dumuxmessage.hh>
@@ -54,8 +55,9 @@ int main(int argc, char** argv)
     // define the type tag for this problem
     using TypeTag = Properties::TTag::RoughChannel;
 
-    // initialize MPI, finalize is done automatically on exit
-    const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
+    // maybe initialize MPI and/or multithreading backend
+    initialize(argc, argv);
+    const auto& mpiHelper = Dune::MPIHelper::instance();
 
     // print dumux start message
     if (mpiHelper.rank() == 0)
-- 
GitLab