From 5a326c86b1adef735320c009acfce0f90f88624a Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Thu, 28 Jun 2018 08:03:28 +0200 Subject: [PATCH] [test] Use new grid managers --- dumux/common/start.hh | 12 +- dumux/freeflow/compositional/CMakeLists.txt | 2 + .../freeflow/rans/twoeq/komega/CMakeLists.txt | 1 - dumux/io/CMakeLists.txt | 5 +- dumux/io/grid/CMakeLists.txt | 8 + dumux/io/{ => grid}/cakegridcreator.hh | 28 +- dumux/io/{ => grid}/cpgridcreator.hh | 0 dumux/io/{ => grid}/subgridgridcreator.hh | 0 .../navierstokes/angelitestproblem.hh | 2 + .../navierstokes/channeltestproblem.hh | 2 + .../navierstokes/closedsystemtestproblem.hh | 2 + .../freeflow/navierstokes/doneatestproblem.hh | 2 + .../navierstokes/kovasznaytestproblem.hh | 2 + .../navierstokesanalyticproblem.hh | 2 + .../navierstokes/stokeschannel3dproblem.hh | 2 + test/freeflow/navierstokes/test_angeli.cc | 8 +- test/freeflow/navierstokes/test_channel.cc | 8 +- .../navierstokes/test_closedsystem.cc | 8 +- test/freeflow/navierstokes/test_donea.cc | 11 +- test/freeflow/navierstokes/test_kovasznay.cc | 8 +- .../navierstokes/test_navierstokes_1d.cc | 8 +- .../navierstokes/test_stokes_channel_3d.cc | 8 +- .../navierstokesnc/channeltestproblem.hh | 2 + .../navierstokesnc/densityflowproblem.hh | 2 + .../navierstokesnc/msfreeflowtestproblem.hh | 2 + test/freeflow/navierstokesnc/test_channel.cc | 8 +- .../navierstokesnc/test_densitydrivenflow.cc | 8 +- .../navierstokesnc/test_msfreeflow.cc | 8 +- test/freeflow/rans/pipelauferproblem.hh | 2 + test/freeflow/rans/test_pipe_laufer.cc | 8 +- test/freeflow/ransnc/flatplatetestproblem.hh | 2 + test/freeflow/ransnc/test_flatplate.cc | 8 +- test/geomechanics/elastic/problem.hh | 1 + test/geomechanics/elastic/test_elastic.cc | 8 +- test/geomechanics/poroelastic/problem.hh | 1 + .../poroelastic/test_poroelastic.cc | 8 +- ...ridcreatortests.hh => gridmanagertests.hh} | 12 +- test/io/gridcreator/test_gridcreator_cake.cc | 12 +- .../test_gridcreator_dgf_e_markers.cc | 4 +- .../gridcreator/test_gridcreator_gmsh_3d.cc | 4 +- .../test_gridcreator_gmsh_e_markers.cc | 4 +- .../gridcreator/test_gridcreator_subgrid.cc | 22 +- .../1p/implicit/1pniconductionproblem.hh | 3 +- .../1p/implicit/1pniconvectionproblem.hh | 3 +- .../1p/implicit/1ptestproblem.hh | 2 + .../1p/implicit/compressible/problem.hh | 2 + .../1p/implicit/compressible/test_1p.cc | 8 +- .../compressible/test_1p_stationary.cc | 8 +- .../1p/implicit/incompressible/problem.hh | 2 + .../1p/implicit/incompressible/test_1pfv.cc | 10 +- .../pointsources/1psingularityproblem.hh | 2 + .../pointsources/test_1pfv_pointsources.cc | 8 +- .../test_1pfv_pointsources_timedependent.cc | 8 +- .../porousmediumflow/1p/implicit/test_1pfv.cc | 8 +- .../1p/implicit/test_1pfv_fracture2d3d.cc | 8 +- .../1p/implicit/test_1pfv_network1d3d.cc | 8 +- .../1p/implicit/test_1pnifv.cc | 8 +- .../1p/sequential/test_1pproblem.hh | 2 + .../1p/sequential/test_diffusion.cc | 8 +- .../1p/sequential/test_diffusion3d.cc | 9 +- .../1p/sequential/test_diffusionproblem3d.hh | 8 + .../1pnc/implicit/1p2cniconductionproblem.hh | 5 + .../1pnc/implicit/1p2cniconvectionproblem.hh | 5 + .../1pnc/implicit/1p2ctestproblem.hh | 5 + .../1pnc/implicit/test_1p2c_fv.cc | 306 ++++++++--------- .../implicit/test_1p2cni_conduction_fv.cc | 308 +++++++++--------- .../implicit/test_1p2cni_convection_fv.cc | 308 +++++++++--------- .../1pncmin/implicit/test_1pncminni_fv.cc | 8 +- .../1pncmin/implicit/thermochemproblem.hh | 2 + .../implicit/adaptive/test_2p_adaptive_fv.cc | 20 +- .../2p/implicit/boxdfm/problem.hh | 8 + .../2p/implicit/boxdfm/test_2pboxdfm.cc | 8 +- .../2p/implicit/cornerpoint/problem.hh | 7 +- .../2p/implicit/cornerpoint/spatialparams.hh | 21 +- .../cornerpoint/test_2p_cornerpoint.cc | 8 +- .../implicit/fracture/test_2p_fracture_fv.cc | 8 +- .../2p/implicit/incompressible/problem.hh | 2 + .../2p/implicit/incompressible/test_2p_fv.cc | 8 +- .../2p/implicit/nonisothermal/problem.hh | 8 + .../2p/implicit/nonisothermal/test_2pni_fv.cc | 8 +- .../2p/sequential/test_3d2pproblem.hh | 3 + .../sequential/test_impesadaptiveproblem.hh | 3 + .../2p/sequential/test_impesproblem.hh | 7 +- .../2p/sequential/test_mpfa2pproblem.hh | 5 + .../2p/sequential/test_transportproblem.hh | 1 + .../2p1c/implicit/steaminjectionproblem.hh | 2 + .../2p1c/implicit/test_2p1c_fv.cc | 270 +++++++-------- .../2p2c/implicit/injectionproblem.hh | 2 + .../mpnccomparison/test_2p2c_comparison_fv.cc | 8 +- .../2p2c/implicit/test_2p2c_fv.cc | 8 +- .../2p2c/implicit/waterairproblem.hh | 2 + .../sequential/test_adaptive2p2c2dproblem.hh | 5 + .../sequential/test_adaptive2p2c3dproblem.hh | 5 + .../2p2c/sequential/test_dec2p2cproblem.hh | 2 + .../test_multiphysics2p2cproblem.hh | 2 + .../2pnc/implicit/2pncdiffusionproblem.hh | 2 + .../2pnc/implicit/fuelcellproblem.hh | 2 + .../2pnc/implicit/test_2pnc_fv.cc | 8 +- .../2pnc/implicit/test_cc2pnc_diffusion.cc | 8 +- .../2pncmin/implicit/dissolutionproblem.hh | 2 + .../2pncmin/implicit/test_2pncmin_fv.cc | 8 +- .../3p/implicit/3pniconductionproblem.hh | 3 +- .../3p/implicit/3pniconvectionproblem.hh | 3 +- .../3p/implicit/test_3p_fv.cc | 8 +- .../3p/implicit/test_3pni_fv_conduction.cc | 8 +- .../3p/implicit/test_3pni_fv_convection.cc | 8 +- .../3p3c/implicit/columnxylolproblem.hh | 2 + .../3p3c/implicit/infiltration3p3cproblem.hh | 2 + .../3p3c/implicit/kuevetteproblem.hh | 1 + .../3p3c/implicit/test_3p3c_fv.cc | 8 +- .../implicit/3pwateroilsagdproblem.hh | 2 + .../3pwateroil/implicit/test_box3pwateroil.cc | 8 +- .../co2/implicit/heterogeneousproblem.hh | 17 +- .../heterogeneousspatialparameters.hh | 26 +- .../co2/implicit/test_co2_fv.cc | 14 +- .../2p2ccomparison/mpnc_comparison_problem.hh | 1 + .../2p2ccomparison/test_mpnc_comparison_fv.cc | 8 +- .../mpnc/implicit/combustionproblem1c.hh | 2 + .../implicit/evaporationatmosphereproblem.hh | 2 + .../mpnc/implicit/obstacleproblem.hh | 1 + .../mpnc/implicit/test_boxmpnckinetic.cc | 8 +- .../implicit/test_boxmpncthermalnonequil.cc | 8 +- .../mpnc/implicit/test_mpnc_obstacle_fv.cc | 8 +- .../implicit/richardsanalyticalproblem.hh | 2 + .../richards/implicit/richardslensproblem.hh | 5 +- .../implicit/richardslensspatialparams.hh | 19 +- .../implicit/richardsniconductionproblem.hh | 3 +- .../implicit/richardsniconvectionproblem.hh | 3 +- .../implicit/richardsnievaporationproblem.hh | 3 +- .../implicit/test_ccrichardsanalytical.cc | 8 +- .../richards/implicit/test_richardslens_fv.cc | 39 +-- .../implicit/test_richardsniconduction_fv.cc | 8 +- .../implicit/test_richardsniconvection_fv.cc | 8 +- .../implicit/test_richardsnievaporation_fv.cc | 8 +- .../implicit/richardswelltracerproblem.hh | 2 + .../richardsnc/implicit/test_richardsnc_fv.cc | 8 +- .../tracer/1ptracer/1ptestproblem.hh | 2 + .../tracer/1ptracer/test_cctracer.cc | 12 +- .../tracer/1ptracer/tracertestproblem.hh | 2 + .../tracer/constvel/test_tracer.cc | 8 +- .../tracer/constvel/tracertestproblem.hh | 2 + .../multicomp/maxwellstefantestproblem.hh | 2 + .../multicomp/test_tracer_maxwellstefan.cc | 8 +- tutorial/ex1/exercise1.cc | 8 +- tutorial/ex1/exercise1_2p.cc | 8 +- tutorial/ex1/exercise1_2p2c.cc | 8 +- tutorial/ex2/exercise2.cc | 8 +- tutorial/ex3/exercise3.cc | 8 +- tutorial/solution/ex1/exercise1_2p2c.cc | 8 +- .../solution/ex1/exercise1_2pni_solution.cc | 8 +- tutorial/solution/ex2/exercise2_solution.cc | 8 +- 151 files changed, 1143 insertions(+), 999 deletions(-) create mode 100644 dumux/io/grid/CMakeLists.txt rename dumux/io/{ => grid}/cakegridcreator.hh (96%) rename dumux/io/{ => grid}/cpgridcreator.hh (100%) rename dumux/io/{ => grid}/subgridgridcreator.hh (100%) rename test/io/gridcreator/{gridcreatortests.hh => gridmanagertests.hh} (97%) diff --git a/dumux/common/start.hh b/dumux/common/start.hh index 815a937a3e..2da8289117 100644 --- a/dumux/common/start.hh +++ b/dumux/common/start.hh @@ -21,8 +21,8 @@ * \ingroup Common * \brief Provides a few default main functions for convenience. */ -#ifndef DUMUX_START_HH -#define DUMUX_START_HH +#ifndef DUMUX_COMMON_START_HH +#define DUMUX_COMMON_START_HH #include <ctime> #include <iostream> @@ -34,6 +34,7 @@ #include <dumux/common/parameters.hh> #include <dumux/common/dumuxmessage.hh> #include <dumux/common/defaultusagemessage.hh> +#include <dumux/io/grid/gridmanager.hh> #warning "start.hh is deprecated. Use new style main files see e.g. /test/porousmediumflow/1p." @@ -64,7 +65,6 @@ int start_(int argc, { // some aliases for better readability using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager); @@ -86,8 +86,8 @@ int start_(int argc, // try to create a grid (from the given grid file or the input file) ///////////////////////////////////////////////////////////////////// - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); ////////////////////////////////////////////////////////////////////// // run the simulation @@ -108,7 +108,7 @@ int start_(int argc, // instantiate and run the problem TimeManager timeManager; - Problem problem(timeManager, GridCreator::grid()); + Problem problem(timeManager, gridManager.grid()); timeManager.init(problem, restartTime, dt, tEnd, restart); timeManager.run(); diff --git a/dumux/freeflow/compositional/CMakeLists.txt b/dumux/freeflow/compositional/CMakeLists.txt index ddd32e167c..11209cfdcd 100644 --- a/dumux/freeflow/compositional/CMakeLists.txt +++ b/dumux/freeflow/compositional/CMakeLists.txt @@ -3,6 +3,8 @@ add_subdirectory(staggered) install(FILES fluxvariables.hh indices.hh +kepsilonncmodel.hh +komegancmodel.hh localresidual.hh lowrekepsilonncmodel.hh navierstokesncmodel.hh diff --git a/dumux/freeflow/rans/twoeq/komega/CMakeLists.txt b/dumux/freeflow/rans/twoeq/komega/CMakeLists.txt index e6ef83c51b..e6d5c4dc03 100644 --- a/dumux/freeflow/rans/twoeq/komega/CMakeLists.txt +++ b/dumux/freeflow/rans/twoeq/komega/CMakeLists.txt @@ -5,7 +5,6 @@ fluxvariables.hh indices.hh localresidual.hh model.hh -models.hh problem.hh volumevariables.hh vtkoutputfields.hh diff --git a/dumux/io/CMakeLists.txt b/dumux/io/CMakeLists.txt index d617dc5ef7..9ed3307f44 100644 --- a/dumux/io/CMakeLists.txt +++ b/dumux/io/CMakeLists.txt @@ -1,8 +1,8 @@ +add_subdirectory(grid) + install(FILES adaptivegridrestart.hh -cakegridcreator.hh container.hh -cpgridcreator.hh defaultvtkoutputfields.hh gnuplotinterface.hh gridcreator.hh @@ -13,7 +13,6 @@ plotthermalconductivitymodel.hh pointcloudvtkwriter.hh restart.hh staggeredvtkoutputmodule.hh -subgridgridcreator.hh vtkfunction.hh vtkmultiwriter.hh vtknestedfunction.hh diff --git a/dumux/io/grid/CMakeLists.txt b/dumux/io/grid/CMakeLists.txt new file mode 100644 index 0000000000..4b60d65fdd --- /dev/null +++ b/dumux/io/grid/CMakeLists.txt @@ -0,0 +1,8 @@ +install(FILES +cakegridcreator.hh +cpgridcreator.hh +gmshgriddatahandle.hh +griddata.hh +gridmanager.hh +subgridgridcreator.hh +DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/io/grid) diff --git a/dumux/io/cakegridcreator.hh b/dumux/io/grid/cakegridcreator.hh similarity index 96% rename from dumux/io/cakegridcreator.hh rename to dumux/io/grid/cakegridcreator.hh index 08b92566f6..eb787e12af 100644 --- a/dumux/io/cakegridcreator.hh +++ b/dumux/io/grid/cakegridcreator.hh @@ -58,7 +58,7 @@ public: /*! * \brief Make the grid. */ - static void makeGrid(const std::string& modelParamGroup = "") + void init(const std::string& modelParamGroup = "") { static_assert(dim == 2 || dim == 3, "The CakeGridCreator is only implemented for 2D and 3D."); @@ -70,6 +70,7 @@ public: createVectors(polarCoordinates, indices, modelParamGroup, verbose); gridPtr() = createCakeGrid(polarCoordinates, indices, modelParamGroup, verbose); + loadBalance(); } /*! @@ -264,10 +265,10 @@ public: * \param polarCoordinates Vector containing radial, angular and axial coordinates (in this order) * \param indices Indices specifing the radial, angular and axial direction (in this order) */ - static std::shared_ptr<Grid> createCakeGrid(std::array<std::vector<Scalar>, dim> &polarCoordinates, - Dune::FieldVector<int, dim> &indices, - const std::string& modelParamGroup, - bool verbose = false) + std::unique_ptr<Grid> createCakeGrid(std::array<std::vector<Scalar>, dim> &polarCoordinates, + Dune::FieldVector<int, dim> &indices, + const std::string& modelParamGroup, + bool verbose = false) { std::vector<Scalar> dR = polarCoordinates[0]; std::vector<Scalar> dA = polarCoordinates[1]; @@ -446,14 +447,13 @@ public: } } // return the grid pointer - return std::shared_ptr<Grid>(gridFactory.createGrid()); - + return std::unique_ptr<Grid>(gridFactory.createGrid()); } /*! * \brief Returns a reference to the grid. */ - static Grid &grid() + Grid& grid() { return *gridPtr(); } @@ -462,19 +462,23 @@ public: * \brief Distributes the grid on all processes of a parallel * computation. */ - static void loadBalance() + void loadBalance() { gridPtr()->loadBalance(); } +protected: + /*! * \brief Returns a reference to the shared pointer to the grid. */ - static GridPointer &gridPtr() + GridPointer& gridPtr() { - static GridPointer cakeGrid; - return cakeGrid; + return cakeGrid_; } + +private: + GridPointer cakeGrid_; }; } // end namespace Dumux diff --git a/dumux/io/cpgridcreator.hh b/dumux/io/grid/cpgridcreator.hh similarity index 100% rename from dumux/io/cpgridcreator.hh rename to dumux/io/grid/cpgridcreator.hh diff --git a/dumux/io/subgridgridcreator.hh b/dumux/io/grid/subgridgridcreator.hh similarity index 100% rename from dumux/io/subgridgridcreator.hh rename to dumux/io/grid/subgridgridcreator.hh diff --git a/test/freeflow/navierstokes/angelitestproblem.hh b/test/freeflow/navierstokes/angelitestproblem.hh index 2febcd530f..fe3ef82212 100644 --- a/test/freeflow/navierstokes/angelitestproblem.hh +++ b/test/freeflow/navierstokes/angelitestproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_ANGELI_TEST_PROBLEM_HH #define DUMUX_ANGELI_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/components/constant.hh> diff --git a/test/freeflow/navierstokes/channeltestproblem.hh b/test/freeflow/navierstokes/channeltestproblem.hh index 2c45fdd6da..cf323d7905 100644 --- a/test/freeflow/navierstokes/channeltestproblem.hh +++ b/test/freeflow/navierstokes/channeltestproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_CHANNEL_TEST_PROBLEM_HH #define DUMUX_CHANNEL_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/components/simpleh2o.hh> #include <dumux/material/components/constant.hh> diff --git a/test/freeflow/navierstokes/closedsystemtestproblem.hh b/test/freeflow/navierstokes/closedsystemtestproblem.hh index 0fa6beb09a..1030ac73c7 100644 --- a/test/freeflow/navierstokes/closedsystemtestproblem.hh +++ b/test/freeflow/navierstokes/closedsystemtestproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_CLOSEDSYSTEM_TEST_PROBLEM_HH #define DUMUX_CLOSEDSYSTEM_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/components/constant.hh> diff --git a/test/freeflow/navierstokes/doneatestproblem.hh b/test/freeflow/navierstokes/doneatestproblem.hh index 451a2ac32b..74b67e2a6c 100644 --- a/test/freeflow/navierstokes/doneatestproblem.hh +++ b/test/freeflow/navierstokes/doneatestproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_DONEA_TEST_PROBLEM_HH #define DUMUX_DONEA_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/components/constant.hh> diff --git a/test/freeflow/navierstokes/kovasznaytestproblem.hh b/test/freeflow/navierstokes/kovasznaytestproblem.hh index 6bc2bfce61..e56c8a48bc 100644 --- a/test/freeflow/navierstokes/kovasznaytestproblem.hh +++ b/test/freeflow/navierstokes/kovasznaytestproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_KOVASZNAY_TEST_PROBLEM_HH #define DUMUX_KOVASZNAY_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/components/constant.hh> diff --git a/test/freeflow/navierstokes/navierstokesanalyticproblem.hh b/test/freeflow/navierstokes/navierstokesanalyticproblem.hh index 23305e9466..38833db5d1 100644 --- a/test/freeflow/navierstokes/navierstokesanalyticproblem.hh +++ b/test/freeflow/navierstokes/navierstokesanalyticproblem.hh @@ -26,6 +26,8 @@ #ifndef DUMUX_DONEA_TEST_PROBLEM_HH #define DUMUX_DONEA_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/components/constant.hh> #include <dumux/material/fluidsystems/1pliquid.hh> diff --git a/test/freeflow/navierstokes/stokeschannel3dproblem.hh b/test/freeflow/navierstokes/stokeschannel3dproblem.hh index b757d830a9..e82f8f0c31 100644 --- a/test/freeflow/navierstokes/stokeschannel3dproblem.hh +++ b/test/freeflow/navierstokes/stokeschannel3dproblem.hh @@ -28,6 +28,8 @@ #ifndef DUMUX_3D_CHANNEL_PROBLEM_HH #define DUMUX_3D_CHANNEL_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/components/constant.hh> diff --git a/test/freeflow/navierstokes/test_angeli.cc b/test/freeflow/navierstokes/test_angeli.cc index 8ced7b4870..707536c3c4 100644 --- a/test/freeflow/navierstokes/test_angeli.cc +++ b/test/freeflow/navierstokes/test_angeli.cc @@ -50,6 +50,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -101,16 +102,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/freeflow/navierstokes/test_channel.cc b/test/freeflow/navierstokes/test_channel.cc index 39f706fb94..6717818d77 100644 --- a/test/freeflow/navierstokes/test_channel.cc +++ b/test/freeflow/navierstokes/test_channel.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include <dumux/freeflow/navierstokes/staggered/fluxoversurface.hh> @@ -102,16 +103,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/freeflow/navierstokes/test_closedsystem.cc b/test/freeflow/navierstokes/test_closedsystem.cc index 0fdd3bd631..a29b3bb476 100644 --- a/test/freeflow/navierstokes/test_closedsystem.cc +++ b/test/freeflow/navierstokes/test_closedsystem.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -100,16 +101,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/freeflow/navierstokes/test_donea.cc b/test/freeflow/navierstokes/test_donea.cc index 5e062798d6..7b168e83ee 100644 --- a/test/freeflow/navierstokes/test_donea.cc +++ b/test/freeflow/navierstokes/test_donea.cc @@ -51,6 +51,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include <dumux/io/grid/gridmanager.hh> @@ -104,18 +105,16 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridManager = Dumux::GridManager<typename GET_PROP_TYPE(TypeTag, Grid), GET_PROP_TYPE(TypeTag, FVGridGeometry)::discMethod>; - GridManager gridMgr; - gridMgr.makeGrid(); - const auto& grid = gridMgr.grid(); - gridMgr.loadBalance(); + using GridManager = Dumux::GridManager<typename GET_PROP_TYPE(TypeTag, Grid)>; + GridManager gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = grid.leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/freeflow/navierstokes/test_kovasznay.cc b/test/freeflow/navierstokes/test_kovasznay.cc index 019bd257e2..95de8b519b 100644 --- a/test/freeflow/navierstokes/test_kovasznay.cc +++ b/test/freeflow/navierstokes/test_kovasznay.cc @@ -50,6 +50,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -101,16 +102,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/freeflow/navierstokes/test_navierstokes_1d.cc b/test/freeflow/navierstokes/test_navierstokes_1d.cc index 4d8c4598ea..91edf0498f 100644 --- a/test/freeflow/navierstokes/test_navierstokes_1d.cc +++ b/test/freeflow/navierstokes/test_navierstokes_1d.cc @@ -43,6 +43,7 @@ #include <dumux/assembly/diffmethod.hh> #include <dumux/discretization/methods.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include <dumux/linear/seqsolverbackend.hh> #include <dumux/nonlinear/newtonsolver.hh> @@ -89,16 +90,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/freeflow/navierstokes/test_stokes_channel_3d.cc b/test/freeflow/navierstokes/test_stokes_channel_3d.cc index bffaab16da..3d69225f21 100644 --- a/test/freeflow/navierstokes/test_stokes_channel_3d.cc +++ b/test/freeflow/navierstokes/test_stokes_channel_3d.cc @@ -43,6 +43,7 @@ #include <dumux/assembly/diffmethod.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include <dumux/freeflow/navierstokes/staggered/fluxoversurface.hh> /*! @@ -95,16 +96,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/freeflow/navierstokesnc/channeltestproblem.hh b/test/freeflow/navierstokesnc/channeltestproblem.hh index bd48143b67..dfce184711 100644 --- a/test/freeflow/navierstokesnc/channeltestproblem.hh +++ b/test/freeflow/navierstokesnc/channeltestproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_CHANNEL_NC_TEST_PROBLEM_HH #define DUMUX_CHANNEL_NC_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/components/simpleh2o.hh> #include <dumux/material/fluidsystems/h2oair.hh> diff --git a/test/freeflow/navierstokesnc/densityflowproblem.hh b/test/freeflow/navierstokesnc/densityflowproblem.hh index 38959ede9d..4e61414436 100644 --- a/test/freeflow/navierstokesnc/densityflowproblem.hh +++ b/test/freeflow/navierstokesnc/densityflowproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_DENSITY_FLOW_NC_TEST_PROBLEM_HH #define DUMUX_DENSITY_FLOW_NC_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/components/simpleh2o.hh> #include <dumux/material/fluidsystems/h2oair.hh> diff --git a/test/freeflow/navierstokesnc/msfreeflowtestproblem.hh b/test/freeflow/navierstokesnc/msfreeflowtestproblem.hh index 93978c8230..4920d19494 100644 --- a/test/freeflow/navierstokesnc/msfreeflowtestproblem.hh +++ b/test/freeflow/navierstokesnc/msfreeflowtestproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_CHANNEL_MAXWELL_STEFAN_TEST_PROBLEM_HH #define DUMUX_CHANNEL_MAXWELL_STEFAN_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/freeflow/compositional/navierstokesncmodel.hh> #include <dumux/freeflow/navierstokes/problem.hh> diff --git a/test/freeflow/navierstokesnc/test_channel.cc b/test/freeflow/navierstokesnc/test_channel.cc index 9198f5df82..066444114b 100644 --- a/test/freeflow/navierstokesnc/test_channel.cc +++ b/test/freeflow/navierstokesnc/test_channel.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -100,16 +101,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/freeflow/navierstokesnc/test_densitydrivenflow.cc b/test/freeflow/navierstokesnc/test_densitydrivenflow.cc index 614df58447..25fd54d6f6 100644 --- a/test/freeflow/navierstokesnc/test_densitydrivenflow.cc +++ b/test/freeflow/navierstokesnc/test_densitydrivenflow.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -100,16 +101,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/freeflow/navierstokesnc/test_msfreeflow.cc b/test/freeflow/navierstokesnc/test_msfreeflow.cc index 88c23a75a6..d19b6e6960 100644 --- a/test/freeflow/navierstokesnc/test_msfreeflow.cc +++ b/test/freeflow/navierstokesnc/test_msfreeflow.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -100,16 +101,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/freeflow/rans/pipelauferproblem.hh b/test/freeflow/rans/pipelauferproblem.hh index d69ba41ddc..379b9139c3 100644 --- a/test/freeflow/rans/pipelauferproblem.hh +++ b/test/freeflow/rans/pipelauferproblem.hh @@ -27,6 +27,8 @@ #ifndef DUMUX_PIPE_LAUFER_PROBLEM_HH #define DUMUX_PIPE_LAUFER_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/staggered/freeflow/properties.hh> #include <dumux/freeflow/turbulenceproperties.hh> #include <dumux/material/fluidsystems/1pgas.hh> diff --git a/test/freeflow/rans/test_pipe_laufer.cc b/test/freeflow/rans/test_pipe_laufer.cc index 62e9d82f50..56825467c7 100644 --- a/test/freeflow/rans/test_pipe_laufer.cc +++ b/test/freeflow/rans/test_pipe_laufer.cc @@ -53,6 +53,7 @@ #include <dumux/io/gnuplotinterface.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -93,16 +94,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/freeflow/ransnc/flatplatetestproblem.hh b/test/freeflow/ransnc/flatplatetestproblem.hh index e51fec4c7b..c0111ec6b4 100644 --- a/test/freeflow/ransnc/flatplatetestproblem.hh +++ b/test/freeflow/ransnc/flatplatetestproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_RANS_NC_TEST_PROBLEM_HH #define DUMUX_RANS_NC_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/staggered/freeflow/properties.hh> #include <dumux/material/fluidsystems/h2oair.hh> #include <dumux/freeflow/turbulenceproperties.hh> diff --git a/test/freeflow/ransnc/test_flatplate.cc b/test/freeflow/ransnc/test_flatplate.cc index 2c84754373..2767ea5126 100644 --- a/test/freeflow/ransnc/test_flatplate.cc +++ b/test/freeflow/ransnc/test_flatplate.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -89,16 +90,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/geomechanics/elastic/problem.hh b/test/geomechanics/elastic/problem.hh index b7fab27f9b..9762336500 100644 --- a/test/geomechanics/elastic/problem.hh +++ b/test/geomechanics/elastic/problem.hh @@ -24,6 +24,7 @@ #define DUMUX_ELASTICPROBLEM_HH #include <dune/common/fmatrix.hh> +#include <dune/grid/yaspgrid.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/geomechanics/elastic/model.hh> diff --git a/test/geomechanics/elastic/test_elastic.cc b/test/geomechanics/elastic/test_elastic.cc index 005a0682ec..74ae58761f 100644 --- a/test/geomechanics/elastic/test_elastic.cc +++ b/test/geomechanics/elastic/test_elastic.cc @@ -47,6 +47,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> // main function int main(int argc, char** argv) try @@ -70,16 +71,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/geomechanics/poroelastic/problem.hh b/test/geomechanics/poroelastic/problem.hh index 887e4313ef..fc675b5db9 100644 --- a/test/geomechanics/poroelastic/problem.hh +++ b/test/geomechanics/poroelastic/problem.hh @@ -24,6 +24,7 @@ #define DUMUX_POROELASTIC_PROBLEM_HH #include <dune/common/fmatrix.hh> +#include <dune/grid/yaspgrid.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/geomechanics/poroelastic/model.hh> diff --git a/test/geomechanics/poroelastic/test_poroelastic.cc b/test/geomechanics/poroelastic/test_poroelastic.cc index dba038fe79..2f82bd8f59 100644 --- a/test/geomechanics/poroelastic/test_poroelastic.cc +++ b/test/geomechanics/poroelastic/test_poroelastic.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/discretization/elementsolution.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> // function to evaluate the element stresses template< class StressType, @@ -113,16 +114,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/io/gridcreator/gridcreatortests.hh b/test/io/gridcreator/gridmanagertests.hh similarity index 97% rename from test/io/gridcreator/gridcreatortests.hh rename to test/io/gridcreator/gridmanagertests.hh index e88caf62a5..2cf7aad315 100644 --- a/test/io/gridcreator/gridcreatortests.hh +++ b/test/io/gridcreator/gridmanagertests.hh @@ -21,8 +21,8 @@ * \note This can/should be extended */ -#ifndef DUMUX_GRIDCREATOR_TESTS_HH -#define DUMUX_GRIDCREATOR_TESTS_HH +#ifndef DUMUX_TEST_IO_GRIDMANAGER_TESTS_HH +#define DUMUX_TEST_IO_GRIDMANAGER_TESTS_HH #include <dune/common/version.hh> #include <dune/geometry/referenceelements.hh> @@ -100,7 +100,7 @@ private: }; template<class Grid> -class GridCreatorTests +class GridManagerTests { using GridView = typename Grid::LeafGridView; using Scalar = double; @@ -116,8 +116,7 @@ public: { // make the grid manager and initialize the grid GridManager gridManager; - gridManager.makeGrid(); - gridManager.loadBalance(); + gridManager.init(); auto gridData = gridManager.getGridData(); const auto& leafGridView = gridManager.grid().leafGridView(); @@ -151,8 +150,7 @@ public: { // make the grid manager and initialize the grid GridManager gridManager; - gridManager.makeGrid(); - gridManager.loadBalance(); + gridManager.init(); auto gridData = gridManager.getGridData(); // read the element markers and the rank diff --git a/test/io/gridcreator/test_gridcreator_cake.cc b/test/io/gridcreator/test_gridcreator_cake.cc index 41ef55e5e6..7ecfee27bf 100644 --- a/test/io/gridcreator/test_gridcreator_cake.cc +++ b/test/io/gridcreator/test_gridcreator_cake.cc @@ -26,7 +26,8 @@ #include <dune/grid/io/file/vtk.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/io/cakegridcreator.hh> +#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/cakegridcreator.hh> #if HAVE_UG #include <dune/grid/uggrid.hh> @@ -59,18 +60,19 @@ int main(int argc, char** argv) try // using declarations using TypeTag = TTAG(GridCreatorCakeTest); using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - using GridCreator = typename Dumux::CakeGridCreator<Grid>; + using GridManager = typename Dumux::CakeGridCreator<Grid>; + GridManager gridManager; // first read parameters from input file Dumux::Parameters::init(argc, argv, "test_gridcreator_cake.input"); // make the grid Dune::Timer timer; - GridCreator::makeGrid(); - std::cout << "Constructing cake grid with " << GridCreator::grid().leafGridView().size(0) << " elements took " + gridManager.init(); + std::cout << "Constructing cake grid with " << gridManager.grid().leafGridView().size(0) << " elements took " << timer.elapsed() << " seconds.\n"; // construct a vtk output writer and attach the boundaryMakers - Dune::VTKWriter<Grid::LeafGridView> vtkWriter(GridCreator::grid().leafGridView()); + Dune::VTKWriter<Grid::LeafGridView> vtkWriter(gridManager.grid().leafGridView()); vtkWriter.write("cake-00000"); return 0; diff --git a/test/io/gridcreator/test_gridcreator_dgf_e_markers.cc b/test/io/gridcreator/test_gridcreator_dgf_e_markers.cc index e1e9ada10e..3f5b245a15 100644 --- a/test/io/gridcreator/test_gridcreator_dgf_e_markers.cc +++ b/test/io/gridcreator/test_gridcreator_dgf_e_markers.cc @@ -25,7 +25,7 @@ #include <dune/common/parallel/mpihelper.hh> #include <dumux/common/parameters.hh> -#include "gridcreatortests.hh" +#include "gridmanagertests.hh" int main(int argc, char** argv) try { @@ -34,7 +34,7 @@ int main(int argc, char** argv) try Dumux::Parameters::init(argc, argv, "test_gridcreator_dgf_e_markers.input"); auto name = Dumux::getParam<std::string>("Problem.Name"); - Dumux::GridCreatorTests<GRIDTYPE>::testElementMarkers("dgf", name); + Dumux::GridManagerTests<GRIDTYPE>::testElementMarkers("dgf", name); return 0; } diff --git a/test/io/gridcreator/test_gridcreator_gmsh_3d.cc b/test/io/gridcreator/test_gridcreator_gmsh_3d.cc index 9d2eb30e25..2ae6aadf1f 100644 --- a/test/io/gridcreator/test_gridcreator_gmsh_3d.cc +++ b/test/io/gridcreator/test_gridcreator_gmsh_3d.cc @@ -25,7 +25,7 @@ #include <dune/common/parallel/mpihelper.hh> #include <dumux/common/parameters.hh> -#include "gridcreatortests.hh" +#include "gridmanagertests.hh" int main(int argc, char** argv) try { @@ -35,7 +35,7 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, "test_gridcreator_gmsh_3d.input"); const auto name = getParam<std::string>("Problem.Name"); const auto refine = Dumux::getParam<bool>("Grid.Refine", true); - GridCreatorTests<GRIDTYPE>::testBoundaryAndElementMarkers("gmsh", name, refine); + GridManagerTests<GRIDTYPE>::testBoundaryAndElementMarkers("gmsh", name, refine); return 0; } diff --git a/test/io/gridcreator/test_gridcreator_gmsh_e_markers.cc b/test/io/gridcreator/test_gridcreator_gmsh_e_markers.cc index f39dd3d6e9..47dfb3ebcf 100644 --- a/test/io/gridcreator/test_gridcreator_gmsh_e_markers.cc +++ b/test/io/gridcreator/test_gridcreator_gmsh_e_markers.cc @@ -25,7 +25,7 @@ #include <dune/common/parallel/mpihelper.hh> #include <dumux/common/parameters.hh> -#include "gridcreatortests.hh" +#include "gridmanagertests.hh" int main(int argc, char** argv) try { @@ -34,7 +34,7 @@ int main(int argc, char** argv) try Dumux::Parameters::init(argc, argv, "test_gridcreator_gmsh_e_markers.input"); auto name = Dumux::getParam<std::string>("Problem.Name"); - Dumux::GridCreatorTests<GRIDTYPE>::testElementMarkers("gmsh", name); + Dumux::GridManagerTests<GRIDTYPE>::testElementMarkers("gmsh", name); return 0; } diff --git a/test/io/gridcreator/test_gridcreator_subgrid.cc b/test/io/gridcreator/test_gridcreator_subgrid.cc index 61dfc31f5b..370c2f82cd 100644 --- a/test/io/gridcreator/test_gridcreator_subgrid.cc +++ b/test/io/gridcreator/test_gridcreator_subgrid.cc @@ -25,10 +25,11 @@ #include <dune/common/fvector.hh> #include <dune/common/timer.hh> #include <dune/grid/io/file/vtk.hh> +#include <dune/grid/yaspgrid.hh> #include <dumux/common/parameters.hh> -#include <dumux/io/gridcreator.hh> -#include <dumux/io/subgridgridcreator.hh> +#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/subgridgridcreator.hh> #include <dumux/discretization/methods.hh> /*! @@ -67,13 +68,16 @@ int main(int argc, char** argv) try Dune::Timer timer; using HostGrid = Dune::YaspGrid<dim, Dune::TensorProductCoordinates<double, dim> >; - using HostGridCreator = GridCreatorImpl<HostGrid, DiscretizationMethod::none>; - HostGridCreator::makeGrid(); + + using HostGridManager = Dumux::GridManager<HostGrid>; + HostGridManager hostGridManager; + hostGridManager.init(); + auto& hostGrid = hostGridManager.grid(); // Calculate the bounding box of the host grid view. GlobalPosition bBoxMin(std::numeric_limits<double>::max()); GlobalPosition bBoxMax(std::numeric_limits<double>::min()); - for (const auto& vertex : vertices(HostGridCreator::grid().leafGridView())) + for (const auto& vertex : vertices(hostGrid.leafGridView())) { for (int i=0; i<dim; i++) { @@ -105,14 +109,14 @@ int main(int argc, char** argv) try CircleSelector<GlobalPosition> elementSelectorThree(center); // Create three different subgrids from the same hostgrid. - auto subgridPtrOne = SubgridGridCreator<HostGrid>::makeGrid(HostGridCreator::grid(), elementSelectorOne, "SubGridOne"); - auto subgridPtrTwo = SubgridGridCreator<HostGrid>::makeGrid(HostGridCreator::grid(), elementSelectorTwo, "SubGridTwo"); - auto subgridPtrThree = SubgridGridCreator<HostGrid>::makeGrid(HostGridCreator::grid(), elementSelectorThree, "SubGridThree"); + auto subgridPtrOne = SubgridGridCreator<HostGrid>::makeGrid(hostGrid, elementSelectorOne, "SubGridOne"); + auto subgridPtrTwo = SubgridGridCreator<HostGrid>::makeGrid(hostGrid, elementSelectorTwo, "SubGridTwo"); + auto subgridPtrThree = SubgridGridCreator<HostGrid>::makeGrid(hostGrid, elementSelectorThree, "SubGridThree"); std::cout << "Constructing a host grid and three subgrids took " << timer.elapsed() << " seconds.\n"; // Write out the host grid and the subgrids. - Dune::VTKWriter<HostGrid::LeafGridView> vtkWriter(HostGridCreator::grid().leafGridView()); + Dune::VTKWriter<HostGrid::LeafGridView> vtkWriter(hostGrid.leafGridView()); vtkWriter.write("hostgrid"); return 0; diff --git a/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh b/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh index 193d3c7c89..3ba1bdd208 100644 --- a/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh +++ b/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh @@ -25,7 +25,8 @@ #ifndef DUMUX_1PNI_CONDUCTION_PROBLEM_HH #define DUMUX_1PNI_CONDUCTION_PROBLEM_HH -#include <math.h> +#include <cmath> +#include <dune/grid/yaspgrid.hh> #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/box/properties.hh> diff --git a/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh b/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh index 9d0aca9b4a..af9064770c 100644 --- a/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh +++ b/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh @@ -26,7 +26,8 @@ #ifndef DUMUX_1PNI_CONVECTION_PROBLEM_HH #define DUMUX_1PNI_CONVECTION_PROBLEM_HH -#include <math.h> +#include <cmath> +#include <dune/grid/yaspgrid.hh> #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/box/properties.hh> diff --git a/test/porousmediumflow/1p/implicit/1ptestproblem.hh b/test/porousmediumflow/1p/implicit/1ptestproblem.hh index 7165e9d4a3..d33123e9de 100644 --- a/test/porousmediumflow/1p/implicit/1ptestproblem.hh +++ b/test/porousmediumflow/1p/implicit/1ptestproblem.hh @@ -25,6 +25,8 @@ #ifndef DUMUX_1PTEST_PROBLEM_HH #define DUMUX_1PTEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/cellcentered/mpfa/properties.hh> #include <dumux/discretization/box/properties.hh> diff --git a/test/porousmediumflow/1p/implicit/compressible/problem.hh b/test/porousmediumflow/1p/implicit/compressible/problem.hh index 57cb404c28..f0d4bc70bc 100644 --- a/test/porousmediumflow/1p/implicit/compressible/problem.hh +++ b/test/porousmediumflow/1p/implicit/compressible/problem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH #define DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/components/h2o.hh> #include <dumux/material/components/tabulatedcomponent.hh> #include <dumux/material/fluidsystems/1pliquid.hh> diff --git a/test/porousmediumflow/1p/implicit/compressible/test_1p.cc b/test/porousmediumflow/1p/implicit/compressible/test_1p.cc index 0681e6b119..1408949ead 100644 --- a/test/porousmediumflow/1p/implicit/compressible/test_1p.cc +++ b/test/porousmediumflow/1p/implicit/compressible/test_1p.cc @@ -47,6 +47,7 @@ #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> int main(int argc, char** argv) try { @@ -72,16 +73,15 @@ int main(int argc, char** argv) try // try to create a grid (from the given grid file or the input file) ///////////////////////////////////////////////////////////////////// - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/1p/implicit/compressible/test_1p_stationary.cc b/test/porousmediumflow/1p/implicit/compressible/test_1p_stationary.cc index 61a955a939..723cf74e24 100644 --- a/test/porousmediumflow/1p/implicit/compressible/test_1p_stationary.cc +++ b/test/porousmediumflow/1p/implicit/compressible/test_1p_stationary.cc @@ -45,6 +45,7 @@ #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> int main(int argc, char** argv) try { @@ -70,16 +71,15 @@ int main(int argc, char** argv) try // try to create a grid (from the given grid file or the input file) ///////////////////////////////////////////////////////////////////// - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/1p/implicit/incompressible/problem.hh b/test/porousmediumflow/1p/implicit/incompressible/problem.hh index f7d379dc55..0d7ae66f77 100644 --- a/test/porousmediumflow/1p/implicit/incompressible/problem.hh +++ b/test/porousmediumflow/1p/implicit/incompressible/problem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH #define DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/cellcentered/mpfa/properties.hh> #include <dumux/discretization/box/properties.hh> diff --git a/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc b/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc index 35eaadff20..2754ab3a4d 100644 --- a/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc +++ b/test/porousmediumflow/1p/implicit/incompressible/test_1pfv.cc @@ -42,6 +42,9 @@ #include <dumux/common/dumuxmessage.hh> #include <dumux/common/defaultusagemessage.hh> +#include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> + #include <dumux/assembly/fvassembler.hh> #include "problem.hh" @@ -70,12 +73,11 @@ int main(int argc, char** argv) try // try to create a grid (from the given grid file or the input file) ///////////////////////////////////////////////////////////////////// - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblem.hh b/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblem.hh index a52d270b45..e77b07c1fc 100644 --- a/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblem.hh +++ b/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblem.hh @@ -25,6 +25,8 @@ #ifndef DUMUX_1P_SINGULARITY_PROBLEM_HH #define DUMUX_1P_SINGULARITY_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/porousmediumflow/1p/model.hh> diff --git a/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources.cc b/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources.cc index 92abc5b34e..75f38d6342 100644 --- a/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources.cc +++ b/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> int main(int argc, char** argv) try { @@ -68,16 +69,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources_timedependent.cc b/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources_timedependent.cc index f0fbf2fe90..7603390e6b 100644 --- a/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources_timedependent.cc +++ b/test/porousmediumflow/1p/implicit/pointsources/test_1pfv_pointsources_timedependent.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> int main(int argc, char** argv) try { @@ -68,16 +69,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/1p/implicit/test_1pfv.cc b/test/porousmediumflow/1p/implicit/test_1pfv.cc index 20b487087d..f021f8408d 100644 --- a/test/porousmediumflow/1p/implicit/test_1pfv.cc +++ b/test/porousmediumflow/1p/implicit/test_1pfv.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -99,16 +100,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/1p/implicit/test_1pfv_fracture2d3d.cc b/test/porousmediumflow/1p/implicit/test_1pfv_fracture2d3d.cc index 661a2eacd5..65a1a9c23b 100644 --- a/test/porousmediumflow/1p/implicit/test_1pfv_fracture2d3d.cc +++ b/test/porousmediumflow/1p/implicit/test_1pfv_fracture2d3d.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with * reading in parameters. @@ -93,16 +94,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/1p/implicit/test_1pfv_network1d3d.cc b/test/porousmediumflow/1p/implicit/test_1pfv_network1d3d.cc index 8002c62815..edd24f310b 100644 --- a/test/porousmediumflow/1p/implicit/test_1pfv_network1d3d.cc +++ b/test/porousmediumflow/1p/implicit/test_1pfv_network1d3d.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with * reading in parameters. @@ -93,16 +94,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/1p/implicit/test_1pnifv.cc b/test/porousmediumflow/1p/implicit/test_1pnifv.cc index 936c8e7dd6..cceb83f2ad 100644 --- a/test/porousmediumflow/1p/implicit/test_1pnifv.cc +++ b/test/porousmediumflow/1p/implicit/test_1pnifv.cc @@ -50,6 +50,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -95,16 +96,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/1p/sequential/test_1pproblem.hh b/test/porousmediumflow/1p/sequential/test_1pproblem.hh index cdc0c03c2d..03709cca98 100644 --- a/test/porousmediumflow/1p/sequential/test_1pproblem.hh +++ b/test/porousmediumflow/1p/sequential/test_1pproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_TEST_1P_PROBLEM_HH #define DUMUX_TEST_1P_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/components/constant.hh> diff --git a/test/porousmediumflow/1p/sequential/test_diffusion.cc b/test/porousmediumflow/1p/sequential/test_diffusion.cc index e8e5c19d98..89a23a4dd9 100644 --- a/test/porousmediumflow/1p/sequential/test_diffusion.cc +++ b/test/porousmediumflow/1p/sequential/test_diffusion.cc @@ -28,6 +28,8 @@ #include <dune/common/exceptions.hh> #include <dune/common/parallel/mpihelper.hh> +#include <dumux/io/grid/gridmanager.hh> + #include "test_diffusionproblem.hh" #include "resultevaluation.hh" @@ -62,9 +64,9 @@ int main(int argc, char** argv) //////////////////////////////////////////////////////////// // create the grid //////////////////////////////////////////////////////////// - using GridCreator = GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - auto& grid = GridCreator::grid(); + Dumux::GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); + auto& grid = gridManager.grid(); //////////////////////////////////////////////////////////// // instantiate and run the concrete problem diff --git a/test/porousmediumflow/1p/sequential/test_diffusion3d.cc b/test/porousmediumflow/1p/sequential/test_diffusion3d.cc index def4118513..f9a15a2f43 100644 --- a/test/porousmediumflow/1p/sequential/test_diffusion3d.cc +++ b/test/porousmediumflow/1p/sequential/test_diffusion3d.cc @@ -37,6 +37,8 @@ #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> +#include <dumux/io/grid/gridmanager.hh> + #include "test_diffusionproblem3d.hh" #include "resultevaluation3d.hh" @@ -86,18 +88,17 @@ int start(int argc, // try to create a grid (from the given grid file or the input file) ///////////////////////////////////////////////////////////////////// - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - try { GridCreator::makeGrid(); } + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + try { gridManager.init(); } catch (...) { std::string usageMessage = "\n\t -> Creation of the grid failed! <- \n\n"; usageMessage += defaultUsageMessage(argv[0]); usage(argv[0], usageMessage); throw; } - GridCreator::loadBalance(); // print grid info - auto& grid = GridCreator::grid(); + auto& grid = gridManager.grid(); Dune::gridinfo(grid); ////////////////////////////////////////////////////////////////////// diff --git a/test/porousmediumflow/1p/sequential/test_diffusionproblem3d.hh b/test/porousmediumflow/1p/sequential/test_diffusionproblem3d.hh index 509d3c6915..2841246728 100644 --- a/test/porousmediumflow/1p/sequential/test_diffusionproblem3d.hh +++ b/test/porousmediumflow/1p/sequential/test_diffusionproblem3d.hh @@ -22,6 +22,14 @@ #ifndef DUMUX_TEST_DIFFUSION_3D_PROBLEM_HH #define DUMUX_TEST_DIFFUSION_3D_PROBLEM_HH +#if HAVE_DUNE_ALUGRID +#include <dune/alugrid/grid.hh> +#endif +#if HAVE_UG +#include <dune/grid/uggrid.hh> +#endif +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/components/constant.hh> #include <dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/pressureproperties.hh> diff --git a/test/porousmediumflow/1pnc/implicit/1p2cniconductionproblem.hh b/test/porousmediumflow/1pnc/implicit/1p2cniconductionproblem.hh index 53237741f0..d86da0cb0e 100644 --- a/test/porousmediumflow/1pnc/implicit/1p2cniconductionproblem.hh +++ b/test/porousmediumflow/1pnc/implicit/1p2cniconductionproblem.hh @@ -25,6 +25,11 @@ #ifndef DUMUX_1P2CNI_CONDUCTION_TEST_PROBLEM_HH #define DUMUX_1P2CNI_CONDUCTION_TEST_PROBLEM_HH +#if HAVE_UG +#include <dune/grid/uggrid.hh> +#endif +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/cellcentered/mpfa/properties.hh> diff --git a/test/porousmediumflow/1pnc/implicit/1p2cniconvectionproblem.hh b/test/porousmediumflow/1pnc/implicit/1p2cniconvectionproblem.hh index 635b657e10..70d397f051 100644 --- a/test/porousmediumflow/1pnc/implicit/1p2cniconvectionproblem.hh +++ b/test/porousmediumflow/1pnc/implicit/1p2cniconvectionproblem.hh @@ -25,6 +25,11 @@ #ifndef DUMUX_1P2CNI_CONVECTION_TEST_PROBLEM_HH #define DUMUX_1P2CNI_CONVECTION_TEST_PROBLEM_HH +#if HAVE_UG +#include <dune/grid/uggrid.hh> +#endif +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/cellcentered/mpfa/properties.hh> diff --git a/test/porousmediumflow/1pnc/implicit/1p2ctestproblem.hh b/test/porousmediumflow/1pnc/implicit/1p2ctestproblem.hh index ae77a6c9db..c044501577 100644 --- a/test/porousmediumflow/1pnc/implicit/1p2ctestproblem.hh +++ b/test/porousmediumflow/1pnc/implicit/1p2ctestproblem.hh @@ -25,6 +25,11 @@ #ifndef DUMUX_1P2C_TEST_PROBLEM_HH #define DUMUX_1P2C_TEST_PROBLEM_HH +#if HAVE_UG +#include <dune/grid/uggrid.hh> +#endif +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/cellcentered/mpfa/properties.hh> #include <dumux/discretization/box/properties.hh> diff --git a/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc b/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc index d9bb15ae64..86133ee13d 100644 --- a/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc +++ b/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc @@ -21,176 +21,176 @@ * * \brief test for the 1pnc model */ - #include <config.h> +#include <config.h> - #include "1p2ctestproblem.hh" +#include "1p2ctestproblem.hh" - #include <ctime> - #include <iostream> +#include <ctime> +#include <iostream> - #include <dune/common/parallel/mpihelper.hh> - #include <dune/common/timer.hh> - #include <dune/grid/io/file/dgfparser/dgfexception.hh> - #include <dune/grid/io/file/vtk.hh> - #include <dune/istl/io.hh> +#include <dune/common/parallel/mpihelper.hh> +#include <dune/common/timer.hh> +#include <dune/grid/io/file/dgfparser/dgfexception.hh> +#include <dune/grid/io/file/vtk.hh> +#include <dune/istl/io.hh> - #include <dumux/discretization/methods.hh> +#include <dumux/discretization/methods.hh> - #include <dumux/common/properties.hh> - #include <dumux/common/parameters.hh> - #include <dumux/common/dumuxmessage.hh> - #include <dumux/common/defaultusagemessage.hh> +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> +#include <dumux/common/dumuxmessage.hh> +#include <dumux/common/defaultusagemessage.hh> - #include <dumux/linear/seqsolverbackend.hh> - #include <dumux/nonlinear/newtonsolver.hh> +#include <dumux/linear/seqsolverbackend.hh> +#include <dumux/nonlinear/newtonsolver.hh> - #include <dumux/assembly/fvassembler.hh> +#include <dumux/assembly/fvassembler.hh> - #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> - int main(int argc, char** argv) try - { - using namespace Dumux; +int main(int argc, char** argv) try +{ + using namespace Dumux; - // define the type tag for this problem - using TypeTag = TTAG(TYPETAG); + // define the type tag for this problem + using TypeTag = TTAG(TYPETAG); - //////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// - // initialize MPI, finalize is done automatically on exit - const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); + // initialize MPI, finalize is done automatically on exit + const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); - // print dumux start message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/true); + // print dumux start message + if (mpiHelper.rank() == 0) + DumuxMessage::print(/*firstCall=*/true); - // initialize parameter tree - Parameters::init(argc, argv); + // initialize parameter tree + Parameters::init(argc, argv); - ////////////////////////////////////////////////////////////////////// - // try to create a grid (from the given grid file or the input file) - ///////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + // try to create a grid (from the given grid file or the input file) + ///////////////////////////////////////////////////////////////////// - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); - //////////////////////////////////////////////////////////// - // run instationary non-linear problem on this grid - //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// + // run instationary non-linear problem on this grid + //////////////////////////////////////////////////////////// - // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + // we compute on the leaf grid view + const auto& leafGridView = gridManager.grid().leafGridView(); - // create the finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + // create the finite volume grid geometry + using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); + fvGridGeometry->update(); - // the problem (initial and boundary conditions) - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - auto problem = std::make_shared<Problem>(fvGridGeometry); - - // the solution vector - using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(fvGridGeometry->numDofs()); - problem->applyInitialSolution(x); - auto xOld = x; - - // the grid variables - using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); - gridVariables->init(x, xOld); - - // get some time loop parameters - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); - auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); - - // intialize the vtk output module - VtkOutputModule<TypeTag, GET_PROP_VALUE(TypeTag, PhaseIdx)> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); - using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); - VtkOutputFields::init(vtkWriter); //!< Add model specific output fields - vtkWriter.write(0.0); - - // instantiate time loop - auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); - timeLoop->setMaxTimeStepSize(maxDt); - - // the assembler with time loop for instationary problem - using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); - - // the linear solver - using LinearSolver = ILU0BiCGSTABBackend; - auto linearSolver = std::make_shared<LinearSolver>(); - - // the non-linear solver - NewtonSolver<Assembler, LinearSolver> nonLinearSolver(assembler, linearSolver); - - // time loop - timeLoop->start(); do - { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - - // solve the non-linear system with time step control - nonLinearSolver.solve(x, *timeLoop); - - // make the new solution the old solution - xOld = x; - gridVariables->advanceTimeStep(); - - // advance to the time loop to the next step - timeLoop->advanceTimeStep(); - - // write vtk output - vtkWriter.write(timeLoop->time()); - - // report statistics of this time step - timeLoop->reportTimeStep(); - - // set new dt as suggested by the newton solver - timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); - - } while (!timeLoop->finished()); - - timeLoop->finalize(leafGridView.comm()); - - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/false); - - return 0; - - } - catch (Dumux::ParameterException &e) - { - std::cerr << std::endl << e << " ---> Abort!" << std::endl; - return 1; - } - catch (Dune::DGFException & e) - { - std::cerr << "DGF exception thrown (" << e << - "). Most likely, the DGF file name is wrong " - "or the DGF file is corrupted, " - "e.g. missing hash at end of file or wrong number (dimensions) of entries." - << " ---> Abort!" << std::endl; - return 2; - } - catch (Dune::Exception &e) - { - std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; - return 3; - } - catch (...) - { - std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; - return 4; - } + // the problem (initial and boundary conditions) + using Problem = typename GET_PROP_TYPE(TypeTag, Problem); + auto problem = std::make_shared<Problem>(fvGridGeometry); + + // the solution vector + using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); + SolutionVector x(fvGridGeometry->numDofs()); + problem->applyInitialSolution(x); + auto xOld = x; + + // the grid variables + using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); + auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + gridVariables->init(x, xOld); + + // get some time loop parameters + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); + auto dt = getParam<Scalar>("TimeLoop.DtInitial"); + auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); + + // intialize the vtk output module + VtkOutputModule<TypeTag, GET_PROP_VALUE(TypeTag, PhaseIdx)> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); + using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); + VtkOutputFields::init(vtkWriter); //!< Add model specific output fields + vtkWriter.write(0.0); + + // instantiate time loop + auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); + timeLoop->setMaxTimeStepSize(maxDt); + + // the assembler with time loop for instationary problem + using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; + auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); + + // the linear solver + using LinearSolver = ILU0BiCGSTABBackend; + auto linearSolver = std::make_shared<LinearSolver>(); + + // the non-linear solver + NewtonSolver<Assembler, LinearSolver> nonLinearSolver(assembler, linearSolver); + + // time loop + timeLoop->start(); do + { + // set previous solution for storage evaluations + assembler->setPreviousSolution(xOld); + + // solve the non-linear system with time step control + nonLinearSolver.solve(x, *timeLoop); + + // make the new solution the old solution + xOld = x; + gridVariables->advanceTimeStep(); + + // advance to the time loop to the next step + timeLoop->advanceTimeStep(); + + // write vtk output + vtkWriter.write(timeLoop->time()); + + // report statistics of this time step + timeLoop->reportTimeStep(); + + // set new dt as suggested by the newton solver + timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); + + } while (!timeLoop->finished()); + + timeLoop->finalize(leafGridView.comm()); + + //////////////////////////////////////////////////////////// + // finalize, print dumux message to say goodbye + //////////////////////////////////////////////////////////// + + // print dumux end message + if (mpiHelper.rank() == 0) + DumuxMessage::print(/*firstCall=*/false); + + return 0; +} + +catch (Dumux::ParameterException &e) +{ + std::cerr << std::endl << e << " ---> Abort!" << std::endl; + return 1; +} +catch (Dune::DGFException & e) +{ + std::cerr << "DGF exception thrown (" << e << + "). Most likely, the DGF file name is wrong " + "or the DGF file is corrupted, " + "e.g. missing hash at end of file or wrong number (dimensions) of entries." + << " ---> Abort!" << std::endl; + return 2; +} +catch (Dune::Exception &e) +{ + std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; + return 3; +} +catch (...) +{ + std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; + return 4; +} diff --git a/test/porousmediumflow/1pnc/implicit/test_1p2cni_conduction_fv.cc b/test/porousmediumflow/1pnc/implicit/test_1p2cni_conduction_fv.cc index d259b57257..f61f996cc7 100644 --- a/test/porousmediumflow/1pnc/implicit/test_1p2cni_conduction_fv.cc +++ b/test/porousmediumflow/1pnc/implicit/test_1p2cni_conduction_fv.cc @@ -21,185 +21,185 @@ * * \brief test for the 1pnc model */ - #include <config.h> +#include <config.h> - #include "1p2cniconductionproblem.hh" +#include "1p2cniconductionproblem.hh" - #include <ctime> - #include <iostream> +#include <ctime> +#include <iostream> - #include <dune/common/parallel/mpihelper.hh> - #include <dune/common/timer.hh> - #include <dune/grid/io/file/dgfparser/dgfexception.hh> - #include <dune/grid/io/file/vtk.hh> - #include <dune/istl/io.hh> +#include <dune/common/parallel/mpihelper.hh> +#include <dune/common/timer.hh> +#include <dune/grid/io/file/dgfparser/dgfexception.hh> +#include <dune/grid/io/file/vtk.hh> +#include <dune/istl/io.hh> - #include <dumux/discretization/methods.hh> +#include <dumux/discretization/methods.hh> - #include <dumux/common/properties.hh> - #include <dumux/common/parameters.hh> - #include <dumux/common/dumuxmessage.hh> - #include <dumux/common/defaultusagemessage.hh> +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> +#include <dumux/common/dumuxmessage.hh> +#include <dumux/common/defaultusagemessage.hh> - #include <dumux/nonlinear/newtonsolver.hh> - #include <dumux/linear/seqsolverbackend.hh> +#include <dumux/nonlinear/newtonsolver.hh> +#include <dumux/linear/seqsolverbackend.hh> - #include <dumux/assembly/fvassembler.hh> +#include <dumux/assembly/fvassembler.hh> - #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> - int main(int argc, char** argv) try - { - using namespace Dumux; +int main(int argc, char** argv) try +{ + using namespace Dumux; - // define the type tag for this problem - using TypeTag = TTAG(TYPETAG); + // define the type tag for this problem + using TypeTag = TTAG(TYPETAG); - //////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// - // initialize MPI, finalize is done automatically on exit - const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); + // initialize MPI, finalize is done automatically on exit + const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); - // print dumux start message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/true); + // print dumux start message + if (mpiHelper.rank() == 0) + DumuxMessage::print(/*firstCall=*/true); - // initialize parameter tree - Parameters::init(argc, argv); + // initialize parameter tree + Parameters::init(argc, argv); - ////////////////////////////////////////////////////////////////////// - // try to create a grid (from the given grid file or the input file) - ///////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + // try to create a grid (from the given grid file or the input file) + ///////////////////////////////////////////////////////////////////// - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); - //////////////////////////////////////////////////////////// - // run instationary non-linear problem on this grid - //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// + // run instationary non-linear problem on this grid + //////////////////////////////////////////////////////////// - // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + // we compute on the leaf grid view + const auto& leafGridView = gridManager.grid().leafGridView(); - // create the finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + // create the finite volume grid geometry + using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); + fvGridGeometry->update(); - // the problem (initial and boundary conditions) - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - auto problem = std::make_shared<Problem>(fvGridGeometry); + // the problem (initial and boundary conditions) + using Problem = typename GET_PROP_TYPE(TypeTag, Problem); + auto problem = std::make_shared<Problem>(fvGridGeometry); - // the solution vector - using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(fvGridGeometry->numDofs()); - problem->applyInitialSolution(x); - auto xOld = x; + // the solution vector + using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); + SolutionVector x(fvGridGeometry->numDofs()); + problem->applyInitialSolution(x); + auto xOld = x; - // the grid variables - using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); - gridVariables->init(x, xOld); + // the grid variables + using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); + auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + gridVariables->init(x, xOld); - // get some time loop parameters - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); - auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); + // get some time loop parameters + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); + auto dt = getParam<Scalar>("TimeLoop.DtInitial"); + auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); - // intialize the vtk output module - VtkOutputModule<TypeTag, GET_PROP_VALUE(TypeTag, PhaseIdx)> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); - using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); - VtkOutputFields::init(vtkWriter); //!< Add model specific output fields - vtkWriter.addField(problem->getExactTemperature(), "temperatureExact"); - vtkWriter.write(0.0); - // output every vtkOutputInterval time step - const auto vtkOutputInterval = getParam<int>("Problem.OutputInterval"); + // intialize the vtk output module + VtkOutputModule<TypeTag, GET_PROP_VALUE(TypeTag, PhaseIdx)> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); + using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); + VtkOutputFields::init(vtkWriter); //!< Add model specific output fields + vtkWriter.addField(problem->getExactTemperature(), "temperatureExact"); + vtkWriter.write(0.0); + // output every vtkOutputInterval time step + const auto vtkOutputInterval = getParam<int>("Problem.OutputInterval"); - // instantiate time loop - auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); - timeLoop->setMaxTimeStepSize(maxDt); + // instantiate time loop + auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); + timeLoop->setMaxTimeStepSize(maxDt); - // the assembler with time loop for instationary problem - using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); + // the assembler with time loop for instationary problem + using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; + auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); - // the linear solver + // the linear solver // using LinearSolver = UMFPackBackend; - using LinearSolver = ILU0BiCGSTABBackend; - auto linearSolver = std::make_shared<LinearSolver>(); - - // the non-linear solver - using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; - NewtonSolver nonLinearSolver(assembler, linearSolver); - - // time loop - timeLoop->start(); do - { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - - // linearize & solve - nonLinearSolver.solve(x, *timeLoop); - - // update the exact time temperature - problem->updateExactTemperature(x, timeLoop->time()+timeLoop->timeStepSize()); - - // make the new solution the old solution - xOld = x; - gridVariables->advanceTimeStep(); - - // advance to the time loop to the next step - timeLoop->advanceTimeStep(); - - // write vtk output - if (timeLoop->timeStepIndex()==0 || timeLoop->timeStepIndex() % vtkOutputInterval == 0 || timeLoop->willBeFinished()) - vtkWriter.write(timeLoop->time()); - - // report statistics of this time step - timeLoop->reportTimeStep(); - - // set new dt as suggested by the newton solver - timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); - - } while (!timeLoop->finished()); - - timeLoop->finalize(leafGridView.comm()); - - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/false); - - return 0; - - } - catch (Dumux::ParameterException &e) - { - std::cerr << std::endl << e << " ---> Abort!" << std::endl; - return 1; - } - catch (Dune::DGFException & e) - { - std::cerr << "DGF exception thrown (" << e << - "). Most likely, the DGF file name is wrong " - "or the DGF file is corrupted, " - "e.g. missing hash at end of file or wrong number (dimensions) of entries." - << " ---> Abort!" << std::endl; - return 2; - } - catch (Dune::Exception &e) - { - std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; - return 3; - } - catch (...) - { - std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; - return 4; - } + using LinearSolver = ILU0BiCGSTABBackend; + auto linearSolver = std::make_shared<LinearSolver>(); + + // the non-linear solver + using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; + NewtonSolver nonLinearSolver(assembler, linearSolver); + + // time loop + timeLoop->start(); do + { + // set previous solution for storage evaluations + assembler->setPreviousSolution(xOld); + + // linearize & solve + nonLinearSolver.solve(x, *timeLoop); + + // update the exact time temperature + problem->updateExactTemperature(x, timeLoop->time()+timeLoop->timeStepSize()); + + // make the new solution the old solution + xOld = x; + gridVariables->advanceTimeStep(); + + // advance to the time loop to the next step + timeLoop->advanceTimeStep(); + + // write vtk output + if (timeLoop->timeStepIndex()==0 || timeLoop->timeStepIndex() % vtkOutputInterval == 0 || timeLoop->willBeFinished()) + vtkWriter.write(timeLoop->time()); + + // report statistics of this time step + timeLoop->reportTimeStep(); + + // set new dt as suggested by the newton solver + timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); + + } while (!timeLoop->finished()); + + timeLoop->finalize(leafGridView.comm()); + + //////////////////////////////////////////////////////////// + // finalize, print dumux message to say goodbye + //////////////////////////////////////////////////////////// + + // print dumux end message + if (mpiHelper.rank() == 0) + DumuxMessage::print(/*firstCall=*/false); + + return 0; + +} +catch (Dumux::ParameterException &e) +{ + std::cerr << std::endl << e << " ---> Abort!" << std::endl; + return 1; +} +catch (Dune::DGFException & e) +{ + std::cerr << "DGF exception thrown (" << e << + "). Most likely, the DGF file name is wrong " + "or the DGF file is corrupted, " + "e.g. missing hash at end of file or wrong number (dimensions) of entries." + << " ---> Abort!" << std::endl; + return 2; +} +catch (Dune::Exception &e) +{ + std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; + return 3; +} +catch (...) +{ + std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; + return 4; +} diff --git a/test/porousmediumflow/1pnc/implicit/test_1p2cni_convection_fv.cc b/test/porousmediumflow/1pnc/implicit/test_1p2cni_convection_fv.cc index 8bfdfd015d..1a555df69c 100644 --- a/test/porousmediumflow/1pnc/implicit/test_1p2cni_convection_fv.cc +++ b/test/porousmediumflow/1pnc/implicit/test_1p2cni_convection_fv.cc @@ -21,185 +21,185 @@ * * \brief test for the 1pnc model */ - #include <config.h> +#include <config.h> - #include "1p2cniconvectionproblem.hh" +#include "1p2cniconvectionproblem.hh" - #include <ctime> - #include <iostream> +#include <ctime> +#include <iostream> - #include <dune/common/parallel/mpihelper.hh> - #include <dune/common/timer.hh> - #include <dune/grid/io/file/dgfparser/dgfexception.hh> - #include <dune/grid/io/file/vtk.hh> - #include <dune/istl/io.hh> +#include <dune/common/parallel/mpihelper.hh> +#include <dune/common/timer.hh> +#include <dune/grid/io/file/dgfparser/dgfexception.hh> +#include <dune/grid/io/file/vtk.hh> +#include <dune/istl/io.hh> - #include <dumux/discretization/methods.hh> +#include <dumux/discretization/methods.hh> - #include <dumux/common/properties.hh> - #include <dumux/common/parameters.hh> - #include <dumux/common/dumuxmessage.hh> - #include <dumux/common/defaultusagemessage.hh> +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> +#include <dumux/common/dumuxmessage.hh> +#include <dumux/common/defaultusagemessage.hh> - #include <dumux/nonlinear/newtonsolver.hh> - #include <dumux/linear/seqsolverbackend.hh> +#include <dumux/nonlinear/newtonsolver.hh> +#include <dumux/linear/seqsolverbackend.hh> - #include <dumux/assembly/fvassembler.hh> +#include <dumux/assembly/fvassembler.hh> - #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> - int main(int argc, char** argv) try - { - using namespace Dumux; +int main(int argc, char** argv) try +{ + using namespace Dumux; - // define the type tag for this problem - using TypeTag = TTAG(TYPETAG); + // define the type tag for this problem + using TypeTag = TTAG(TYPETAG); - //////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// - // initialize MPI, finalize is done automatically on exit - const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); + // initialize MPI, finalize is done automatically on exit + const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); - // print dumux start message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/true); + // print dumux start message + if (mpiHelper.rank() == 0) + DumuxMessage::print(/*firstCall=*/true); - // initialize parameter tree - Parameters::init(argc, argv); + // initialize parameter tree + Parameters::init(argc, argv); - ////////////////////////////////////////////////////////////////////// - // try to create a grid (from the given grid file or the input file) - ///////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + // try to create a grid (from the given grid file or the input file) + ///////////////////////////////////////////////////////////////////// - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); - //////////////////////////////////////////////////////////// - // run instationary non-linear problem on this grid - //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// + // run instationary non-linear problem on this grid + //////////////////////////////////////////////////////////// - // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + // we compute on the leaf grid view + const auto& leafGridView = gridManager.grid().leafGridView(); - // create the finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + // create the finite volume grid geometry + using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); + fvGridGeometry->update(); - // the problem (initial and boundary conditions) - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - auto problem = std::make_shared<Problem>(fvGridGeometry); + // the problem (initial and boundary conditions) + using Problem = typename GET_PROP_TYPE(TypeTag, Problem); + auto problem = std::make_shared<Problem>(fvGridGeometry); - // the solution vector - using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(fvGridGeometry->numDofs()); - problem->applyInitialSolution(x); - auto xOld = x; + // the solution vector + using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); + SolutionVector x(fvGridGeometry->numDofs()); + problem->applyInitialSolution(x); + auto xOld = x; - // the grid variables - using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); - gridVariables->init(x, xOld); + // the grid variables + using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); + auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + gridVariables->init(x, xOld); - // get some time loop parameters - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); - auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); + // get some time loop parameters + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); + auto dt = getParam<Scalar>("TimeLoop.DtInitial"); + auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); - // intialize the vtk output module - VtkOutputModule<TypeTag, GET_PROP_VALUE(TypeTag, PhaseIdx)> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); - using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); - VtkOutputFields::init(vtkWriter); //!< Add model specific output fields - vtkWriter.addField(problem->getExactTemperature(), "temperatureExact"); - vtkWriter.write(0.0); - // output every vtkOutputInterval time step - const auto vtkOutputInterval = getParam<int>("Problem.OutputInterval"); + // intialize the vtk output module + VtkOutputModule<TypeTag, GET_PROP_VALUE(TypeTag, PhaseIdx)> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); + using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); + VtkOutputFields::init(vtkWriter); //!< Add model specific output fields + vtkWriter.addField(problem->getExactTemperature(), "temperatureExact"); + vtkWriter.write(0.0); + // output every vtkOutputInterval time step + const auto vtkOutputInterval = getParam<int>("Problem.OutputInterval"); - // instantiate time loop - auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); - timeLoop->setMaxTimeStepSize(maxDt); + // instantiate time loop + auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); + timeLoop->setMaxTimeStepSize(maxDt); - // the assembler with time loop for instationary problem - using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); + // the assembler with time loop for instationary problem + using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; + auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); - // the linear solver + // the linear solver // using LinearSolver = UMFPackBackend; - using LinearSolver = ILU0BiCGSTABBackend; - auto linearSolver = std::make_shared<LinearSolver>(); - - // the non-linear solver - using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; - NewtonSolver nonLinearSolver(assembler, linearSolver); - - // time loop - timeLoop->start(); do - { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - - // linearize & solve - nonLinearSolver.solve(x, *timeLoop); - - // update the exact time temperature - problem->updateExactTemperature(x, timeLoop->time()+timeLoop->timeStepSize()); - - // make the new solution the old solution - xOld = x; - gridVariables->advanceTimeStep(); - - // advance to the time loop to the next step - timeLoop->advanceTimeStep(); - - // write vtk output - if (timeLoop->timeStepIndex()==0 || timeLoop->timeStepIndex() % vtkOutputInterval == 0 || timeLoop->willBeFinished()) - vtkWriter.write(timeLoop->time()); - - // report statistics of this time step - timeLoop->reportTimeStep(); - - // set new dt as suggested by the newton solver - timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); - - } while (!timeLoop->finished()); - - timeLoop->finalize(leafGridView.comm()); - - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/false); - - return 0; - - } - catch (Dumux::ParameterException &e) - { - std::cerr << std::endl << e << " ---> Abort!" << std::endl; - return 1; - } - catch (Dune::DGFException & e) - { - std::cerr << "DGF exception thrown (" << e << - "). Most likely, the DGF file name is wrong " - "or the DGF file is corrupted, " - "e.g. missing hash at end of file or wrong number (dimensions) of entries." - << " ---> Abort!" << std::endl; - return 2; - } - catch (Dune::Exception &e) - { - std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; - return 3; - } - catch (...) - { - std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; - return 4; - } + using LinearSolver = ILU0BiCGSTABBackend; + auto linearSolver = std::make_shared<LinearSolver>(); + + // the non-linear solver + using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; + NewtonSolver nonLinearSolver(assembler, linearSolver); + + // time loop + timeLoop->start(); do + { + // set previous solution for storage evaluations + assembler->setPreviousSolution(xOld); + + // linearize & solve + nonLinearSolver.solve(x, *timeLoop); + + // update the exact time temperature + problem->updateExactTemperature(x, timeLoop->time()+timeLoop->timeStepSize()); + + // make the new solution the old solution + xOld = x; + gridVariables->advanceTimeStep(); + + // advance to the time loop to the next step + timeLoop->advanceTimeStep(); + + // write vtk output + if (timeLoop->timeStepIndex()==0 || timeLoop->timeStepIndex() % vtkOutputInterval == 0 || timeLoop->willBeFinished()) + vtkWriter.write(timeLoop->time()); + + // report statistics of this time step + timeLoop->reportTimeStep(); + + // set new dt as suggested by the newton solver + timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); + + } while (!timeLoop->finished()); + + timeLoop->finalize(leafGridView.comm()); + + //////////////////////////////////////////////////////////// + // finalize, print dumux message to say goodbye + //////////////////////////////////////////////////////////// + + // print dumux end message + if (mpiHelper.rank() == 0) + DumuxMessage::print(/*firstCall=*/false); + + return 0; + +} +catch (Dumux::ParameterException &e) +{ + std::cerr << std::endl << e << " ---> Abort!" << std::endl; + return 1; +} +catch (Dune::DGFException & e) +{ + std::cerr << "DGF exception thrown (" << e << + "). Most likely, the DGF file name is wrong " + "or the DGF file is corrupted, " + "e.g. missing hash at end of file or wrong number (dimensions) of entries." + << " ---> Abort!" << std::endl; + return 2; +} +catch (Dune::Exception &e) +{ + std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; + return 3; +} +catch (...) +{ + std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; + return 4; +} diff --git a/test/porousmediumflow/1pncmin/implicit/test_1pncminni_fv.cc b/test/porousmediumflow/1pncmin/implicit/test_1pncminni_fv.cc index 1c2903a3fe..12a429b089 100644 --- a/test/porousmediumflow/1pncmin/implicit/test_1pncminni_fv.cc +++ b/test/porousmediumflow/1pncmin/implicit/test_1pncminni_fv.cc @@ -36,6 +36,7 @@ #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include "thermochemproblem.hh" @@ -98,16 +99,15 @@ int main(int argc, char** argv) try // try to create a grid (from the given grid file or the input file) ///////////////////////////////////////////////////////////////////// - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/1pncmin/implicit/thermochemproblem.hh b/test/porousmediumflow/1pncmin/implicit/thermochemproblem.hh index 47eca4d035..6f49329b1c 100644 --- a/test/porousmediumflow/1pncmin/implicit/thermochemproblem.hh +++ b/test/porousmediumflow/1pncmin/implicit/thermochemproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_THERMOCHEM_PROBLEM_HH #define DUMUX_THERMOCHEM_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/porousmediumflow/1pncmin/model.hh> #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/box/properties.hh> diff --git a/test/porousmediumflow/2p/implicit/adaptive/test_2p_adaptive_fv.cc b/test/porousmediumflow/2p/implicit/adaptive/test_2p_adaptive_fv.cc index a2704d6b02..e17049b166 100644 --- a/test/porousmediumflow/2p/implicit/adaptive/test_2p_adaptive_fv.cc +++ b/test/porousmediumflow/2p/implicit/adaptive/test_2p_adaptive_fv.cc @@ -46,6 +46,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include <dumux/adaptive/adapt.hh> #include <dumux/adaptive/markelements.hh> @@ -100,16 +101,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); @@ -149,8 +149,8 @@ int main(int argc, char** argv) try initIndicator.calculate(x); bool wasAdapted = false; - if (markElements(GridCreator::grid(), initIndicator)) - wasAdapted = adapt(GridCreator::grid(), dataTransfer); + if (markElements(gridManager.grid(), initIndicator)) + wasAdapted = adapt(gridManager.grid(), dataTransfer); // update grid data after adaption if (wasAdapted) @@ -165,8 +165,8 @@ int main(int argc, char** argv) try indicator.calculate(x, refineTol, coarsenTol); bool wasAdapted = false; - if (markElements(GridCreator::grid(), indicator)) - wasAdapted = adapt(GridCreator::grid(), dataTransfer); + if (markElements(gridManager.grid(), indicator)) + wasAdapted = adapt(gridManager.grid(), dataTransfer); // update grid data after adaption if (wasAdapted) @@ -220,8 +220,8 @@ int main(int argc, char** argv) try // mark elements and maybe adapt grid bool wasAdapted = false; - if (markElements(GridCreator::grid(), indicator)) - wasAdapted = adapt(GridCreator::grid(), dataTransfer); + if (markElements(gridManager.grid(), indicator)) + wasAdapted = adapt(gridManager.grid(), dataTransfer); if (wasAdapted) { diff --git a/test/porousmediumflow/2p/implicit/boxdfm/problem.hh b/test/porousmediumflow/2p/implicit/boxdfm/problem.hh index 258385a9d7..f09456fef0 100644 --- a/test/porousmediumflow/2p/implicit/boxdfm/problem.hh +++ b/test/porousmediumflow/2p/implicit/boxdfm/problem.hh @@ -23,6 +23,14 @@ #ifndef DUMUX_INCOMPRESSIBLE_TWOPBOXDFM_TEST_PROBLEM_HH #define DUMUX_INCOMPRESSIBLE_TWOPBOXDFM_TEST_PROBLEM_HH +#if HAVE_DUNE_ALUGRID +#include <dune/alugrid/grid.hh> +#endif +#if HAVE_UG +#include <dune/grid/uggrid.hh> +#endif +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/components/trichloroethene.hh> #include <dumux/material/components/simpleh2o.hh> #include <dumux/material/fluidsystems/1pliquid.hh> diff --git a/test/porousmediumflow/2p/implicit/boxdfm/test_2pboxdfm.cc b/test/porousmediumflow/2p/implicit/boxdfm/test_2pboxdfm.cc index dac6d77ed3..cc85df9844 100644 --- a/test/porousmediumflow/2p/implicit/boxdfm/test_2pboxdfm.cc +++ b/test/porousmediumflow/2p/implicit/boxdfm/test_2pboxdfm.cc @@ -47,6 +47,7 @@ #include <dumux/assembly/diffmethod.hh> #include <dumux/discretization/methods.hh> +#include <dumux/io/grid/gridmanager.hh> #include <dumux/porousmediumflow/boxdfm/vtkoutputmodule.hh> @@ -100,16 +101,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/2p/implicit/cornerpoint/problem.hh b/test/porousmediumflow/2p/implicit/cornerpoint/problem.hh index dd80e51306..5850c3b1f6 100644 --- a/test/porousmediumflow/2p/implicit/cornerpoint/problem.hh +++ b/test/porousmediumflow/2p/implicit/cornerpoint/problem.hh @@ -25,7 +25,6 @@ #include <opm/grid/CpGrid.hpp> -#include <dumux/io/cpgridcreator.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/material/components/trichloroethene.hh> @@ -74,9 +73,6 @@ public: using type = TwoPCornerPointTestSpatialParams<FVGridGeometry, Scalar>; }; -// Set the grid creator -SET_TYPE_PROP(TwoPCornerPoint, GridCreator, CpGridCreator); - // Enable caching SET_BOOL_PROP(TwoPCornerPoint, EnableGridVolumeVariablesCache, false); SET_BOOL_PROP(TwoPCornerPoint, EnableGridFluxVariablesCache, false); @@ -105,7 +101,6 @@ class TwoPCornerPointTestProblem : public PorousMediumFlowProblem<TypeTag> using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices; - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); enum { dimWorld = GridView::dimensionworld }; public: @@ -178,7 +173,7 @@ public: { NumEqVector values(0.0); - int eIdx = GridCreator::grid().leafGridView().indexSet().index(element); + int eIdx = this->fvGridGeometry().gridView().indexSet().index(element); if (eIdx == injectionElement_) values[FluidSystem::phase1Idx] = injectionRate_/element.geometry().volume(); diff --git a/test/porousmediumflow/2p/implicit/cornerpoint/spatialparams.hh b/test/porousmediumflow/2p/implicit/cornerpoint/spatialparams.hh index 66daf1148b..1e8ee307f7 100644 --- a/test/porousmediumflow/2p/implicit/cornerpoint/spatialparams.hh +++ b/test/porousmediumflow/2p/implicit/cornerpoint/spatialparams.hh @@ -23,7 +23,7 @@ #ifndef DUMUX_TWOP_CORNERPOINT_TEST_SPATIAL_PARAMS_HH #define DUMUX_TWOP_CORNERPOINT_TEST_SPATIAL_PARAMS_HH -#include <dumux/io/cpgridcreator.hh> +#include <dumux/io/grid/cpgridcreator.hh> #include <dumux/material/spatialparams/fv.hh> #include <dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh> #include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh> @@ -44,7 +44,6 @@ class TwoPCornerPointTestSpatialParams using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ThisType = TwoPCornerPointTestSpatialParams<FVGridGeometry, Scalar>; using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; - using GridCreator = CpGridCreator; static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -63,11 +62,11 @@ public: { homogeneous_ = getParam<bool>("Problem.Homogeneous"); - const std::vector<int>& globalCell = GridCreator::grid().globalCell(); + const std::vector<int>& globalCell = this->fvGridGeometry().grid().globalCell(); - if (GridCreator::deck().hasKeyword("PORO")) { + if (CpGridCreator::deck().hasKeyword("PORO")) { std::cout << "Found PORO..." << std::endl; - std::vector<double> eclVector = GridCreator::deck().getKeyword("PORO").getRawDoubleData(); + std::vector<double> eclVector = CpGridCreator::deck().getKeyword("PORO").getRawDoubleData(); porosity_.resize(globalCell.size()); for (size_t i = 0; i < globalCell.size(); ++i) { @@ -78,9 +77,9 @@ public: } } - if (GridCreator::deck().hasKeyword("PERMX")) { + if (CpGridCreator::deck().hasKeyword("PERMX")) { std::cout << "Found PERMX..." << std::endl; - std::vector<double> eclVector = GridCreator::deck().getKeyword("PERMX").getRawDoubleData(); + std::vector<double> eclVector = CpGridCreator::deck().getKeyword("PERMX").getRawDoubleData(); permX_.resize(globalCell.size()); for (size_t i = 0; i < globalCell.size(); ++i) { @@ -92,9 +91,9 @@ public: } } - if (GridCreator::deck().hasKeyword("PERMZ")) { + if (CpGridCreator::deck().hasKeyword("PERMZ")) { std::cout << "Found PERMZ..." << std::endl; - std::vector<double> eclVector = GridCreator::deck().getKeyword("PERMZ").getRawDoubleData(); + std::vector<double> eclVector = CpGridCreator::deck().getKeyword("PERMZ").getRawDoubleData(); permZ_.resize(globalCell.size()); for (size_t i = 0; i < globalCell.size(); ++i) { @@ -129,7 +128,7 @@ public: const SubControlVolume& scv, const ElementSolution& elemSol) const { - int eIdx = GridCreator::grid().leafGridView().indexSet().index(element); + int eIdx = this->fvGridGeometry().gridView().indexSet().index(element); PermeabilityType K(0); K[0][0] = K[1][1] = permX_[eIdx]; @@ -151,7 +150,7 @@ public: const SubControlVolume& scv, const ElementSolution& elemSol) const { - int eIdx = GridCreator::grid().leafGridView().indexSet().index(element); + int eIdx = this->fvGridGeometry().gridView().indexSet().index(element); return porosity_[eIdx]; } diff --git a/test/porousmediumflow/2p/implicit/cornerpoint/test_2p_cornerpoint.cc b/test/porousmediumflow/2p/implicit/cornerpoint/test_2p_cornerpoint.cc index b291a8eef6..eb7436cc7a 100644 --- a/test/porousmediumflow/2p/implicit/cornerpoint/test_2p_cornerpoint.cc +++ b/test/porousmediumflow/2p/implicit/cornerpoint/test_2p_cornerpoint.cc @@ -56,6 +56,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/cpgridcreator.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -107,16 +108,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + CpGridCreator::makeGrid(); + CpGridCreator::loadBalance(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = CpGridCreator::grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/2p/implicit/fracture/test_2p_fracture_fv.cc b/test/porousmediumflow/2p/implicit/fracture/test_2p_fracture_fv.cc index 6090dc310d..ca4bbbc07f 100644 --- a/test/porousmediumflow/2p/implicit/fracture/test_2p_fracture_fv.cc +++ b/test/porousmediumflow/2p/implicit/fracture/test_2p_fracture_fv.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -82,16 +83,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/2p/implicit/incompressible/problem.hh b/test/porousmediumflow/2p/implicit/incompressible/problem.hh index bf8cb8a6b7..5d630ec595 100644 --- a/test/porousmediumflow/2p/implicit/incompressible/problem.hh +++ b/test/porousmediumflow/2p/implicit/incompressible/problem.hh @@ -23,6 +23,8 @@ #ifndef DUMUX_INCOMPRESSIBLE_TWOP_TEST_PROBLEM_HH #define DUMUX_INCOMPRESSIBLE_TWOP_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/box/properties.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/cellcentered/mpfa/properties.hh> diff --git a/test/porousmediumflow/2p/implicit/incompressible/test_2p_fv.cc b/test/porousmediumflow/2p/implicit/incompressible/test_2p_fv.cc index daac6cf940..4df2e90942 100644 --- a/test/porousmediumflow/2p/implicit/incompressible/test_2p_fv.cc +++ b/test/porousmediumflow/2p/implicit/incompressible/test_2p_fv.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -100,16 +101,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/2p/implicit/nonisothermal/problem.hh b/test/porousmediumflow/2p/implicit/nonisothermal/problem.hh index c75513a249..b94828c3ef 100644 --- a/test/porousmediumflow/2p/implicit/nonisothermal/problem.hh +++ b/test/porousmediumflow/2p/implicit/nonisothermal/problem.hh @@ -27,6 +27,14 @@ #ifndef DUMUX_INJECTION_PROBLEM_2PNI_HH #define DUMUX_INJECTION_PROBLEM_2PNI_HH +#if HAVE_DUNE_ALUGRID +#include <dune/alugrid/grid.hh> +#endif +#if HAVE_UG +#include <dune/grid/uggrid.hh> +#endif +#include <dune/grid/yaspgrid.hh> + #include <dumux/common/properties.hh> #include <dumux/porousmediumflow/2p/model.hh> #include <dumux/porousmediumflow/problem.hh> diff --git a/test/porousmediumflow/2p/implicit/nonisothermal/test_2pni_fv.cc b/test/porousmediumflow/2p/implicit/nonisothermal/test_2pni_fv.cc index 22b8215f5e..81228335c8 100644 --- a/test/porousmediumflow/2p/implicit/nonisothermal/test_2pni_fv.cc +++ b/test/porousmediumflow/2p/implicit/nonisothermal/test_2pni_fv.cc @@ -43,6 +43,7 @@ #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include "problem.hh" @@ -93,16 +94,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/2p/sequential/test_3d2pproblem.hh b/test/porousmediumflow/2p/sequential/test_3d2pproblem.hh index ec8494cf5b..f79049eec1 100644 --- a/test/porousmediumflow/2p/sequential/test_3d2pproblem.hh +++ b/test/porousmediumflow/2p/sequential/test_3d2pproblem.hh @@ -24,6 +24,9 @@ #ifndef DUMUX_TEST_3D2P_PROBLEM_HH #define DUMUX_TEST_3D2P_PROBLEM_HH +#if HAVE_DUNE_ALUGRID +#include <dune/alugrid/grid.hh> +#endif #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/fluidsystems/1pgas.hh> diff --git a/test/porousmediumflow/2p/sequential/test_impesadaptiveproblem.hh b/test/porousmediumflow/2p/sequential/test_impesadaptiveproblem.hh index 76e27426be..a71ae2f09d 100644 --- a/test/porousmediumflow/2p/sequential/test_impesadaptiveproblem.hh +++ b/test/porousmediumflow/2p/sequential/test_impesadaptiveproblem.hh @@ -24,6 +24,9 @@ #ifndef DUMUX_TEST_IMPES_ADAPTIVE_PROBLEM_HH #define DUMUX_TEST_IMPES_ADAPTIVE_PROBLEM_HH +#if HAVE_DUNE_ALUGRID +#include <dune/alugrid/grid.hh> +#endif #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/components/simpleh2o.hh> diff --git a/test/porousmediumflow/2p/sequential/test_impesproblem.hh b/test/porousmediumflow/2p/sequential/test_impesproblem.hh index 24b57e8a43..7dafa1e5ca 100644 --- a/test/porousmediumflow/2p/sequential/test_impesproblem.hh +++ b/test/porousmediumflow/2p/sequential/test_impesproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_TEST_IMPES_PROBLEM_HH #define DUMUX_TEST_IMPES_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/components/simpleh2o.hh> @@ -98,9 +100,8 @@ NEW_TYPE_TAG(IMPESTestWithAMGTypeTag, INHERITS_FROM(IMPESTestTypeTag)); SET_TYPE_PROP(IMPESTestWithAMGTypeTag, LinearSolver, AMGBackend<TypeTag>); // Set the grid type SET_TYPE_PROP(IMPESTestWithAMGTypeTag, Grid, Dune::YaspGrid<2>); -// Set the grid creator -SET_TYPE_PROP(IMPESTestWithAMGTypeTag, GridCreator, GridCreator<TypeTag>); -} + +} // end namespace Properties /*! * \ingroup SequentialTwoPTests diff --git a/test/porousmediumflow/2p/sequential/test_mpfa2pproblem.hh b/test/porousmediumflow/2p/sequential/test_mpfa2pproblem.hh index 302c32854f..dc8fe92c85 100644 --- a/test/porousmediumflow/2p/sequential/test_mpfa2pproblem.hh +++ b/test/porousmediumflow/2p/sequential/test_mpfa2pproblem.hh @@ -24,6 +24,11 @@ #ifndef DUMUX_TEST_MPFA2P_PROBLEM_HH #define DUMUX_TEST_MPFA2P_PROBLEM_HH +#if HAVE_UG +#include <dune/grid/uggrid.hh> +#endif +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/fluidsystems/2pimmiscible.hh> #include <dumux/material/fluidsystems/1pliquid.hh> #include <dumux/material/components/simpleh2o.hh> diff --git a/test/porousmediumflow/2p/sequential/test_transportproblem.hh b/test/porousmediumflow/2p/sequential/test_transportproblem.hh index c8c80c7863..bd08a4799a 100644 --- a/test/porousmediumflow/2p/sequential/test_transportproblem.hh +++ b/test/porousmediumflow/2p/sequential/test_transportproblem.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_TEST_TRANSPORT_PROBLEM_HH #define DUMUX_TEST_TRANSPORT_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> #include <dune/grid/io/file/dgfparser/dgfyasp.hh> #include <dumux/material/fluidsystems/1pliquid.hh> diff --git a/test/porousmediumflow/2p1c/implicit/steaminjectionproblem.hh b/test/porousmediumflow/2p1c/implicit/steaminjectionproblem.hh index 6baa7d3514..1ca802b5a2 100644 --- a/test/porousmediumflow/2p1c/implicit/steaminjectionproblem.hh +++ b/test/porousmediumflow/2p1c/implicit/steaminjectionproblem.hh @@ -25,6 +25,8 @@ #ifndef DUMUX_STEAM_INJECTIONPROBLEM_HH #define DUMUX_STEAM_INJECTIONPROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/porousmediumflow/2p1c/model.hh> diff --git a/test/porousmediumflow/2p1c/implicit/test_2p1c_fv.cc b/test/porousmediumflow/2p1c/implicit/test_2p1c_fv.cc index f6ec0b61d7..9f869544a5 100644 --- a/test/porousmediumflow/2p1c/implicit/test_2p1c_fv.cc +++ b/test/porousmediumflow/2p1c/implicit/test_2p1c_fv.cc @@ -20,135 +20,135 @@ * \file * * \brief test for the 1pnc model - */ - #include <config.h> +*/ +#include <config.h> - #include "steaminjectionproblem.hh" +#include "steaminjectionproblem.hh" - #include <ctime> - #include <iostream> +#include <ctime> +#include <iostream> - #include <dune/common/parallel/mpihelper.hh> - #include <dune/common/timer.hh> - #include <dune/grid/io/file/dgfparser/dgfexception.hh> - #include <dune/grid/io/file/vtk.hh> - #include <dune/istl/io.hh> +#include <dune/common/parallel/mpihelper.hh> +#include <dune/common/timer.hh> +#include <dune/grid/io/file/dgfparser/dgfexception.hh> +#include <dune/grid/io/file/vtk.hh> +#include <dune/istl/io.hh> - #include <dumux/discretization/methods.hh> +#include <dumux/discretization/methods.hh> - #include <dumux/common/properties.hh> - #include <dumux/common/parameters.hh> - #include <dumux/common/dumuxmessage.hh> - #include <dumux/common/defaultusagemessage.hh> +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> +#include <dumux/common/dumuxmessage.hh> +#include <dumux/common/defaultusagemessage.hh> - #include <dumux/linear/seqsolverbackend.hh> - #include <dumux/nonlinear/privarswitchnewtonsolver.hh> +#include <dumux/linear/seqsolverbackend.hh> +#include <dumux/nonlinear/privarswitchnewtonsolver.hh> - #include <dumux/assembly/fvassembler.hh> +#include <dumux/assembly/fvassembler.hh> - #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> - int main(int argc, char** argv) try - { - using namespace Dumux; +int main(int argc, char** argv) try +{ + using namespace Dumux; - // define the type tag for this problem - using TypeTag = TTAG(TYPETAG); + // define the type tag for this problem + using TypeTag = TTAG(TYPETAG); - //////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// - // initialize MPI, finalize is done automatically on exit - const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); + // initialize MPI, finalize is done automatically on exit + const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); - // print dumux start message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/true); + // print dumux start message + if (mpiHelper.rank() == 0) + DumuxMessage::print(/*firstCall=*/true); - // initialize parameter tree - Parameters::init(argc, argv); + // initialize parameter tree + Parameters::init(argc, argv); - ////////////////////////////////////////////////////////////////////// - // try to create a grid (from the given grid file or the input file) - ///////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + // try to create a grid (from the given grid file or the input file) + ///////////////////////////////////////////////////////////////////// - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); - //////////////////////////////////////////////////////////// - // run instationary non-linear problem on this grid - //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// + // run instationary non-linear problem on this grid + //////////////////////////////////////////////////////////// - // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + // we compute on the leaf grid view + const auto& leafGridView = gridManager.grid().leafGridView(); - // create the finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + // create the finite volume grid geometry + using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); + fvGridGeometry->update(); - // the problem (initial and boundary conditions) - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - auto problem = std::make_shared<Problem>(fvGridGeometry); + // the problem (initial and boundary conditions) + using Problem = typename GET_PROP_TYPE(TypeTag, Problem); + auto problem = std::make_shared<Problem>(fvGridGeometry); - // the solution vector - using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(fvGridGeometry->numDofs()); - problem->applyInitialSolution(x); - auto xOld = x; + // the solution vector + using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); + SolutionVector x(fvGridGeometry->numDofs()); + problem->applyInitialSolution(x); + auto xOld = x; - // the grid variables - using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); - gridVariables->init(x, xOld); + // the grid variables + using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); + auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + gridVariables->init(x, xOld); - // get some time loop parameters - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); - auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); + // get some time loop parameters + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); + auto dt = getParam<Scalar>("TimeLoop.DtInitial"); + auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); - // intialize the vtk output module - VtkOutputModule<TypeTag> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); - using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); - VtkOutputFields::init(vtkWriter); //!< Add model specific output fields - vtkWriter.write(0.0); + // intialize the vtk output module + VtkOutputModule<TypeTag> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); + using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); + VtkOutputFields::init(vtkWriter); //!< Add model specific output fields + vtkWriter.write(0.0); - // instantiate time loop - auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); - timeLoop->setMaxTimeStepSize(maxDt); + // instantiate time loop + auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); + timeLoop->setMaxTimeStepSize(maxDt); - // the assembler with time loop for instationary problem - using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); + // the assembler with time loop for instationary problem + using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; + auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); - // the linear solver - using LinearSolver = ILU0BiCGSTABBackend; - auto linearSolver = std::make_shared<LinearSolver>(); + // the linear solver + using LinearSolver = ILU0BiCGSTABBackend; + auto linearSolver = std::make_shared<LinearSolver>(); - // the non-linear solver - using PrimaryVariableSwitch = typename GET_PROP_TYPE(TypeTag, PrimaryVariableSwitch); - using NewtonSolver = Dumux::PriVarSwitchNewtonSolver<Assembler, LinearSolver, PrimaryVariableSwitch>; - NewtonSolver nonLinearSolver(assembler, linearSolver); + // the non-linear solver + using PrimaryVariableSwitch = typename GET_PROP_TYPE(TypeTag, PrimaryVariableSwitch); + using NewtonSolver = Dumux::PriVarSwitchNewtonSolver<Assembler, LinearSolver, PrimaryVariableSwitch>; + NewtonSolver nonLinearSolver(assembler, linearSolver); - // time loop - timeLoop->start(); do - { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); + // time loop + timeLoop->start(); do + { + // set previous solution for storage evaluations + assembler->setPreviousSolution(xOld); - // solve the non-linear system with time step control - nonLinearSolver.solve(x, *timeLoop); + // solve the non-linear system with time step control + nonLinearSolver.solve(x, *timeLoop); - // make the new solution the old solution - xOld = x; - gridVariables->advanceTimeStep(); + // make the new solution the old solution + xOld = x; + gridVariables->advanceTimeStep(); - // advance to the time loop to the next step - timeLoop->advanceTimeStep(); + // advance to the time loop to the next step + timeLoop->advanceTimeStep(); - // write vtk output + // write vtk output vtkWriter.write(timeLoop->time()); // report statistics of this time step @@ -157,42 +157,42 @@ // set new dt as suggested by the newton solver timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); - } while (!timeLoop->finished()); - - timeLoop->finalize(leafGridView.comm()); - - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/false); - - return 0; - - } - catch (Dumux::ParameterException &e) - { - std::cerr << std::endl << e << " ---> Abort!" << std::endl; - return 1; - } - catch (Dune::DGFException & e) - { - std::cerr << "DGF exception thrown (" << e << - "). Most likely, the DGF file name is wrong " - "or the DGF file is corrupted, " - "e.g. missing hash at end of file or wrong number (dimensions) of entries." - << " ---> Abort!" << std::endl; - return 2; - } - catch (Dune::Exception &e) - { - std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; - return 3; - } - catch (...) - { - std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; - return 4; - } + } while (!timeLoop->finished()); + + timeLoop->finalize(leafGridView.comm()); + + //////////////////////////////////////////////////////////// + // finalize, print dumux message to say goodbye + //////////////////////////////////////////////////////////// + + // print dumux end message + if (mpiHelper.rank() == 0) + DumuxMessage::print(/*firstCall=*/false); + + return 0; + +} +catch (Dumux::ParameterException &e) +{ + std::cerr << std::endl << e << " ---> Abort!" << std::endl; + return 1; +} +catch (Dune::DGFException & e) +{ + std::cerr << "DGF exception thrown (" << e << + "). Most likely, the DGF file name is wrong " + "or the DGF file is corrupted, " + "e.g. missing hash at end of file or wrong number (dimensions) of entries." + << " ---> Abort!" << std::endl; + return 2; +} +catch (Dune::Exception &e) +{ + std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; + return 3; +} +catch (...) +{ + std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; + return 4; +} diff --git a/test/porousmediumflow/2p2c/implicit/injectionproblem.hh b/test/porousmediumflow/2p2c/implicit/injectionproblem.hh index a68d033caf..b166498486 100644 --- a/test/porousmediumflow/2p2c/implicit/injectionproblem.hh +++ b/test/porousmediumflow/2p2c/implicit/injectionproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_INJECTION_PROBLEM_HH #define DUMUX_INJECTION_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/mpfa/properties.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/box/properties.hh> diff --git a/test/porousmediumflow/2p2c/implicit/mpnccomparison/test_2p2c_comparison_fv.cc b/test/porousmediumflow/2p2c/implicit/mpnccomparison/test_2p2c_comparison_fv.cc index 6d481bae8a..1aeb4f518d 100644 --- a/test/porousmediumflow/2p2c/implicit/mpnccomparison/test_2p2c_comparison_fv.cc +++ b/test/porousmediumflow/2p2c/implicit/mpnccomparison/test_2p2c_comparison_fv.cc @@ -44,6 +44,7 @@ #include <dumux/assembly/diffmethod.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include "2p2c_comparison_problem.hh" @@ -94,16 +95,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc b/test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc index 1b86e04ba7..2e6f3fe159 100644 --- a/test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc +++ b/test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc @@ -46,6 +46,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> // the problem definitions #include "injectionproblem.hh" @@ -69,16 +70,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/2p2c/implicit/waterairproblem.hh b/test/porousmediumflow/2p2c/implicit/waterairproblem.hh index cfbc5518d3..4842f3329a 100644 --- a/test/porousmediumflow/2p2c/implicit/waterairproblem.hh +++ b/test/porousmediumflow/2p2c/implicit/waterairproblem.hh @@ -25,6 +25,8 @@ #ifndef DUMUX_WATER_AIR_PROBLEM_HH #define DUMUX_WATER_AIR_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/discretization/methods.hh> diff --git a/test/porousmediumflow/2p2c/sequential/test_adaptive2p2c2dproblem.hh b/test/porousmediumflow/2p2c/sequential/test_adaptive2p2c2dproblem.hh index 9d7965b0fd..8e93d1e721 100644 --- a/test/porousmediumflow/2p2c/sequential/test_adaptive2p2c2dproblem.hh +++ b/test/porousmediumflow/2p2c/sequential/test_adaptive2p2c2dproblem.hh @@ -24,6 +24,11 @@ #ifndef DUMUX_TEST_ADAPTIVE2D_2P2C_PROBLEM_HH #define DUMUX_TEST_ADAPTIVE2D_2P2C_PROBLEM_HH +#if HAVE_UG +#include <dune/grid/uggrid.hh> +#endif +#include <dune/grid/yaspgrid.hh> + #include <dumux/common/math.hh> #include <dumux/porousmediumflow/2p2c/sequential/adaptiveproperties.hh> #include <dumux/porousmediumflow/2p2c/sequential/problem.hh> diff --git a/test/porousmediumflow/2p2c/sequential/test_adaptive2p2c3dproblem.hh b/test/porousmediumflow/2p2c/sequential/test_adaptive2p2c3dproblem.hh index 4657fded67..cff99b2e3d 100644 --- a/test/porousmediumflow/2p2c/sequential/test_adaptive2p2c3dproblem.hh +++ b/test/porousmediumflow/2p2c/sequential/test_adaptive2p2c3dproblem.hh @@ -24,6 +24,11 @@ #ifndef DUMUX_TEST_ADAPTIVE3D_2P2C_PROBLEM_HH #define DUMUX_TEST_ADAPTIVE3D_2P2C_PROBLEM_HH +#if HAVE_UG +#include <dune/grid/uggrid.hh> +#endif +#include <dune/grid/yaspgrid.hh> + #include <dumux/common/math.hh> #include <dumux/porousmediumflow/2p2c/sequential/adaptiveproperties.hh> #include <dumux/porousmediumflow/2p2c/sequential/problem.hh> diff --git a/test/porousmediumflow/2p2c/sequential/test_dec2p2cproblem.hh b/test/porousmediumflow/2p2c/sequential/test_dec2p2cproblem.hh index 7f208d5bea..6148999c24 100644 --- a/test/porousmediumflow/2p2c/sequential/test_dec2p2cproblem.hh +++ b/test/porousmediumflow/2p2c/sequential/test_dec2p2cproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_TEST_2P2C_PROBLEM_HH #define DUMUX_TEST_2P2C_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/porousmediumflow/2p2c/sequential/problem.hh> #include <dumux/porousmediumflow/2p2c/sequential/fvpressure.hh> #include <dumux/porousmediumflow/2p2c/sequential/fvtransport.hh> diff --git a/test/porousmediumflow/2p2c/sequential/test_multiphysics2p2cproblem.hh b/test/porousmediumflow/2p2c/sequential/test_multiphysics2p2cproblem.hh index f1527b6086..619ede2893 100644 --- a/test/porousmediumflow/2p2c/sequential/test_multiphysics2p2cproblem.hh +++ b/test/porousmediumflow/2p2c/sequential/test_multiphysics2p2cproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_TEST_2P2C_PROBLEM_HH #define DUMUX_TEST_2P2C_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/porousmediumflow/2p2c/sequential/problem.hh> #include <dumux/porousmediumflow/2p2c/sequential/fvpressuremultiphysics.hh> #include <dumux/porousmediumflow/2p2c/sequential/fvtransportmultiphysics.hh> diff --git a/test/porousmediumflow/2pnc/implicit/2pncdiffusionproblem.hh b/test/porousmediumflow/2pnc/implicit/2pncdiffusionproblem.hh index cd1f3a0ac4..5296da5488 100644 --- a/test/porousmediumflow/2pnc/implicit/2pncdiffusionproblem.hh +++ b/test/porousmediumflow/2pnc/implicit/2pncdiffusionproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_TWOPNC_DIFFUSION_PROBLEM_HH #define DUMUX_TWOPNC_DIFFUSION_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/cellcentered/mpfa/properties.hh> #include <dumux/porousmediumflow/2pnc/model.hh> diff --git a/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh b/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh index c4f2e2037d..f6fec3a4f9 100644 --- a/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh +++ b/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_FUELCELL_PROBLEM_HH #define DUMUX_FUELCELL_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/box/properties.hh> diff --git a/test/porousmediumflow/2pnc/implicit/test_2pnc_fv.cc b/test/porousmediumflow/2pnc/implicit/test_2pnc_fv.cc index 21750d4981..8b4349cbb6 100644 --- a/test/porousmediumflow/2pnc/implicit/test_2pnc_fv.cc +++ b/test/porousmediumflow/2pnc/implicit/test_2pnc_fv.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include "fuelcellproblem.hh" @@ -93,16 +94,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/2pnc/implicit/test_cc2pnc_diffusion.cc b/test/porousmediumflow/2pnc/implicit/test_cc2pnc_diffusion.cc index 31870b972c..eaa00f5ba1 100644 --- a/test/porousmediumflow/2pnc/implicit/test_cc2pnc_diffusion.cc +++ b/test/porousmediumflow/2pnc/implicit/test_cc2pnc_diffusion.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -91,16 +92,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/2pncmin/implicit/dissolutionproblem.hh b/test/porousmediumflow/2pncmin/implicit/dissolutionproblem.hh index de3a949069..d64422a548 100644 --- a/test/porousmediumflow/2pncmin/implicit/dissolutionproblem.hh +++ b/test/porousmediumflow/2pncmin/implicit/dissolutionproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_DISSOLUTION_PROBLEM_HH #define DUMUX_DISSOLUTION_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/methods.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> diff --git a/test/porousmediumflow/2pncmin/implicit/test_2pncmin_fv.cc b/test/porousmediumflow/2pncmin/implicit/test_2pncmin_fv.cc index 1ccc7b74a2..47c64c82c1 100644 --- a/test/porousmediumflow/2pncmin/implicit/test_2pncmin_fv.cc +++ b/test/porousmediumflow/2pncmin/implicit/test_2pncmin_fv.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -91,16 +92,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh b/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh index 87f1f03db6..49fc43ed79 100644 --- a/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh +++ b/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh @@ -25,7 +25,8 @@ #ifndef DUMUX_3PNI_CONDUCTION_PROBLEM_HH #define DUMUX_3PNI_CONDUCTION_PROBLEM_HH -#include <math.h> +#include <cmath> +#include <dune/grid/yaspgrid.hh> #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> diff --git a/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh b/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh index a08cfca359..8e3f52422b 100644 --- a/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh +++ b/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh @@ -25,7 +25,8 @@ #ifndef DUMUX_3PNI_CONVECTION_PROBLEM_HH #define DUMUX_3PNI_CONVECTION_PROBLEM_HH -#include <math.h> +#include <cmath> +#include <dune/grid/yaspgrid.hh> #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> diff --git a/test/porousmediumflow/3p/implicit/test_3p_fv.cc b/test/porousmediumflow/3p/implicit/test_3p_fv.cc index 6a17a142b3..de385c2320 100644 --- a/test/porousmediumflow/3p/implicit/test_3p_fv.cc +++ b/test/porousmediumflow/3p/implicit/test_3p_fv.cc @@ -47,6 +47,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -98,16 +99,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/3p/implicit/test_3pni_fv_conduction.cc b/test/porousmediumflow/3p/implicit/test_3pni_fv_conduction.cc index 7ea429bfed..d04de7bf5e 100644 --- a/test/porousmediumflow/3p/implicit/test_3pni_fv_conduction.cc +++ b/test/porousmediumflow/3p/implicit/test_3pni_fv_conduction.cc @@ -47,6 +47,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -98,16 +99,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/3p/implicit/test_3pni_fv_convection.cc b/test/porousmediumflow/3p/implicit/test_3pni_fv_convection.cc index dcaf2bcac8..b36e7ffd66 100644 --- a/test/porousmediumflow/3p/implicit/test_3pni_fv_convection.cc +++ b/test/porousmediumflow/3p/implicit/test_3pni_fv_convection.cc @@ -47,6 +47,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -98,16 +99,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/3p3c/implicit/columnxylolproblem.hh b/test/porousmediumflow/3p3c/implicit/columnxylolproblem.hh index 1afb0749ba..10c08741bc 100644 --- a/test/porousmediumflow/3p3c/implicit/columnxylolproblem.hh +++ b/test/porousmediumflow/3p3c/implicit/columnxylolproblem.hh @@ -25,6 +25,8 @@ #ifndef DUMUX_COLUMNXYLOLPROBLEM_HH #define DUMUX_COLUMNXYLOLPROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/material/fluidsystems/h2oairxylene.hh> #include <dumux/material/solidstates/compositionalsolidstate.hh> #include <dumux/material/solidsystems/compositionalsolidphase.hh> diff --git a/test/porousmediumflow/3p3c/implicit/infiltration3p3cproblem.hh b/test/porousmediumflow/3p3c/implicit/infiltration3p3cproblem.hh index 711383004d..55bd88117d 100644 --- a/test/porousmediumflow/3p3c/implicit/infiltration3p3cproblem.hh +++ b/test/porousmediumflow/3p3c/implicit/infiltration3p3cproblem.hh @@ -25,6 +25,8 @@ #ifndef DUMUX_INFILTRATION_THREEPTHREEC_PROBLEM_HH #define DUMUX_INFILTRATION_THREEPTHREEC_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/porousmediumflow/problem.hh> diff --git a/test/porousmediumflow/3p3c/implicit/kuevetteproblem.hh b/test/porousmediumflow/3p3c/implicit/kuevetteproblem.hh index 0fbc105e51..88c7601ee4 100644 --- a/test/porousmediumflow/3p3c/implicit/kuevetteproblem.hh +++ b/test/porousmediumflow/3p3c/implicit/kuevetteproblem.hh @@ -27,6 +27,7 @@ #define DUMUX_KUEVETTE3P3CNIPROBLEM_HH #include <dune/common/float_cmp.hh> +#include <dune/grid/yaspgrid.hh> #include <dumux/material/fluidsystems/h2oairmesitylene.hh> #include <dumux/material/components/constant.hh> diff --git a/test/porousmediumflow/3p3c/implicit/test_3p3c_fv.cc b/test/porousmediumflow/3p3c/implicit/test_3p3c_fv.cc index d656cad00b..86c7031199 100644 --- a/test/porousmediumflow/3p3c/implicit/test_3p3c_fv.cc +++ b/test/porousmediumflow/3p3c/implicit/test_3p3c_fv.cc @@ -45,6 +45,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include "infiltration3p3cproblem.hh" #include "kuevetteproblem.hh" @@ -98,16 +99,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh b/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh index 6e6e7c5f2b..a5733fecd7 100644 --- a/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh +++ b/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_SAGDPROBLEM_HH #define DUMUX_SAGDPROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/porousmediumflow/problem.hh> #include <dumux/discretization/box/properties.hh> diff --git a/test/porousmediumflow/3pwateroil/implicit/test_box3pwateroil.cc b/test/porousmediumflow/3pwateroil/implicit/test_box3pwateroil.cc index bbf72d2633..e809fc4149 100644 --- a/test/porousmediumflow/3pwateroil/implicit/test_box3pwateroil.cc +++ b/test/porousmediumflow/3pwateroil/implicit/test_box3pwateroil.cc @@ -45,6 +45,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include "3pwateroilsagdproblem.hh" @@ -95,16 +96,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/co2/implicit/heterogeneousproblem.hh b/test/porousmediumflow/co2/implicit/heterogeneousproblem.hh index 6a0765938a..9447df13b1 100644 --- a/test/porousmediumflow/co2/implicit/heterogeneousproblem.hh +++ b/test/porousmediumflow/co2/implicit/heterogeneousproblem.hh @@ -24,6 +24,10 @@ #ifndef DUMUX_HETEROGENEOUS_PROBLEM_HH #define DUMUX_HETEROGENEOUS_PROBLEM_HH +#if HAVE_DUNE_ALUGRID +#include <dune/alugrid/grid.hh> +#endif + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/box/properties.hh> @@ -55,15 +59,14 @@ NEW_TYPE_TAG(HeterogeneousBoxTypeTag, INHERITS_FROM(BoxModel, HeterogeneousTypeT NEW_TYPE_TAG(HeterogeneousCCTpfaTypeTag, INHERITS_FROM(CCTpfaModel, HeterogeneousTypeTag)); //Set the grid type -#if HAVE_DUNE_ALUGRID SET_TYPE_PROP(HeterogeneousTypeTag, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>); -#endif // Set the problem property SET_TYPE_PROP(HeterogeneousTypeTag, Problem, HeterogeneousProblem<TypeTag>); // Set the spatial parameters -SET_TYPE_PROP(HeterogeneousTypeTag, SpatialParams, HeterogeneousSpatialParams<TypeTag>); +SET_TYPE_PROP(HeterogeneousTypeTag, SpatialParams, HeterogeneousSpatialParams<typename GET_PROP_TYPE(TypeTag, FVGridGeometry), + typename GET_PROP_TYPE(TypeTag, Scalar)>); // Set fluid configuration SET_TYPE_PROP(HeterogeneousTypeTag, FluidSystem, FluidSystems::BrineCO2<typename GET_PROP_TYPE(TypeTag, Scalar), @@ -84,7 +87,8 @@ SET_TYPE_PROP(HeterogeneousNITypeTag, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune SET_TYPE_PROP(HeterogeneousNITypeTag, Problem, HeterogeneousProblem<TypeTag>); // Set the spatial parameters -SET_TYPE_PROP(HeterogeneousNITypeTag, SpatialParams, HeterogeneousSpatialParams<TypeTag>); +SET_TYPE_PROP(HeterogeneousNITypeTag, SpatialParams,HeterogeneousSpatialParams<typename GET_PROP_TYPE(TypeTag, FVGridGeometry), + typename GET_PROP_TYPE(TypeTag, Scalar)>); // Set fluid configuration SET_TYPE_PROP(HeterogeneousNITypeTag, FluidSystem, FluidSystems::BrineCO2<typename GET_PROP_TYPE(TypeTag, Scalar), @@ -185,8 +189,9 @@ public: * \param timeManager The time manager * \param gridView The grid view */ - HeterogeneousProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + template<class SpatialParams> + HeterogeneousProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, std::shared_ptr<SpatialParams> spatialParams) + : ParentType(fvGridGeometry, spatialParams) , injectionTop_(1) , injectionBottom_(2) , dirichletBoundary_(3) diff --git a/test/porousmediumflow/co2/implicit/heterogeneousspatialparameters.hh b/test/porousmediumflow/co2/implicit/heterogeneousspatialparameters.hh index dd7ce0edea..1f685f8939 100644 --- a/test/porousmediumflow/co2/implicit/heterogeneousspatialparameters.hh +++ b/test/porousmediumflow/co2/implicit/heterogeneousspatialparameters.hh @@ -27,6 +27,7 @@ #ifndef DUMUX_HETEROGENEOUS_SPATIAL_PARAMS_HH #define DUMUX_HETEROGENEOUS_SPATIAL_PARAMS_HH +#include <dumux/io/grid/griddata.hh> #include <dumux/material/spatialparams/fv.hh> #include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh> #include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh> @@ -42,21 +43,19 @@ namespace Dumux { * problem which uses the non-isothermal or isothermal CO2 * fully implicit model. */ -template<class TypeTag> +template<class FVGridGeometry, class Scalar> class HeterogeneousSpatialParams -: public FVSpatialParams<typename GET_PROP_TYPE(TypeTag, FVGridGeometry), - typename GET_PROP_TYPE(TypeTag, Scalar), - HeterogeneousSpatialParams<TypeTag>> +: public FVSpatialParams<FVGridGeometry, + Scalar, + HeterogeneousSpatialParams<FVGridGeometry, Scalar>> { - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using Grid = typename FVGridGeometry::Grid; using GridView = typename FVGridGeometry::GridView; using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using Element = typename GridView::template Codim<0>::Entity; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, HeterogeneousSpatialParams<TypeTag>>; + using ParentType = FVSpatialParams<FVGridGeometry, Scalar, HeterogeneousSpatialParams<FVGridGeometry, Scalar>>; - enum { dimWorld = GridView::dimensionworld }; using GlobalPosition = typename SubControlVolume::GlobalPosition; using EffectiveLaw = RegularizedBrooksCorey<Scalar>; @@ -71,8 +70,9 @@ public: * * \param gridView The grid view */ - HeterogeneousSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + HeterogeneousSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry, + std::shared_ptr<const GridData<Grid>> gridData) + : ParentType(fvGridGeometry), gridData_(gridData) { //Set the permeability for the layers @@ -101,11 +101,10 @@ public: const auto& gridView = this->fvGridGeometry().gridView(); paramIdx_.resize(gridView.size(0)); - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); for (const auto& element : elements(gridView)) { const auto eIdx = this->fvGridGeometry().elementMapper().index(element); - paramIdx_[eIdx] = GridCreator::parameters(element)[0]; + paramIdx_[eIdx] = gridData_->parameters(element)[0]; } } @@ -203,6 +202,9 @@ public: { return FluidSystem::BrineIdx; } private: + + std::shared_ptr<const GridData<Grid>> gridData_; + int barrierTop_ = 1; int barrierMiddle_ = 2; int reservoir_ = 3; diff --git a/test/porousmediumflow/co2/implicit/test_co2_fv.cc b/test/porousmediumflow/co2/implicit/test_co2_fv.cc index c9e2297ebe..85ddce197d 100644 --- a/test/porousmediumflow/co2/implicit/test_co2_fv.cc +++ b/test/porousmediumflow/co2/implicit/test_co2_fv.cc @@ -46,6 +46,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> // the problem definitions #include "heterogeneousproblem.hh" @@ -68,25 +69,28 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); fvGridGeometry->update(); + // the spatial parameters + using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); + auto spatialParams = std::make_shared<SpatialParams>(fvGridGeometry, gridManager.getGridData()); + // the problem (initial and boundary conditions) using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(fvGridGeometry, spatialParams); // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); diff --git a/test/porousmediumflow/mpnc/implicit/2p2ccomparison/mpnc_comparison_problem.hh b/test/porousmediumflow/mpnc/implicit/2p2ccomparison/mpnc_comparison_problem.hh index 46f94f47ca..5ddb383b6d 100644 --- a/test/porousmediumflow/mpnc/implicit/2p2ccomparison/mpnc_comparison_problem.hh +++ b/test/porousmediumflow/mpnc/implicit/2p2ccomparison/mpnc_comparison_problem.hh @@ -25,6 +25,7 @@ #define DUMUX_MPNC_TWOPTWOC_COMPARISON_OBSTACLEPROBLEM_HH #include <dune/common/parametertreeparser.hh> +#include <dune/grid/yaspgrid.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> diff --git a/test/porousmediumflow/mpnc/implicit/2p2ccomparison/test_mpnc_comparison_fv.cc b/test/porousmediumflow/mpnc/implicit/2p2ccomparison/test_mpnc_comparison_fv.cc index 4b01fdd4f9..26324226ba 100644 --- a/test/porousmediumflow/mpnc/implicit/2p2ccomparison/test_mpnc_comparison_fv.cc +++ b/test/porousmediumflow/mpnc/implicit/2p2ccomparison/test_mpnc_comparison_fv.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -100,16 +101,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/mpnc/implicit/combustionproblem1c.hh b/test/porousmediumflow/mpnc/implicit/combustionproblem1c.hh index 3f78d47867..ca4b2ec94c 100644 --- a/test/porousmediumflow/mpnc/implicit/combustionproblem1c.hh +++ b/test/porousmediumflow/mpnc/implicit/combustionproblem1c.hh @@ -27,6 +27,8 @@ #ifndef DUMUX_COMBUSTION_PROBLEM_ONE_COMPONENT_HH #define DUMUX_COMBUSTION_PROBLEM_ONE_COMPONENT_HH +#include <dune/grid/onedgrid.hh> + #include <dumux/discretization/box/properties.hh> #include <dumux/porousmediumflow/problem.hh> diff --git a/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh b/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh index 8727ae7733..43f7dcec1e 100644 --- a/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh +++ b/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh @@ -39,6 +39,8 @@ // setting it here, because it impacts volume variables and spatialparameters #define USE_PCMAX 1 +#include <dune/grid/yaspgrid.hh> + #include <dumux/common/properties.hh> #include <dumux/discretization/box/properties.hh> diff --git a/test/porousmediumflow/mpnc/implicit/obstacleproblem.hh b/test/porousmediumflow/mpnc/implicit/obstacleproblem.hh index 87136c78ee..1c37becb46 100644 --- a/test/porousmediumflow/mpnc/implicit/obstacleproblem.hh +++ b/test/porousmediumflow/mpnc/implicit/obstacleproblem.hh @@ -27,6 +27,7 @@ #define DUMUX_OBSTACLEPROBLEM_HH #include <dune/common/parametertreeparser.hh> +#include <dune/grid/yaspgrid.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> diff --git a/test/porousmediumflow/mpnc/implicit/test_boxmpnckinetic.cc b/test/porousmediumflow/mpnc/implicit/test_boxmpnckinetic.cc index 2f6e9f2ef0..4d0fdb5717 100644 --- a/test/porousmediumflow/mpnc/implicit/test_boxmpnckinetic.cc +++ b/test/porousmediumflow/mpnc/implicit/test_boxmpnckinetic.cc @@ -48,6 +48,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -97,16 +98,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/mpnc/implicit/test_boxmpncthermalnonequil.cc b/test/porousmediumflow/mpnc/implicit/test_boxmpncthermalnonequil.cc index 7501c698c7..c0a6070ae6 100644 --- a/test/porousmediumflow/mpnc/implicit/test_boxmpncthermalnonequil.cc +++ b/test/porousmediumflow/mpnc/implicit/test_boxmpncthermalnonequil.cc @@ -48,6 +48,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -97,16 +98,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/mpnc/implicit/test_mpnc_obstacle_fv.cc b/test/porousmediumflow/mpnc/implicit/test_mpnc_obstacle_fv.cc index 86bdae2d55..6176146751 100644 --- a/test/porousmediumflow/mpnc/implicit/test_mpnc_obstacle_fv.cc +++ b/test/porousmediumflow/mpnc/implicit/test_mpnc_obstacle_fv.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -100,16 +101,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/richards/implicit/richardsanalyticalproblem.hh b/test/porousmediumflow/richards/implicit/richardsanalyticalproblem.hh index f0db44035b..993db884bd 100644 --- a/test/porousmediumflow/richards/implicit/richardsanalyticalproblem.hh +++ b/test/porousmediumflow/richards/implicit/richardsanalyticalproblem.hh @@ -30,6 +30,8 @@ #include <cmath> #include <dune/geometry/quadraturerules.hh> +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/porousmediumflow/problem.hh> diff --git a/test/porousmediumflow/richards/implicit/richardslensproblem.hh b/test/porousmediumflow/richards/implicit/richardslensproblem.hh index 43b0222464..034d0634c6 100644 --- a/test/porousmediumflow/richards/implicit/richardslensproblem.hh +++ b/test/porousmediumflow/richards/implicit/richardslensproblem.hh @@ -26,6 +26,8 @@ #ifndef DUMUX_RICHARDS_LENSPROBLEM_HH #define DUMUX_RICHARDS_LENSPROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/porousmediumflow/problem.hh> @@ -60,7 +62,8 @@ SET_TYPE_PROP(RichardsLensTypeTag, Grid, Dune::YaspGrid<2>); SET_TYPE_PROP(RichardsLensTypeTag, Problem, RichardsLensProblem<TypeTag>); // Set the spatial parameters -SET_TYPE_PROP(RichardsLensTypeTag, SpatialParams, RichardsLensSpatialParams<TypeTag>); +SET_TYPE_PROP(RichardsLensTypeTag, SpatialParams, RichardsLensSpatialParams<typename GET_PROP_TYPE(TypeTag, FVGridGeometry), + typename GET_PROP_TYPE(TypeTag, Scalar)>); } // end namespace Dumux /*! diff --git a/test/porousmediumflow/richards/implicit/richardslensspatialparams.hh b/test/porousmediumflow/richards/implicit/richardslensspatialparams.hh index ac19cf890b..87cc492cd8 100644 --- a/test/porousmediumflow/richards/implicit/richardslensspatialparams.hh +++ b/test/porousmediumflow/richards/implicit/richardslensspatialparams.hh @@ -37,31 +37,26 @@ namespace Dumux { * \ingroup ImplicitTestProblems * \brief The spatial parameters for the RichardsLensProblem */ -template<class TypeTag> +template<class FVGridGeometry, class Scalar> class RichardsLensSpatialParams -: public FVSpatialParams<typename GET_PROP_TYPE(TypeTag, FVGridGeometry), - typename GET_PROP_TYPE(TypeTag, Scalar), - RichardsLensSpatialParams<TypeTag>> +: public FVSpatialParams<FVGridGeometry, Scalar, RichardsLensSpatialParams<FVGridGeometry, Scalar>> { - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using ThisType = RichardsLensSpatialParams<FVGridGeometry, Scalar>; + using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; using GridView = typename FVGridGeometry::GridView; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, RichardsLensSpatialParams<TypeTag>>; - - enum { dimWorld=GridView::dimensionworld }; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; - using EffectiveLaw = RegularizedVanGenuchten<Scalar>; + enum { dimWorld = GridView::dimensionworld }; public: - using MaterialLaw = EffToAbsLaw<EffectiveLaw>; + using MaterialLaw = EffToAbsLaw<RegularizedVanGenuchten<Scalar>>; using MaterialLawParams = typename MaterialLaw::Params; // export permeability type using PermeabilityType = Scalar; RichardsLensSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + : ParentType(fvGridGeometry) { lensLowerLeft_ = {1.0, 2.0}; diff --git a/test/porousmediumflow/richards/implicit/richardsniconductionproblem.hh b/test/porousmediumflow/richards/implicit/richardsniconductionproblem.hh index 4679e2a76c..8a7fe6dc06 100644 --- a/test/porousmediumflow/richards/implicit/richardsniconductionproblem.hh +++ b/test/porousmediumflow/richards/implicit/richardsniconductionproblem.hh @@ -25,7 +25,8 @@ #ifndef DUMUX_RICHARDS_CONDUCTION_PROBLEM_HH #define DUMUX_RICHARDS_CONDUCTION_PROBLEM_HH -#include <math.h> +#include <cmath> +#include <dune/grid/yaspgrid.hh> #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> diff --git a/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh b/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh index c077dc8e02..98491eb70d 100644 --- a/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh +++ b/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh @@ -26,7 +26,8 @@ #ifndef DUMUX_RICHARDS_CONVECTION_PROBLEM_HH #define DUMUX_RICHARDS_CONVECTION_PROBLEM_HH -#include <math.h> +#include <cmath> +#include <dune/grid/yaspgrid.hh> #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> diff --git a/test/porousmediumflow/richards/implicit/richardsnievaporationproblem.hh b/test/porousmediumflow/richards/implicit/richardsnievaporationproblem.hh index 51ba223a93..c4d572cbfd 100644 --- a/test/porousmediumflow/richards/implicit/richardsnievaporationproblem.hh +++ b/test/porousmediumflow/richards/implicit/richardsnievaporationproblem.hh @@ -25,7 +25,8 @@ #ifndef DUMUX_RICHARDS_EVAPORATION_PROBLEM_HH #define DUMUX_RICHARDS_EVAPORATION_PROBLEM_HH -#include <math.h> +#include <cmath> +#include <dune/grid/yaspgrid.hh> #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> diff --git a/test/porousmediumflow/richards/implicit/test_ccrichardsanalytical.cc b/test/porousmediumflow/richards/implicit/test_ccrichardsanalytical.cc index 8b9be9df43..a39faff519 100644 --- a/test/porousmediumflow/richards/implicit/test_ccrichardsanalytical.cc +++ b/test/porousmediumflow/richards/implicit/test_ccrichardsanalytical.cc @@ -46,6 +46,7 @@ #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with * reading in parameters. @@ -93,16 +94,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/richards/implicit/test_richardslens_fv.cc b/test/porousmediumflow/richards/implicit/test_richardslens_fv.cc index 1550ec49da..d6190f237d 100644 --- a/test/porousmediumflow/richards/implicit/test_richardslens_fv.cc +++ b/test/porousmediumflow/richards/implicit/test_richardslens_fv.cc @@ -23,8 +23,6 @@ */ #include <config.h> -#include "richardslensproblem.hh" - #include <ctime> #include <iostream> @@ -46,31 +44,9 @@ #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> -/*! - * \brief Provides an interface for customizing error messages associated with - * reading in parameters. - * - * \param progName The name of the program, that was tried to be started. - * \param errorMsg The error message that was issued by the start function. - * Comprises the thing that went wrong and a general help message. - */ -void usage(const char *progName, const std::string &errorMsg) -{ - if (errorMsg.size() > 0) { - std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe list of mandatory options for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.File Name of the file containing the grid \n" - "\t definition in DGF format\n"; - - std::cout << errorMessageOut - << "\n"; - } -} +#include <dumux/io/grid/gridmanager.hh> + +#include "richardslensproblem.hh" //////////////////////// // the main function @@ -90,19 +66,18 @@ int main(int argc, char** argv) try DumuxMessage::print(/*firstCall=*/true); // parse command line arguments and input file - Parameters::init(argc, argv, usage); + Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/richards/implicit/test_richardsniconduction_fv.cc b/test/porousmediumflow/richards/implicit/test_richardsniconduction_fv.cc index 82f3c629c1..d0fd30adda 100644 --- a/test/porousmediumflow/richards/implicit/test_richardsniconduction_fv.cc +++ b/test/porousmediumflow/richards/implicit/test_richardsniconduction_fv.cc @@ -46,6 +46,7 @@ #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with * reading in parameters. @@ -93,16 +94,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/richards/implicit/test_richardsniconvection_fv.cc b/test/porousmediumflow/richards/implicit/test_richardsniconvection_fv.cc index ba18b9ce98..9901553557 100644 --- a/test/porousmediumflow/richards/implicit/test_richardsniconvection_fv.cc +++ b/test/porousmediumflow/richards/implicit/test_richardsniconvection_fv.cc @@ -46,6 +46,7 @@ #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with * reading in parameters. @@ -93,16 +94,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/richards/implicit/test_richardsnievaporation_fv.cc b/test/porousmediumflow/richards/implicit/test_richardsnievaporation_fv.cc index 3464a371f3..b2ba91688d 100644 --- a/test/porousmediumflow/richards/implicit/test_richardsnievaporation_fv.cc +++ b/test/porousmediumflow/richards/implicit/test_richardsnievaporation_fv.cc @@ -44,6 +44,7 @@ #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> //////////////////////// // the main function @@ -66,16 +67,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/richardsnc/implicit/richardswelltracerproblem.hh b/test/porousmediumflow/richardsnc/implicit/richardswelltracerproblem.hh index d86975d0d1..bff137ae0a 100644 --- a/test/porousmediumflow/richardsnc/implicit/richardswelltracerproblem.hh +++ b/test/porousmediumflow/richardsnc/implicit/richardswelltracerproblem.hh @@ -26,6 +26,8 @@ #ifndef DUMUX_RICHARDS_NC_WELL_TRACER_PROBLEM_HH #define DUMUX_RICHARDS_NC_WELL_TRACER_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/porousmediumflow/problem.hh> diff --git a/test/porousmediumflow/richardsnc/implicit/test_richardsnc_fv.cc b/test/porousmediumflow/richardsnc/implicit/test_richardsnc_fv.cc index 22decb0f04..76d815c63e 100644 --- a/test/porousmediumflow/richardsnc/implicit/test_richardsnc_fv.cc +++ b/test/porousmediumflow/richardsnc/implicit/test_richardsnc_fv.cc @@ -46,6 +46,7 @@ #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with * reading in parameters. @@ -93,16 +94,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/tracer/1ptracer/1ptestproblem.hh b/test/porousmediumflow/tracer/1ptracer/1ptestproblem.hh index dc40f8b3d7..c29f31dc47 100644 --- a/test/porousmediumflow/tracer/1ptracer/1ptestproblem.hh +++ b/test/porousmediumflow/tracer/1ptracer/1ptestproblem.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH #define DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/porousmediumflow/1p/model.hh> #include <dumux/porousmediumflow/problem.hh> diff --git a/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc b/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc index 010fa97380..605be20752 100644 --- a/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc +++ b/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc @@ -44,6 +44,7 @@ #include <dumux/assembly/diffmethod.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> int main(int argc, char** argv) try { @@ -72,16 +73,11 @@ int main(int argc, char** argv) try ///////////////////////////////////////////////////////////////////// // only create the grid once using the 1p type tag - using GridCreator = typename GET_PROP_TYPE(OnePTypeTag, GridCreator); - try { GridCreator::makeGrid(); } - catch (...) { - std::cout << "\n\t -> Creation of the grid failed! <- \n\n"; - throw; - } - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(OnePTypeTag, Grid)> gridManager; + gridManager.init(); //! we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); //////////////////////////////////////////////////////////// // setup & solve 1p problem on this grid diff --git a/test/porousmediumflow/tracer/1ptracer/tracertestproblem.hh b/test/porousmediumflow/tracer/1ptracer/tracertestproblem.hh index 1b8aee0b7a..d60e7ebac3 100644 --- a/test/porousmediumflow/tracer/1ptracer/tracertestproblem.hh +++ b/test/porousmediumflow/tracer/1ptracer/tracertestproblem.hh @@ -25,6 +25,8 @@ #ifndef DUMUX_TRACER_TEST_PROBLEM_HH #define DUMUX_TRACER_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/porousmediumflow/tracer/model.hh> #include <dumux/porousmediumflow/problem.hh> diff --git a/test/porousmediumflow/tracer/constvel/test_tracer.cc b/test/porousmediumflow/tracer/constvel/test_tracer.cc index b710725758..fafc94e10e 100644 --- a/test/porousmediumflow/tracer/constvel/test_tracer.cc +++ b/test/porousmediumflow/tracer/constvel/test_tracer.cc @@ -40,6 +40,7 @@ #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include "tracertestproblem.hh" @@ -61,20 +62,19 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - try { GridCreator::makeGrid(); } + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + try { gridManager.init(); } catch (...) { std::cout << "\n\t -> Creation of the grid failed! <- \n\n"; throw; } - GridCreator::loadBalance(); //////////////////////////////////////////////////////////// // setup instationary non-linear problem on this grid //////////////////////////////////////////////////////////// //! we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); //! create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/tracer/constvel/tracertestproblem.hh b/test/porousmediumflow/tracer/constvel/tracertestproblem.hh index 0d47a99098..74646019a0 100644 --- a/test/porousmediumflow/tracer/constvel/tracertestproblem.hh +++ b/test/porousmediumflow/tracer/constvel/tracertestproblem.hh @@ -25,6 +25,8 @@ #ifndef DUMUX_TRACER_TEST_PROBLEM_HH #define DUMUX_TRACER_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/box/properties.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> #include <dumux/discretization/cellcentered/mpfa/properties.hh> diff --git a/test/porousmediumflow/tracer/multicomp/maxwellstefantestproblem.hh b/test/porousmediumflow/tracer/multicomp/maxwellstefantestproblem.hh index a44270018b..7fba519f35 100644 --- a/test/porousmediumflow/tracer/multicomp/maxwellstefantestproblem.hh +++ b/test/porousmediumflow/tracer/multicomp/maxwellstefantestproblem.hh @@ -25,6 +25,8 @@ #ifndef DUMUX_MAXWELL_STEFAN_TEST_PROBLEM_HH #define DUMUX_MAXWELL_STEFAN_TEST_PROBLEM_HH +#include <dune/grid/yaspgrid.hh> + #include <dumux/discretization/elementsolution.hh> #include <dumux/discretization/box/properties.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> diff --git a/test/porousmediumflow/tracer/multicomp/test_tracer_maxwellstefan.cc b/test/porousmediumflow/tracer/multicomp/test_tracer_maxwellstefan.cc index a03b1a28a8..da2bd4a0c1 100644 --- a/test/porousmediumflow/tracer/multicomp/test_tracer_maxwellstefan.cc +++ b/test/porousmediumflow/tracer/multicomp/test_tracer_maxwellstefan.cc @@ -49,6 +49,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -100,16 +101,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/tutorial/ex1/exercise1.cc b/tutorial/ex1/exercise1.cc index d6bb2599a0..3bf3e8d87c 100644 --- a/tutorial/ex1/exercise1.cc +++ b/tutorial/ex1/exercise1.cc @@ -44,6 +44,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include "injection2pproblem.hh" @@ -68,16 +69,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/tutorial/ex1/exercise1_2p.cc b/tutorial/ex1/exercise1_2p.cc index 7ae3bca427..558f2d0f33 100644 --- a/tutorial/ex1/exercise1_2p.cc +++ b/tutorial/ex1/exercise1_2p.cc @@ -44,6 +44,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> // The problem file, where setup-specific boundary and initial conditions are defined. #include "injection2pproblem.hh" @@ -69,16 +70,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/tutorial/ex1/exercise1_2p2c.cc b/tutorial/ex1/exercise1_2p2c.cc index 6f7e515c04..c2b46ea15f 100644 --- a/tutorial/ex1/exercise1_2p2c.cc +++ b/tutorial/ex1/exercise1_2p2c.cc @@ -44,6 +44,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> // The problem file, where setup-specific boundary and initial conditions are defined. #include "injection2p2cproblem.hh" @@ -69,16 +70,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/tutorial/ex2/exercise2.cc b/tutorial/ex2/exercise2.cc index d031e8753b..2a7493e677 100644 --- a/tutorial/ex2/exercise2.cc +++ b/tutorial/ex2/exercise2.cc @@ -45,6 +45,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include "injection2p2cproblem.hh" @@ -66,16 +67,15 @@ int main(int argc, char** argv)try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/tutorial/ex3/exercise3.cc b/tutorial/ex3/exercise3.cc index 4669ea7f18..acfc230b5f 100644 --- a/tutorial/ex3/exercise3.cc +++ b/tutorial/ex3/exercise3.cc @@ -50,6 +50,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> /*! * \brief Provides an interface for customizing error messages associated with @@ -105,16 +106,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv, usage); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/tutorial/solution/ex1/exercise1_2p2c.cc b/tutorial/solution/ex1/exercise1_2p2c.cc index 779a668a61..55496aad06 100644 --- a/tutorial/solution/ex1/exercise1_2p2c.cc +++ b/tutorial/solution/ex1/exercise1_2p2c.cc @@ -44,6 +44,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include "injection2p2cproblem.hh" @@ -68,16 +69,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/tutorial/solution/ex1/exercise1_2pni_solution.cc b/tutorial/solution/ex1/exercise1_2pni_solution.cc index d8e6af7ba5..68f9d3b50f 100644 --- a/tutorial/solution/ex1/exercise1_2pni_solution.cc +++ b/tutorial/solution/ex1/exercise1_2pni_solution.cc @@ -44,6 +44,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> // The problem file, where setup-specific boundary and initial conditions are defined. #include "injection2pniproblem.hh" @@ -69,16 +70,15 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/tutorial/solution/ex2/exercise2_solution.cc b/tutorial/solution/ex2/exercise2_solution.cc index d031e8753b..2a7493e677 100644 --- a/tutorial/solution/ex2/exercise2_solution.cc +++ b/tutorial/solution/ex2/exercise2_solution.cc @@ -45,6 +45,7 @@ #include <dumux/discretization/methods.hh> #include <dumux/io/vtkoutputmodule.hh> +#include <dumux/io/grid/gridmanager.hh> #include "injection2p2cproblem.hh" @@ -66,16 +67,15 @@ int main(int argc, char** argv)try Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); + GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager; + gridManager.init(); //////////////////////////////////////////////////////////// // run instationary non-linear problem on this grid //////////////////////////////////////////////////////////// // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); + const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); -- GitLab