From 65e05e93153dda181175a807bb502a7580c6225d Mon Sep 17 00:00:00 2001 From: Mathis Kelm <mathis.kelm@iws.uni-stuttgart.de> Date: Sat, 27 Feb 2021 00:29:39 +0100 Subject: [PATCH] [test][mpnc] Separate properties into their own header --- .../mpnc/2p2ccomparison/main.cc | 41 +---- .../mpnc/2p2ccomparison/problem.hh | 68 +------- .../mpnc/2p2ccomparison/properties.hh | 80 ++++++++++ .../mpnc/2p2ccomparison/spatialparams.hh | 2 +- test/porousmediumflow/mpnc/kinetic/main.cc | 34 +--- test/porousmediumflow/mpnc/kinetic/problem.hh | 75 +-------- .../mpnc/kinetic/properties.hh | 92 +++++++++++ test/porousmediumflow/mpnc/obstacle/main.cc | 41 +---- .../porousmediumflow/mpnc/obstacle/problem.hh | 64 +------- .../mpnc/obstacle/properties.hh | 76 +++++++++ .../mpnc/thermalnonequilibrium/main.cc | 34 +--- .../mpnc/thermalnonequilibrium/problem.hh | 131 +-------------- .../mpnc/thermalnonequilibrium/properties.hh | 151 ++++++++++++++++++ 13 files changed, 423 insertions(+), 466 deletions(-) create mode 100644 test/porousmediumflow/mpnc/2p2ccomparison/properties.hh create mode 100644 test/porousmediumflow/mpnc/kinetic/properties.hh create mode 100644 test/porousmediumflow/mpnc/obstacle/properties.hh create mode 100644 test/porousmediumflow/mpnc/thermalnonequilibrium/properties.hh diff --git a/test/porousmediumflow/mpnc/2p2ccomparison/main.cc b/test/porousmediumflow/mpnc/2p2ccomparison/main.cc index 09e8067693..7e79c23275 100644 --- a/test/porousmediumflow/mpnc/2p2ccomparison/main.cc +++ b/test/porousmediumflow/mpnc/2p2ccomparison/main.cc @@ -23,15 +23,10 @@ */ #include <config.h> -#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 "problem.hh" #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> @@ -47,39 +42,9 @@ #include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.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 arguments for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\n" - "\t definition in DGF format\n" - "\t-SpatialParams.LensLowerLeft coordinates of the lower left corner of the lens [m] \n" - "\t-SpatialParams.LensUpperRight coordinates of the upper right corner of the lens [m] \n" - "\t-SpatialParams.Permeability Permeability of the domain [m^2] \n" - "\t-SpatialParams.PermeabilityLens Permeability of the lens [m^2] \n"; - - std::cout << errorMessageOut - << "\n"; - } -} +#include "properties.hh" int main(int argc, char** argv) { @@ -96,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/mpnc/2p2ccomparison/problem.hh b/test/porousmediumflow/mpnc/2p2ccomparison/problem.hh index 2c23375313..43225c7b53 100644 --- a/test/porousmediumflow/mpnc/2p2ccomparison/problem.hh +++ b/test/porousmediumflow/mpnc/2p2ccomparison/problem.hh @@ -26,77 +26,15 @@ #ifndef DUMUX_MPNC_TWOPTWOC_COMPARISON_OBSTACLEPROBLEM_HH #define DUMUX_MPNC_TWOPTWOC_COMPARISON_OBSTACLEPROBLEM_HH -#include <dune/common/parametertreeparser.hh> -#include <dune/grid/yaspgrid.hh> - +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> -#include <dumux/discretization/box.hh> -#include <dumux/discretization/cctpfa.hh> - -#include <dumux/porousmediumflow/mpnc/model.hh> #include <dumux/porousmediumflow/problem.hh> -#include <test/porousmediumflow/2p2c/mpnccomparison/iofields.hh> - -#include <dumux/material/fluidsystems/h2on2.hh> -#include <dumux/material/fluidstates/compositional.hh> #include <dumux/material/constraintsolvers/misciblemultiphasecomposition.hh> -#include "spatialparams.hh" - namespace Dumux { -/*! - * \ingroup MPNCTests - * \brief Problem where air is injected in a unsaturated porous medium. - * - * This test compares a mpnc problem with a 2p2c problem. - */ -template <class TypeTag> -class MPNCComparisonProblem; - -namespace Properties { -// Create new type tags -namespace TTag { -struct MPNCComparison { using InheritsFrom = std::tuple<MPNC>; }; -struct MPNCComparisonBox { using InheritsFrom = std::tuple<MPNCComparison, BoxModel>; }; -struct MPNCComparisonCC { using InheritsFrom = std::tuple<MPNCComparison, CCTpfaModel>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::MPNCComparison> { using type = Dune::YaspGrid<2>; }; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::MPNCComparison> { using type = MPNCComparisonProblem<TypeTag>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::MPNCComparison> -{ - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = MPNCComparisonSpatialParams<GridGeometry, Scalar>; -}; - -// Set fluid configuration -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::MPNCComparison> -{ - using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, - FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; -}; - -// decide which type to use for floating values (double / quad) -template<class TypeTag> -struct Scalar<TypeTag, TTag::MPNCComparison> { using type = double; }; -template<class TypeTag> -struct UseMoles<TypeTag, TTag::MPNCComparison> { static constexpr bool value = true; }; -template<class TypeTag> -struct IOFields<TypeTag, TTag::MPNCComparison> { using type = TwoPTwoCMPNCIOFields; }; -} // end namespace Dumux - /*! * \ingroup MPNCTests * \brief Problem where air is injected in a unsaturated porous medium. @@ -310,6 +248,6 @@ private: static constexpr Scalar eps_ = 1e-6; std::string name_; }; -} // end namespace +} // end namespace Dumux #endif diff --git a/test/porousmediumflow/mpnc/2p2ccomparison/properties.hh b/test/porousmediumflow/mpnc/2p2ccomparison/properties.hh new file mode 100644 index 0000000000..12fae1222a --- /dev/null +++ b/test/porousmediumflow/mpnc/2p2ccomparison/properties.hh @@ -0,0 +1,80 @@ +// -*- 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 MPNCTests + * \brief The properties of the problem where air is injected in a unsaturated porous medium. + */ +#ifndef DUMUX_MPNC_TWOPTWOC_COMPARISON_OBSTACLE_PROPERTIES_HH +#define DUMUX_MPNC_TWOPTWOC_COMPARISON_OBSTACLE_PROPERTIES_HH + +#include <dune/grid/yaspgrid.hh> +#include <dumux/discretization/box.hh> +#include <dumux/discretization/cctpfa.hh> + +#include <dumux/porousmediumflow/mpnc/model.hh> +#include <dumux/material/fluidsystems/h2on2.hh> +#include <dumux/material/fluidstates/compositional.hh> +#include <test/porousmediumflow/2p2c/mpnccomparison/iofields.hh> + +#include "spatialparams.hh" +#include "problem.hh" + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct MPNCComparison { using InheritsFrom = std::tuple<MPNC>; }; +struct MPNCComparisonBox { using InheritsFrom = std::tuple<MPNCComparison, BoxModel>; }; +struct MPNCComparisonCC { using InheritsFrom = std::tuple<MPNCComparison, CCTpfaModel>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::MPNCComparison> { using type = Dune::YaspGrid<2>; }; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::MPNCComparison> { using type = MPNCComparisonProblem<TypeTag>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::MPNCComparison> +{ + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = MPNCComparisonSpatialParams<GridGeometry, Scalar>; +}; + +// Set fluid configuration +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::MPNCComparison> +{ + using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, + FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; +}; + +template<class TypeTag> +struct UseMoles<TypeTag, TTag::MPNCComparison> { static constexpr bool value = true; }; +template<class TypeTag> +struct IOFields<TypeTag, TTag::MPNCComparison> { using type = TwoPTwoCMPNCIOFields; }; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/mpnc/2p2ccomparison/spatialparams.hh b/test/porousmediumflow/mpnc/2p2ccomparison/spatialparams.hh index ab9a55a8ef..f108e8d76e 100644 --- a/test/porousmediumflow/mpnc/2p2ccomparison/spatialparams.hh +++ b/test/porousmediumflow/mpnc/2p2ccomparison/spatialparams.hh @@ -127,6 +127,6 @@ private: static constexpr Scalar eps_ = 1e-6; }; -} +} // end namespace Dumux #endif diff --git a/test/porousmediumflow/mpnc/kinetic/main.cc b/test/porousmediumflow/mpnc/kinetic/main.cc index bcd56dceae..37f9febf02 100644 --- a/test/porousmediumflow/mpnc/kinetic/main.cc +++ b/test/porousmediumflow/mpnc/kinetic/main.cc @@ -22,15 +22,11 @@ * \brief Test for the three-phase box model. */ #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> @@ -46,33 +42,9 @@ #include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.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 "properties.hh" int main(int argc, char** argv) { @@ -93,7 +65,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/mpnc/kinetic/problem.hh b/test/porousmediumflow/mpnc/kinetic/problem.hh index 24ed4fb559..c7da4b3aea 100644 --- a/test/porousmediumflow/mpnc/kinetic/problem.hh +++ b/test/porousmediumflow/mpnc/kinetic/problem.hh @@ -35,83 +35,14 @@ #ifndef DUMUX_EVAPORATION_ATMOSPHERE_PROBLEM_HH #define DUMUX_EVAPORATION_ATMOSPHERE_PROBLEM_HH -#include <dune/grid/yaspgrid.hh> - -#include <dumux/common/boundarytypes.hh> #include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> +#include <dumux/common/boundarytypes.hh> -#include <dumux/discretization/box.hh> - -#include <dumux/porousmediumflow/mpnc/model.hh> -#include <dumux/porousmediumflow/mpnc/pressureformulation.hh> #include <dumux/porousmediumflow/problem.hh> - -#include <dumux/material/fluidsystems/h2on2kinetic.hh> -#include <dumux/material/components/constant.hh> - -#include "spatialparams.hh" +#include <dumux/material/constraintsolvers/misciblemultiphasecomposition.hh> namespace Dumux { -/*! - * \ingroup MPNCTests - * \brief Problem showcasing the capabilities of the kinetic model. - */ -template <class TypeTag> -class EvaporationAtmosphereProblem; - -namespace Properties { -// Create new type tags -namespace TTag { -struct EvaporationAtmosphere { using InheritsFrom = std::tuple<MPNCNonequil>; }; -struct EvaporationAtmosphereBox { using InheritsFrom = std::tuple<EvaporationAtmosphere, BoxModel>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::EvaporationAtmosphere> { using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::EvaporationAtmosphere> { using type = EvaporationAtmosphereProblem<TypeTag>; }; - -// Set fluid configuration -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::EvaporationAtmosphere> -{ - using type = FluidSystems::H2ON2Kinetic<GetPropType<TypeTag, Properties::Scalar>, - FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; -}; - -//! Set the default pressure formulation: either pw first or pn first -template<class TypeTag> -struct PressureFormulation<TypeTag, TTag::EvaporationAtmosphere> -{ -public: - static const MpNcPressureFormulation value = MpNcPressureFormulation::leastWettingFirst; -}; - -// Set the type used for scalar values -template<class TypeTag> -struct Scalar<TypeTag, TTag::EvaporationAtmosphere> { using type = double; }; - -// Set the fluid system -template<class TypeTag> -struct SolidSystem<TypeTag, TTag::EvaporationAtmosphere> -{ - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using InertComponent = Components::Constant<1, Scalar>; - using type = SolidSystems::InertSolidPhase<Scalar, InertComponent>; -}; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::EvaporationAtmosphere> -{ - using GridGeometry = GetPropType<TypeTag, GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = EvaporationAtmosphereSpatialParams<GridGeometry, Scalar>; -}; -} // end namespace Properties /*! * \ingroup MPNCTests diff --git a/test/porousmediumflow/mpnc/kinetic/properties.hh b/test/porousmediumflow/mpnc/kinetic/properties.hh new file mode 100644 index 0000000000..ddd8ce2c56 --- /dev/null +++ b/test/porousmediumflow/mpnc/kinetic/properties.hh @@ -0,0 +1,92 @@ +// -*- 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 MPNCTests + * \brief The properties of the problem showcasing the capabilities of the kinetic model. + */ +#ifndef DUMUX_EVAPORATION_ATMOSPHERE_PROPERTIES_HH +#define DUMUX_EVAPORATION_ATMOSPHERE_PROPERTIES_HH + +#include <dune/grid/yaspgrid.hh> + +#include <dumux/discretization/box.hh> +#include <dumux/porousmediumflow/mpnc/model.hh> +#include <dumux/material/components/constant.hh> +#include <dumux/material/fluidsystems/h2on2kinetic.hh> +#include <dumux/porousmediumflow/mpnc/pressureformulation.hh> + +#include "spatialparams.hh" +#include "problem.hh" + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct EvaporationAtmosphere { using InheritsFrom = std::tuple<MPNCNonequil>; }; +struct EvaporationAtmosphereBox { using InheritsFrom = std::tuple<EvaporationAtmosphere, BoxModel>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::EvaporationAtmosphere> +{ using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::EvaporationAtmosphere> +{ using type = EvaporationAtmosphereProblem<TypeTag>; }; + +// Set fluid configuration +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::EvaporationAtmosphere> +{ + using type = FluidSystems::H2ON2Kinetic<GetPropType<TypeTag, Properties::Scalar>, + FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; +}; + +//! Set the default pressure formulation: either pw first or pn first +template<class TypeTag> +struct PressureFormulation<TypeTag, TTag::EvaporationAtmosphere> +{ +public: + static const MpNcPressureFormulation value = MpNcPressureFormulation::leastWettingFirst; +}; + +// Set the fluid system +template<class TypeTag> +struct SolidSystem<TypeTag, TTag::EvaporationAtmosphere> +{ + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using InertComponent = Components::Constant<1, Scalar>; + using type = SolidSystems::InertSolidPhase<Scalar, InertComponent>; +}; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::EvaporationAtmosphere> +{ + using GridGeometry = GetPropType<TypeTag, GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = EvaporationAtmosphereSpatialParams<GridGeometry, Scalar>; +}; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/mpnc/obstacle/main.cc b/test/porousmediumflow/mpnc/obstacle/main.cc index 09e8067693..7e79c23275 100644 --- a/test/porousmediumflow/mpnc/obstacle/main.cc +++ b/test/porousmediumflow/mpnc/obstacle/main.cc @@ -23,15 +23,10 @@ */ #include <config.h> -#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 "problem.hh" #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> @@ -47,39 +42,9 @@ #include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.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 arguments for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\n" - "\t definition in DGF format\n" - "\t-SpatialParams.LensLowerLeft coordinates of the lower left corner of the lens [m] \n" - "\t-SpatialParams.LensUpperRight coordinates of the upper right corner of the lens [m] \n" - "\t-SpatialParams.Permeability Permeability of the domain [m^2] \n" - "\t-SpatialParams.PermeabilityLens Permeability of the lens [m^2] \n"; - - std::cout << errorMessageOut - << "\n"; - } -} +#include "properties.hh" int main(int argc, char** argv) { @@ -96,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/mpnc/obstacle/problem.hh b/test/porousmediumflow/mpnc/obstacle/problem.hh index 905fed1f69..0ce105e35f 100644 --- a/test/porousmediumflow/mpnc/obstacle/problem.hh +++ b/test/porousmediumflow/mpnc/obstacle/problem.hh @@ -28,75 +28,15 @@ #ifndef DUMUX_OBSTACLEPROBLEM_HH #define DUMUX_OBSTACLEPROBLEM_HH -#include <dune/common/parametertreeparser.hh> -#include <dune/grid/yaspgrid.hh> - +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> -#include <dumux/discretization/box.hh> -#include <dumux/discretization/cctpfa.hh> - -#include <dumux/porousmediumflow/mpnc/model.hh> #include <dumux/porousmediumflow/problem.hh> - -#include <dumux/material/fluidsystems/h2on2.hh> -#include <dumux/material/fluidstates/compositional.hh> #include <dumux/material/constraintsolvers/computefromreferencephase.hh> -#include "spatialparams.hh" - namespace Dumux { -/*! - * \ingroup MPNCTests - * \brief Problem where liquid water is injected which has to go - * around an obstacle with \f$10^3\f$ lower permeability. - * - * The water is injected by means of a Dirichlet condition on the lower - * right of the domain. - */ -template <class TypeTag> -class ObstacleProblem; - -namespace Properties { -// Create new type tags -namespace TTag { -struct Obstacle { using InheritsFrom = std::tuple<MPNC>; }; -struct ObstacleBox { using InheritsFrom = std::tuple<Obstacle, BoxModel>; }; -struct ObstacleCC { using InheritsFrom = std::tuple<Obstacle, CCTpfaModel>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::Obstacle> { using type = Dune::YaspGrid<2>; }; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::Obstacle> { using type = ObstacleProblem<TypeTag>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::Obstacle> -{ - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = ObstacleSpatialParams<GridGeometry, Scalar>; -}; - -// Set fluid configuration -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::Obstacle> -{ - using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, - FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; -}; - -// decide which type to use for floating values (double / quad) -template<class TypeTag> -struct Scalar<TypeTag, TTag::Obstacle> { using type = double; }; - -} - /*! * \ingroup MPNCTests * \brief Problem where liquid water is injected which has to go diff --git a/test/porousmediumflow/mpnc/obstacle/properties.hh b/test/porousmediumflow/mpnc/obstacle/properties.hh new file mode 100644 index 0000000000..8a802b17a8 --- /dev/null +++ b/test/porousmediumflow/mpnc/obstacle/properties.hh @@ -0,0 +1,76 @@ +// -*- 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 MPNCTests + * \brief The properties of the problem where liquid water is injected which has to go around an + * obstacle with \f$10^3\f$ lower permeability. + */ +#ifndef DUMUX_TEST_MPNC_OBSTACLE_PROPERTIES_HH +#define DUMUX_TEST_MPNC_OBSTACLE_PROPERTIES_HH + +#include <dune/grid/yaspgrid.hh> + +#include <dumux/discretization/box.hh> +#include <dumux/discretization/cctpfa.hh> + +#include <dumux/porousmediumflow/mpnc/model.hh> +#include <dumux/material/fluidsystems/h2on2.hh> +#include <dumux/material/fluidstates/compositional.hh> + +#include "spatialparams.hh" +#include "problem.hh" + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct Obstacle { using InheritsFrom = std::tuple<MPNC>; }; +struct ObstacleBox { using InheritsFrom = std::tuple<Obstacle, BoxModel>; }; +struct ObstacleCC { using InheritsFrom = std::tuple<Obstacle, CCTpfaModel>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::Obstacle> { using type = Dune::YaspGrid<2>; }; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::Obstacle> { using type = ObstacleProblem<TypeTag>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::Obstacle> +{ + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = ObstacleSpatialParams<GridGeometry, Scalar>; +}; + +// Set fluid configuration +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::Obstacle> +{ + using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, + FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; +}; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/mpnc/thermalnonequilibrium/main.cc b/test/porousmediumflow/mpnc/thermalnonequilibrium/main.cc index 9685987600..11b3036c8a 100644 --- a/test/porousmediumflow/mpnc/thermalnonequilibrium/main.cc +++ b/test/porousmediumflow/mpnc/thermalnonequilibrium/main.cc @@ -22,15 +22,11 @@ * \brief Test for the three-phase box model. */ #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> @@ -46,33 +42,9 @@ #include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_oned.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 "properties.hh" int main(int argc, char** argv) { @@ -93,7 +65,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/mpnc/thermalnonequilibrium/problem.hh b/test/porousmediumflow/mpnc/thermalnonequilibrium/problem.hh index 48ffdd6503..6378d36aad 100644 --- a/test/porousmediumflow/mpnc/thermalnonequilibrium/problem.hh +++ b/test/porousmediumflow/mpnc/thermalnonequilibrium/problem.hh @@ -30,140 +30,15 @@ #ifndef DUMUX_COMBUSTION_PROBLEM_ONE_COMPONENT_HH #define DUMUX_COMBUSTION_PROBLEM_ONE_COMPONENT_HH -#include <dune/grid/onedgrid.hh> - +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> -#include <dumux/discretization/box.hh> - #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/mpnc/model.hh> -#include <dumux/porousmediumflow/mpnc/pressureformulation.hh> - -#include <dumux/material/solidstates/compositionalsolidstate.hh> -#include <dumux/material/solidsystems/compositionalsolidphase.hh> -#include <dumux/material/components/constant.hh> - -#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivity/simplefluidlumping.hh> #include <dumux/material/constraintsolvers/computefromreferencephase.hh> -#include "spatialparams.hh" -#include "combustionfluidsystem.hh" -#include "combustionlocalresidual.hh" - namespace Dumux { -template<class TypeTag> -class CombustionProblemOneComponent; - -//! Custom model traits to deactivate diffusion for this test -template<int numP, int numC, MpNcPressureFormulation formulation, bool useM> -struct CombustionModelTraits : public MPNCModelTraits<numP, numC, formulation, useM> -{ - static constexpr bool enableMolecularDiffusion() { return false; } -}; - -namespace Properties { -// Create new type tags -namespace TTag { -struct CombustionOneComponent { using InheritsFrom = std::tuple<MPNCNonequil>; }; -struct CombustionOneComponentBox { using InheritsFrom = std::tuple<CombustionOneComponent, BoxModel>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::CombustionOneComponent> { using type = Dune::OneDGrid; }; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::CombustionOneComponent> -{ using type = CombustionProblemOneComponent<TypeTag>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::CombustionOneComponent> -{ - using GridGeometry = GetPropType<TypeTag, GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = CombustionSpatialParams<GridGeometry, Scalar>; -}; - -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::CombustionOneComponent> -{ using type = FluidSystems::CombustionFluidsystem<GetPropType<TypeTag, Properties::Scalar>>; }; - -//! Set the default pressure formulation: either pw first or pn first -template<class TypeTag> -struct PressureFormulation<TypeTag, TTag::CombustionOneComponent> -{ -public: - static const MpNcPressureFormulation value = MpNcPressureFormulation::mostWettingFirst; -}; - -// Set the type used for scalar values -template<class TypeTag> -struct Scalar<TypeTag, TTag::CombustionOneComponent> { using type = double ; }; -// quad / double - -// We use different model traits for the equilibrium part because we want to deactivate diffusion -template<class TypeTag> -struct EquilibriumModelTraits<TypeTag, TTag::CombustionOneComponent> -{ -private: - using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; -public: - using type = CombustionModelTraits< FluidSystem::numPhases, - FluidSystem::numComponents, - getPropValue<TypeTag, Properties::PressureFormulation>(), - getPropValue<TypeTag, Properties::UseMoles>() >; -}; - -template<class TypeTag> -struct FluidState<TypeTag, TTag::CombustionOneComponent> -{ -private: - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; -public: - using type = CompositionalFluidState<Scalar, FluidSystem>; -}; -//################# -//changes from the default settings which also assume chemical non-equilibrium -//set the number of energyequations we want to use -template<class TypeTag> -struct NumEnergyEqFluid<TypeTag, TTag::CombustionOneComponent> { static constexpr int value = 1; }; -template<class TypeTag> -struct NumEnergyEqSolid<TypeTag, TTag::CombustionOneComponent> { static constexpr int value = 1; }; - -// by default chemical non equilibrium is enabled in the nonequil model, switch that off here -template<class TypeTag> -struct EnableChemicalNonEquilibrium<TypeTag, TTag::CombustionOneComponent> { static constexpr bool value = false; }; -//################# - -template<class TypeTag> -struct SolidSystem<TypeTag, TTag::CombustionOneComponent> -{ - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using ComponentOne = Dumux::Components::Constant<1, Scalar>; - using ComponentTwo = Dumux::Components::Constant<2, Scalar>; - static constexpr int numInertComponents = 2; - using type = SolidSystems::CompositionalSolidPhase<Scalar, ComponentOne, ComponentTwo, numInertComponents>; -}; - -template<class TypeTag> -struct SolidState<TypeTag, TTag::CombustionOneComponent> -{ -private: - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using SolidSystem = GetPropType<TypeTag, Properties::SolidSystem>; -public: - using type = CompositionalSolidState<Scalar, SolidSystem>; -}; - -template<class TypeTag> -struct EnergyLocalResidual<TypeTag, TTag::CombustionOneComponent> -{ using type = CombustionEnergyLocalResidual<TypeTag>; }; -} /*! * \ingroup MPNCTests * \brief Problem where water is injected from the left hand side into a porous media filled domain, @@ -566,6 +441,6 @@ private: std::shared_ptr<GridVariables> gridVariables_; }; -} // end namespace +} // end namespace Dumux #endif diff --git a/test/porousmediumflow/mpnc/thermalnonequilibrium/properties.hh b/test/porousmediumflow/mpnc/thermalnonequilibrium/properties.hh new file mode 100644 index 0000000000..75b90ca1b9 --- /dev/null +++ b/test/porousmediumflow/mpnc/thermalnonequilibrium/properties.hh @@ -0,0 +1,151 @@ +// -*- 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 MPNCTests + * \brief The properties of the problem where hot, pure liquid water is injected from the left hand + * side into a initially isotherm domain. + */ +#ifndef DUMUX_COMBUSTION_PROPERTIES_ONE_COMPONENT_HH +#define DUMUX_COMBUSTION_PROPERTIES_ONE_COMPONENT_HH + +#include <dune/grid/onedgrid.hh> + +#include <dumux/discretization/box.hh> +#include <dumux/porousmediumflow/mpnc/model.hh> +#include <dumux/porousmediumflow/mpnc/pressureformulation.hh> + +#include <dumux/material/solidstates/compositionalsolidstate.hh> +#include <dumux/material/solidsystems/compositionalsolidphase.hh> +#include <dumux/material/components/constant.hh> + +#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivity/simplefluidlumping.hh> + +#include "spatialparams.hh" +#include "combustionfluidsystem.hh" +#include "combustionlocalresidual.hh" +#include "problem.hh" + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct CombustionOneComponent { using InheritsFrom = std::tuple<MPNCNonequil>; }; +struct CombustionOneComponentBox { using InheritsFrom = std::tuple<CombustionOneComponent, BoxModel>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::CombustionOneComponent> { using type = Dune::OneDGrid; }; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::CombustionOneComponent> +{ using type = CombustionProblemOneComponent<TypeTag>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::CombustionOneComponent> +{ + using GridGeometry = GetPropType<TypeTag, GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = CombustionSpatialParams<GridGeometry, Scalar>; +}; + +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::CombustionOneComponent> +{ using type = FluidSystems::CombustionFluidsystem<GetPropType<TypeTag, Properties::Scalar>>; }; + +//! Set the default pressure formulation: either pw first or pn first +template<class TypeTag> +struct PressureFormulation<TypeTag, TTag::CombustionOneComponent> +{ +public: + static const MpNcPressureFormulation value = MpNcPressureFormulation::mostWettingFirst; +}; + +//! Custom model traits to deactivate diffusion for this test +template<int numP, int numC, MpNcPressureFormulation formulation, bool useM> +struct CombustionModelTraits : public MPNCModelTraits<numP, numC, formulation, useM> +{ + static constexpr bool enableMolecularDiffusion() { return false; } +}; + +// We use different model traits for the equilibrium part because we want to deactivate diffusion +template<class TypeTag> +struct EquilibriumModelTraits<TypeTag, TTag::CombustionOneComponent> +{ +private: + using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; +public: + using type = CombustionModelTraits< FluidSystem::numPhases, + FluidSystem::numComponents, + getPropValue<TypeTag, Properties::PressureFormulation>(), + getPropValue<TypeTag, Properties::UseMoles>() >; +}; + +template<class TypeTag> +struct FluidState<TypeTag, TTag::CombustionOneComponent> +{ +private: + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; +public: + using type = CompositionalFluidState<Scalar, FluidSystem>; +}; +//################# +//changes from the default settings which also assume chemical non-equilibrium +//set the number of energyequations we want to use +template<class TypeTag> +struct NumEnergyEqFluid<TypeTag, TTag::CombustionOneComponent> { static constexpr int value = 1; }; +template<class TypeTag> +struct NumEnergyEqSolid<TypeTag, TTag::CombustionOneComponent> { static constexpr int value = 1; }; + +// by default chemical non equilibrium is enabled in the nonequil model, switch that off here +template<class TypeTag> +struct EnableChemicalNonEquilibrium<TypeTag, TTag::CombustionOneComponent> { static constexpr bool value = false; }; +//################# + +template<class TypeTag> +struct SolidSystem<TypeTag, TTag::CombustionOneComponent> +{ + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using ComponentOne = Dumux::Components::Constant<1, Scalar>; + using ComponentTwo = Dumux::Components::Constant<2, Scalar>; + static constexpr int numInertComponents = 2; + using type = SolidSystems::CompositionalSolidPhase<Scalar, ComponentOne, ComponentTwo, numInertComponents>; +}; + +template<class TypeTag> +struct SolidState<TypeTag, TTag::CombustionOneComponent> +{ +private: + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using SolidSystem = GetPropType<TypeTag, Properties::SolidSystem>; +public: + using type = CompositionalSolidState<Scalar, SolidSystem>; +}; + +template<class TypeTag> +struct EnergyLocalResidual<TypeTag, TTag::CombustionOneComponent> +{ using type = CombustionEnergyLocalResidual<TypeTag>; }; + +} // end namespace Dumux::Properties + +#endif -- GitLab