From bcad041df625fbbb5b8580e0b393c63a63dee5fb Mon Sep 17 00:00:00 2001 From: Mathis Kelm <mathis.kelm@iws.uni-stuttgart.de> Date: Sat, 27 Feb 2021 00:25:24 +0100 Subject: [PATCH] [test][richards] Separate properties into their own header --- .../richards/analytical/main.cc | 36 +------- .../richards/analytical/problem.hh | 51 +----------- .../richards/analytical/properties.hh | 68 +++++++++++++++ test/porousmediumflow/richards/lens/main.cc | 2 +- .../porousmediumflow/richards/lens/problem.hh | 55 +----------- .../richards/lens/properties.hh | 83 +++++++++++++++++++ .../richards/nonisothermal/conduction/main.cc | 36 +------- .../nonisothermal/conduction/problem.hh | 49 +---------- .../nonisothermal/conduction/properties.hh | 72 ++++++++++++++++ .../richards/nonisothermal/convection/main.cc | 36 +------- .../nonisothermal/convection/problem.hh | 51 +----------- .../nonisothermal/convection/properties.hh | 73 ++++++++++++++++ .../nonisothermal/evaporation/main.cc | 2 +- .../nonisothermal/evaporation/problem.hh | 52 +----------- .../nonisothermal/evaporation/properties.hh | 77 +++++++++++++++++ test/porousmediumflow/richardsnc/main.cc | 36 +------- test/porousmediumflow/richardsnc/problem.hh | 50 +---------- .../porousmediumflow/richardsnc/properties.hh | 70 ++++++++++++++++ 18 files changed, 477 insertions(+), 422 deletions(-) create mode 100644 test/porousmediumflow/richards/analytical/properties.hh create mode 100644 test/porousmediumflow/richards/lens/properties.hh create mode 100644 test/porousmediumflow/richards/nonisothermal/conduction/properties.hh create mode 100644 test/porousmediumflow/richards/nonisothermal/convection/properties.hh create mode 100644 test/porousmediumflow/richards/nonisothermal/evaporation/properties.hh create mode 100644 test/porousmediumflow/richardsnc/properties.hh diff --git a/test/porousmediumflow/richards/analytical/main.cc b/test/porousmediumflow/richards/analytical/main.cc index 234f99b9d9..7a0cf3e5fe 100644 --- a/test/porousmediumflow/richards/analytical/main.cc +++ b/test/porousmediumflow/richards/analytical/main.cc @@ -24,15 +24,10 @@ #include <config.h> -#include "problem.hh" - -#include <ctime> #include <iostream> #include <dune/common/parallel/mpihelper.hh> #include <dune/common/timer.hh> -#include <dune/grid/io/file/vtk.hh> -#include <dune/istl/io.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> @@ -44,32 +39,9 @@ #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. - * - * \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_yasp.hh> + +#include "properties.hh" //////////////////////// // the main function @@ -89,7 +61,7 @@ int main(int argc, char** argv) 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) GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager; diff --git a/test/porousmediumflow/richards/analytical/problem.hh b/test/porousmediumflow/richards/analytical/problem.hh index 346582759e..bd02b6d670 100644 --- a/test/porousmediumflow/richards/analytical/problem.hh +++ b/test/porousmediumflow/richards/analytical/problem.hh @@ -32,62 +32,15 @@ #include <cmath> #include <dune/common/math.hh> #include <dune/geometry/quadraturerules.hh> -#include <dune/grid/yaspgrid.hh> +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> -#include <dumux/discretization/cctpfa.hh> -#include <dumux/discretization/box.hh> #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/richards/model.hh> -#include <dumux/material/components/simpleh2o.hh> -#include <dumux/material/fluidsystems/1pliquid.hh> - -#include "spatialparams.hh" - namespace Dumux { -/*! - * \ingroup RichardsTests - * \brief A one-dimensional infiltration problem with a smooth, given solution. - * - * The source term is calculated analytically. Thus, this example can be used - * to calculate the L2 error and to show convergence for grid and time-step - * refinement. - */ -template <class TypeTag> -class RichardsAnalyticalProblem; - -////////// -// Specify the properties for the analytical problem -////////// -namespace Properties { -// Create new type tags -namespace TTag { -struct RichardsAnalytical { using InheritsFrom = std::tuple<Richards>; }; -struct RichardsAnalyticalBox { using InheritsFrom = std::tuple<RichardsAnalytical, BoxModel>; }; -struct RichardsAnalyticalCC { using InheritsFrom = std::tuple<RichardsAnalytical, CCTpfaModel>; }; -} // end namespace TTag - -// Use 2d YaspGrid -template<class TypeTag> -struct Grid<TypeTag, TTag::RichardsAnalytical> { using type = Dune::YaspGrid<2>; }; - -// Set the physical problem to be solved -template<class TypeTag> -struct Problem<TypeTag, TTag::RichardsAnalytical> { using type = RichardsAnalyticalProblem<TypeTag>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::RichardsAnalytical> -{ - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = RichardsAnalyticalSpatialParams<GridGeometry, Scalar>; -}; -} // end namespace Properties - /*! * \ingroup RichardsModel * \ingroup ImplicitTestProblems diff --git a/test/porousmediumflow/richards/analytical/properties.hh b/test/porousmediumflow/richards/analytical/properties.hh new file mode 100644 index 0000000000..b562af98ff --- /dev/null +++ b/test/porousmediumflow/richards/analytical/properties.hh @@ -0,0 +1,68 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * \ingroup RichardsTests + * \brief The properties of the one-dimensional infiltration problem with a smooth, given solution. + */ +#ifndef DUMUX_RICHARDS_ANALYTICALPROPERTIES_HH +#define DUMUX_RICHARDS_ANALYTICALPROPERTIES_HH + +#include <dune/grid/yaspgrid.hh> +#include <dumux/discretization/cctpfa.hh> +#include <dumux/discretization/box.hh> +#include <dumux/porousmediumflow/richards/model.hh> +#include <dumux/material/components/simpleh2o.hh> +#include <dumux/material/fluidsystems/1pliquid.hh> + +#include "spatialparams.hh" +#include "problem.hh" + +////////// +// Specify the properties for the analytical problem +////////// +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct RichardsAnalytical { using InheritsFrom = std::tuple<Richards>; }; +struct RichardsAnalyticalBox { using InheritsFrom = std::tuple<RichardsAnalytical, BoxModel>; }; +struct RichardsAnalyticalCC { using InheritsFrom = std::tuple<RichardsAnalytical, CCTpfaModel>; }; +} // end namespace TTag + +// Use 2d YaspGrid +template<class TypeTag> +struct Grid<TypeTag, TTag::RichardsAnalytical> { using type = Dune::YaspGrid<2>; }; + +// Set the physical problem to be solved +template<class TypeTag> +struct Problem<TypeTag, TTag::RichardsAnalytical> { using type = RichardsAnalyticalProblem<TypeTag>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::RichardsAnalytical> +{ + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = RichardsAnalyticalSpatialParams<GridGeometry, Scalar>; +}; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/richards/lens/main.cc b/test/porousmediumflow/richards/lens/main.cc index 1f7efe01cb..43dcc8e09f 100644 --- a/test/porousmediumflow/richards/lens/main.cc +++ b/test/porousmediumflow/richards/lens/main.cc @@ -52,7 +52,7 @@ #include <dumux/io/grid/gridmanager.hh> #include <dumux/io/loadsolution.hh> -#include "problem.hh" +#include "properties.hh" #ifndef DIFFMETHOD #define DIFFMETHOD DiffMethod::numeric diff --git a/test/porousmediumflow/richards/lens/problem.hh b/test/porousmediumflow/richards/lens/problem.hh index d1a3e3d9ec..196daf954d 100644 --- a/test/porousmediumflow/richards/lens/problem.hh +++ b/test/porousmediumflow/richards/lens/problem.hh @@ -27,65 +27,14 @@ #ifndef DUMUX_RICHARDS_LENSPROBLEM_HH #define DUMUX_RICHARDS_LENSPROBLEM_HH -#include <dune/grid/yaspgrid.hh> -#if HAVE_DUNE_ALUGRID -#include <dune/alugrid/grid.hh> -#endif -#if HAVE_UG -#include <dune/grid/uggrid.hh> -#endif - +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> -#include <dumux/discretization/cctpfa.hh> -#include <dumux/discretization/ccmpfa.hh> -#include <dumux/discretization/box.hh> #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/richards/model.hh> -#include <dumux/material/components/simpleh2o.hh> -#include <dumux/material/fluidsystems/1pliquid.hh> - -#include "spatialparams.hh" - namespace Dumux { -template <class TypeTag> -class RichardsLensProblem; - -// Specify the properties for the lens problem -namespace Properties { -// Create new type tags -namespace TTag { -struct RichardsLens { using InheritsFrom = std::tuple<Richards>; }; -struct RichardsLensBox { using InheritsFrom = std::tuple<RichardsLens, BoxModel>; }; -struct RichardsLensCC { using InheritsFrom = std::tuple<RichardsLens, CCTpfaModel>; }; -struct RichardsLensCCMpfa { using InheritsFrom = std::tuple<RichardsLens, CCMpfaModel>; }; -} // end namespace TTag - -#ifndef GRIDTYPE -// Use 2d YaspGrid -template<class TypeTag> -struct Grid<TypeTag, TTag::RichardsLens> { using type = Dune::YaspGrid<2>; }; -#else -// Use GRIDTYPE from CMakeLists.txt -template<class TypeTag> -struct Grid<TypeTag, TTag::RichardsLens> { using type = GRIDTYPE; }; -#endif - -// Set the physical problem to be solved -template<class TypeTag> -struct Problem<TypeTag, TTag::RichardsLens> { using type = RichardsLensProblem<TypeTag>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::RichardsLens> -{ - using type = RichardsLensSpatialParams<GetPropType<TypeTag, Properties::GridGeometry>, - GetPropType<TypeTag, Properties::Scalar>>; -}; -} // end namespace Dumux - /*! * \ingroup RichardsTests * diff --git a/test/porousmediumflow/richards/lens/properties.hh b/test/porousmediumflow/richards/lens/properties.hh new file mode 100644 index 0000000000..e5a75fb3e9 --- /dev/null +++ b/test/porousmediumflow/richards/lens/properties.hh @@ -0,0 +1,83 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * \ingroup RichardsTests + * \brief The properties of the water infiltration problem with a + * low-permeability lens embedded into a high-permeability domain which + * uses the Richards box model. + */ +#ifndef DUMUX_RICHARDS_LENSPROPERTIES_HH +#define DUMUX_RICHARDS_LENSPROPERTIES_HH + +#include <dune/grid/yaspgrid.hh> +#if HAVE_DUNE_ALUGRID +#include <dune/alugrid/grid.hh> +#endif +#if HAVE_UG +#include <dune/grid/uggrid.hh> +#endif + +#include <dumux/discretization/cctpfa.hh> +#include <dumux/discretization/ccmpfa.hh> +#include <dumux/discretization/box.hh> + +#include <dumux/porousmediumflow/richards/model.hh> +#include <dumux/material/components/simpleh2o.hh> +#include <dumux/material/fluidsystems/1pliquid.hh> + +#include "spatialparams.hh" +#include "problem.hh" + +// Specify the properties for the lens problem +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct RichardsLens { using InheritsFrom = std::tuple<Richards>; }; +struct RichardsLensBox { using InheritsFrom = std::tuple<RichardsLens, BoxModel>; }; +struct RichardsLensCC { using InheritsFrom = std::tuple<RichardsLens, CCTpfaModel>; }; +struct RichardsLensCCMpfa { using InheritsFrom = std::tuple<RichardsLens, CCMpfaModel>; }; +} // end namespace TTag + +#ifndef GRIDTYPE +// Use 2d YaspGrid +template<class TypeTag> +struct Grid<TypeTag, TTag::RichardsLens> { using type = Dune::YaspGrid<2>; }; +#else +// Use GRIDTYPE from CMakeLists.txt +template<class TypeTag> +struct Grid<TypeTag, TTag::RichardsLens> { using type = GRIDTYPE; }; +#endif + +// Set the physical problem to be solved +template<class TypeTag> +struct Problem<TypeTag, TTag::RichardsLens> { using type = RichardsLensProblem<TypeTag>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::RichardsLens> +{ + using type = RichardsLensSpatialParams<GetPropType<TypeTag, Properties::GridGeometry>, + GetPropType<TypeTag, Properties::Scalar>>; +}; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/richards/nonisothermal/conduction/main.cc b/test/porousmediumflow/richards/nonisothermal/conduction/main.cc index 15c6631842..12489bae7b 100644 --- a/test/porousmediumflow/richards/nonisothermal/conduction/main.cc +++ b/test/porousmediumflow/richards/nonisothermal/conduction/main.cc @@ -24,15 +24,10 @@ #include <config.h> -#include "problem.hh" - -#include <ctime> #include <iostream> #include <dune/common/parallel/mpihelper.hh> #include <dune/common/timer.hh> -#include <dune/grid/io/file/vtk.hh> -#include <dune/istl/io.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> @@ -44,32 +39,9 @@ #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. - * - * \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_yasp.hh> + +#include "properties.hh" //////////////////////// // the main function @@ -89,7 +61,7 @@ int main(int argc, char** argv) 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) GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager; diff --git a/test/porousmediumflow/richards/nonisothermal/conduction/problem.hh b/test/porousmediumflow/richards/nonisothermal/conduction/problem.hh index b161899190..1230c423db 100644 --- a/test/porousmediumflow/richards/nonisothermal/conduction/problem.hh +++ b/test/porousmediumflow/richards/nonisothermal/conduction/problem.hh @@ -27,60 +27,17 @@ #define DUMUX_RICHARDS_CONDUCTION_PROBLEM_HH #include <cmath> -#include <dune/grid/yaspgrid.hh> +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> - #include <dumux/discretization/elementsolution.hh> -#include <dumux/discretization/cctpfa.hh> -#include <dumux/discretization/box.hh> #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/richards/model.hh> -#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivity/somerton.hh> -#include <dumux/material/fluidsystems/h2on2.hh> -#include "../spatialparams.hh" +#include <dumux/material/components/h2o.hh> namespace Dumux { -/** - * \ingroup RichardsTests - * \brief Test for the RichardsModel in combination with the NI model for a conduction problem: - * The simulation domain is a tube with an elevated temperature on the left hand side. - */ -template <class TypeTag> -class RichardsNIConductionProblem; - -namespace Properties { -// Create new type tags -namespace TTag { -struct RichardsNIConduction { using InheritsFrom = std::tuple<RichardsNI>; }; -struct RichardsNIConductionBox { using InheritsFrom = std::tuple<RichardsNIConduction, BoxModel>; }; -struct RichardsNIConductionCC { using InheritsFrom = std::tuple<RichardsNIConduction, CCTpfaModel>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::RichardsNIConduction> { using type = Dune::YaspGrid<2>; }; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::RichardsNIConduction> { using type = RichardsNIConductionProblem<TypeTag>; }; - -// Set the fluid system -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::RichardsNIConduction> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::RichardsNIConduction> -{ - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = RichardsNISpatialParams<GridGeometry, Scalar>; -}; -} // end namespace Properties - /*! * \ingroup RichardsTests * diff --git a/test/porousmediumflow/richards/nonisothermal/conduction/properties.hh b/test/porousmediumflow/richards/nonisothermal/conduction/properties.hh new file mode 100644 index 0000000000..85f49de8f5 --- /dev/null +++ b/test/porousmediumflow/richards/nonisothermal/conduction/properties.hh @@ -0,0 +1,72 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * \ingroup RichardsTests + * \brief The properties of the test for the RichardsModel in combination with the NI model for a + * conduction problem. + */ +#ifndef DUMUX_RICHARDS_CONDUCTION_PROPERTIES_HH +#define DUMUX_RICHARDS_CONDUCTION_PROPERTIES_HH + +#include <dune/grid/yaspgrid.hh> + +#include <dumux/discretization/cctpfa.hh> +#include <dumux/discretization/box.hh> + +#include <dumux/porousmediumflow/richards/model.hh> +#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivity/somerton.hh> +#include <dumux/material/fluidsystems/h2on2.hh> + +#include "../spatialparams.hh" +#include "problem.hh" + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct RichardsNIConduction { using InheritsFrom = std::tuple<RichardsNI>; }; +struct RichardsNIConductionBox { using InheritsFrom = std::tuple<RichardsNIConduction, BoxModel>; }; +struct RichardsNIConductionCC { using InheritsFrom = std::tuple<RichardsNIConduction, CCTpfaModel>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::RichardsNIConduction> { using type = Dune::YaspGrid<2>; }; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::RichardsNIConduction> { using type = RichardsNIConductionProblem<TypeTag>; }; + +// Set the fluid system +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::RichardsNIConduction> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::RichardsNIConduction> +{ + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = RichardsNISpatialParams<GridGeometry, Scalar>; +}; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/richards/nonisothermal/convection/main.cc b/test/porousmediumflow/richards/nonisothermal/convection/main.cc index 15c6631842..12489bae7b 100644 --- a/test/porousmediumflow/richards/nonisothermal/convection/main.cc +++ b/test/porousmediumflow/richards/nonisothermal/convection/main.cc @@ -24,15 +24,10 @@ #include <config.h> -#include "problem.hh" - -#include <ctime> #include <iostream> #include <dune/common/parallel/mpihelper.hh> #include <dune/common/timer.hh> -#include <dune/grid/io/file/vtk.hh> -#include <dune/istl/io.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> @@ -44,32 +39,9 @@ #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. - * - * \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_yasp.hh> + +#include "properties.hh" //////////////////////// // the main function @@ -89,7 +61,7 @@ int main(int argc, char** argv) 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) GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager; diff --git a/test/porousmediumflow/richards/nonisothermal/convection/problem.hh b/test/porousmediumflow/richards/nonisothermal/convection/problem.hh index c2fc0ec91b..89911bf8a2 100644 --- a/test/porousmediumflow/richards/nonisothermal/convection/problem.hh +++ b/test/porousmediumflow/richards/nonisothermal/convection/problem.hh @@ -28,59 +28,16 @@ #define DUMUX_RICHARDS_CONVECTION_PROBLEM_HH #include <cmath> -#include <dune/grid/yaspgrid.hh> +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> -#include <dumux/discretization/elementsolution.hh> -#include <dumux/discretization/cctpfa.hh> -#include <dumux/discretization/box.hh> - #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/richards/model.hh> -#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivity/somerton.hh> -#include <dumux/material/fluidsystems/h2on2.hh> -#include "../spatialparams.hh" + +#include <dumux/material/components/h2o.hh> namespace Dumux { -/** - * \ingroup RichardsTests - * \brief Test for the RichardsModel in combination with the NI model for a convection problem: - * The simulation domain is a tube where water with an elevated temperature is injected - * at a constant rate on the left hand side. - */ -template <class TypeTag> -class RichardsNIConvectionProblem; - -namespace Properties { -// Create new type tags -namespace TTag { -struct RichardsNIConvection { using InheritsFrom = std::tuple<RichardsNI>; }; -struct RichardsNIConvectionBox { using InheritsFrom = std::tuple<RichardsNIConvection, BoxModel>; }; -struct RichardsNIConvectionCC { using InheritsFrom = std::tuple<RichardsNIConvection, CCTpfaModel>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::RichardsNIConvection> { using type = Dune::YaspGrid<2>; }; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::RichardsNIConvection> { using type = RichardsNIConvectionProblem<TypeTag>; }; - -// Set the fluid system -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::RichardsNIConvection> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::RichardsNIConvection> -{ - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = RichardsNISpatialParams<GridGeometry, Scalar>; -}; -} // end namespace Properties /*! * \ingroup RichardsTests diff --git a/test/porousmediumflow/richards/nonisothermal/convection/properties.hh b/test/porousmediumflow/richards/nonisothermal/convection/properties.hh new file mode 100644 index 0000000000..28512a4733 --- /dev/null +++ b/test/porousmediumflow/richards/nonisothermal/convection/properties.hh @@ -0,0 +1,73 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * \ingroup RichardsTests + * \brief The properties of the test for the RichardsModel in combination with the NI model for a + * convection problem. + */ +#ifndef DUMUX_RICHARDS_CONVECTION_PROPERTIES_HH +#define DUMUX_RICHARDS_CONVECTION_PROPERTIES_HH + +#include <dune/grid/yaspgrid.hh> + +#include <dumux/discretization/elementsolution.hh> +#include <dumux/discretization/cctpfa.hh> +#include <dumux/discretization/box.hh> + +#include <dumux/porousmediumflow/richards/model.hh> +#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivity/somerton.hh> +#include <dumux/material/fluidsystems/h2on2.hh> + +#include "../spatialparams.hh" +#include "problem.hh" + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct RichardsNIConvection { using InheritsFrom = std::tuple<RichardsNI>; }; +struct RichardsNIConvectionBox { using InheritsFrom = std::tuple<RichardsNIConvection, BoxModel>; }; +struct RichardsNIConvectionCC { using InheritsFrom = std::tuple<RichardsNIConvection, CCTpfaModel>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::RichardsNIConvection> { using type = Dune::YaspGrid<2>; }; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::RichardsNIConvection> { using type = RichardsNIConvectionProblem<TypeTag>; }; + +// Set the fluid system +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::RichardsNIConvection> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::RichardsNIConvection> +{ + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = RichardsNISpatialParams<GridGeometry, Scalar>; +}; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/richards/nonisothermal/evaporation/main.cc b/test/porousmediumflow/richards/nonisothermal/evaporation/main.cc index f11bf909c3..6c936ecd2b 100644 --- a/test/porousmediumflow/richards/nonisothermal/evaporation/main.cc +++ b/test/porousmediumflow/richards/nonisothermal/evaporation/main.cc @@ -24,7 +24,7 @@ #include <config.h> -#include "problem.hh" +#include "properties.hh" #include <ctime> #include <iostream> diff --git a/test/porousmediumflow/richards/nonisothermal/evaporation/problem.hh b/test/porousmediumflow/richards/nonisothermal/evaporation/problem.hh index 8d95b157ac..60becef3bf 100644 --- a/test/porousmediumflow/richards/nonisothermal/evaporation/problem.hh +++ b/test/porousmediumflow/richards/nonisothermal/evaporation/problem.hh @@ -27,62 +27,16 @@ #define DUMUX_RICHARDS_EVAPORATION_PROBLEM_HH #include <cmath> -#include <dune/grid/yaspgrid.hh> +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> -#include <dumux/discretization/elementsolution.hh> -#include <dumux/discretization/cctpfa.hh> -#include <dumux/discretization/box.hh> - #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/richards/model.hh> -#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivity/somerton.hh> -#include <dumux/material/fluidsystems/h2on2.hh> -#include "../spatialparams.hh" +#include <dumux/material/components/h2o.hh> namespace Dumux { -/** - * \ingroup RichardsTests - * \brief Test for the RichardsModel in combination with the NI model for evaporation. - */ -template <class TypeTag> -class RichardsNIEvaporationProblem; - -namespace Properties { -// Create new type tags -namespace TTag { -struct RichardsNIEvaporation { using InheritsFrom = std::tuple<RichardsNI>; }; -struct RichardsNIEvaporationBox { using InheritsFrom = std::tuple<RichardsNIEvaporation, BoxModel>; }; -struct RichardsNIEvaporationCC { using InheritsFrom = std::tuple<RichardsNIEvaporation, CCTpfaModel>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::RichardsNIEvaporation> { using type = Dune::YaspGrid<2>; }; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::RichardsNIEvaporation> { using type = RichardsNIEvaporationProblem<TypeTag>; }; - -// Set the fluid system -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::RichardsNIEvaporation> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::RichardsNIEvaporation> -{ - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = RichardsNISpatialParams<GridGeometry, Scalar>; -}; - -template<class TypeTag> -struct EnableWaterDiffusionInAir<TypeTag, TTag::RichardsNIEvaporation> { static constexpr bool value = true; }; -} // end namespace Properties - /*! * \ingroup RichardsTests * diff --git a/test/porousmediumflow/richards/nonisothermal/evaporation/properties.hh b/test/porousmediumflow/richards/nonisothermal/evaporation/properties.hh new file mode 100644 index 0000000000..1f1b341e16 --- /dev/null +++ b/test/porousmediumflow/richards/nonisothermal/evaporation/properties.hh @@ -0,0 +1,77 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * \ingroup RichardsTests + * \brief The properties of the test for the RichardsModel in combination with the NI model for + * evaporation. + */ +#ifndef DUMUX_RICHARDS_EVAPORATION_PROPERTIES_HH +#define DUMUX_RICHARDS_EVAPORATION_PROPERTIES_HH +/** + */ +#include <dune/grid/yaspgrid.hh> + +#include <dumux/discretization/elementsolution.hh> +#include <dumux/discretization/cctpfa.hh> +#include <dumux/discretization/box.hh> + +#include <dumux/porousmediumflow/richards/model.hh> +#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivity/somerton.hh> +#include <dumux/material/fluidsystems/h2on2.hh> + +#include "../spatialparams.hh" +#include "problem.hh" + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct RichardsNIEvaporation { using InheritsFrom = std::tuple<RichardsNI>; }; +struct RichardsNIEvaporationBox { using InheritsFrom = std::tuple<RichardsNIEvaporation, BoxModel>; }; +struct RichardsNIEvaporationCC { using InheritsFrom = std::tuple<RichardsNIEvaporation, CCTpfaModel>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::RichardsNIEvaporation> { using type = Dune::YaspGrid<2>; }; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::RichardsNIEvaporation> { using type = RichardsNIEvaporationProblem<TypeTag>; }; + +// Set the fluid system +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::RichardsNIEvaporation> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::RichardsNIEvaporation> +{ + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = RichardsNISpatialParams<GridGeometry, Scalar>; +}; + +template<class TypeTag> +struct EnableWaterDiffusionInAir<TypeTag, TTag::RichardsNIEvaporation> { static constexpr bool value = true; }; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/richardsnc/main.cc b/test/porousmediumflow/richardsnc/main.cc index b2ae15ca22..1dd7d5d799 100644 --- a/test/porousmediumflow/richardsnc/main.cc +++ b/test/porousmediumflow/richardsnc/main.cc @@ -24,15 +24,10 @@ #include <config.h> -#include "problem.hh" - -#include <ctime> #include <iostream> #include <dune/common/parallel/mpihelper.hh> #include <dune/common/timer.hh> -#include <dune/grid/io/file/vtk.hh> -#include <dune/istl/io.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> @@ -44,32 +39,9 @@ #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. - * - * \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_yasp.hh> + +#include "properties.hh" //////////////////////// // the main function @@ -89,7 +61,7 @@ int main(int argc, char** argv) 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) GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager; diff --git a/test/porousmediumflow/richardsnc/problem.hh b/test/porousmediumflow/richardsnc/problem.hh index 2f2a70d73f..77cd9a4f78 100644 --- a/test/porousmediumflow/richardsnc/problem.hh +++ b/test/porousmediumflow/richardsnc/problem.hh @@ -27,60 +27,14 @@ #ifndef DUMUX_RICHARDS_NC_WELL_TRACER_PROBLEM_HH #define DUMUX_RICHARDS_NC_WELL_TRACER_PROBLEM_HH -#include <dune/grid/yaspgrid.hh> - +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> -#include <dumux/discretization/cctpfa.hh> -#include <dumux/discretization/box.hh> #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/richardsnc/model.hh> - -#include "spatialparams.hh" namespace Dumux { -/*! - * \ingroup RichardsNCTests - * \brief A water infiltration problem with a low-permeability lens - * embedded into a high-permeability domain which uses the - * Richards box model. - */ -template <class TypeTag> -class RichardsWellTracerProblem; - - -// Specify the properties for the lens problem -namespace Properties { -// Create new type tags -namespace TTag { -struct RichardsWellTracer { using InheritsFrom = std::tuple<RichardsNC>; }; -struct RichardsWellTracerBox { using InheritsFrom = std::tuple<RichardsWellTracer, BoxModel>; }; -struct RichardsWellTracerCC { using InheritsFrom = std::tuple<RichardsWellTracer, CCTpfaModel>; }; -} // end namespace TTag - -// Use 2d YaspGrid -template<class TypeTag> -struct Grid<TypeTag, TTag::RichardsWellTracer> { using type = Dune::YaspGrid<2>; }; - -// Set the physical problem to be solved -template<class TypeTag> -struct Problem<TypeTag, TTag::RichardsWellTracer> { using type = RichardsWellTracerProblem<TypeTag>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::RichardsWellTracer> -{ - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = RichardsWellTracerSpatialParams<GridGeometry, Scalar>; -}; - -// Set the physical problem to be solved -template<class TypeTag> -struct PointSource<TypeTag, TTag::RichardsWellTracer> { using type = SolDependentPointSource<TypeTag>; }; -} // end namespace Properties - /*! * \ingroup RichardsNCTests * diff --git a/test/porousmediumflow/richardsnc/properties.hh b/test/porousmediumflow/richardsnc/properties.hh new file mode 100644 index 0000000000..8b92b618b3 --- /dev/null +++ b/test/porousmediumflow/richardsnc/properties.hh @@ -0,0 +1,70 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * \ingroup RichardsNCTests + * \brief The properties of the water infiltration problem with a + * low-permeability lens embedded into a high-permeability domain which + * uses the Richards box model. + */ +#ifndef DUMUX_DONEA_TEST_PROPERTIES_HH +#define DUMUX_DONEA_TEST_PROPERTIES_HH + +#include <dune/grid/yaspgrid.hh> +#include <dumux/discretization/cctpfa.hh> +#include <dumux/discretization/box.hh> +#include <dumux/porousmediumflow/richardsnc/model.hh> + +#include "spatialparams.hh" +#include "problem.hh" + +// Specify the properties for the lens problem +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct RichardsWellTracer { using InheritsFrom = std::tuple<RichardsNC>; }; +struct RichardsWellTracerBox { using InheritsFrom = std::tuple<RichardsWellTracer, BoxModel>; }; +struct RichardsWellTracerCC { using InheritsFrom = std::tuple<RichardsWellTracer, CCTpfaModel>; }; +} // end namespace TTag + +// Use 2d YaspGrid +template<class TypeTag> +struct Grid<TypeTag, TTag::RichardsWellTracer> { using type = Dune::YaspGrid<2>; }; + +// Set the physical problem to be solved +template<class TypeTag> +struct Problem<TypeTag, TTag::RichardsWellTracer> { using type = RichardsWellTracerProblem<TypeTag>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::RichardsWellTracer> +{ + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = RichardsWellTracerSpatialParams<GridGeometry, Scalar>; +}; + +// Set the physical problem to be solved +template<class TypeTag> +struct PointSource<TypeTag, TTag::RichardsWellTracer> { using type = SolDependentPointSource<TypeTag>; }; + +} // end namespace Dumux::Properties + +#endif -- GitLab