From 406a23f2aa7a35f6a6419378f435e154bb5529de Mon Sep 17 00:00:00 2001 From: Yue Wang <yue.wang@iws.uni-stuttgart.de> Date: Sat, 27 Feb 2021 00:19:27 +0100 Subject: [PATCH] [test][2p] Separate properties into their own header --- test/porousmediumflow/2p/adaptive/main.cc | 37 +----- test/porousmediumflow/2p/adaptive/problem.hh | 3 +- .../2p/adaptive/properties.hh | 67 +++++++++++ test/porousmediumflow/2p/boxdfm/main.cc | 36 +----- test/porousmediumflow/2p/boxdfm/problem.hh | 82 +------------ test/porousmediumflow/2p/boxdfm/properties.hh | 108 ++++++++++++++++++ test/porousmediumflow/2p/cornerpoint/main.cc | 42 +------ .../2p/cornerpoint/problem.hh | 69 +---------- .../2p/cornerpoint/properties.hh | 93 +++++++++++++++ test/porousmediumflow/2p/fracture/main.cc | 2 +- test/porousmediumflow/2p/fracture/problem.hh | 74 +----------- .../2p/fracture/properties.hh | 100 ++++++++++++++++ .../2p/incompressible/main.cc | 44 +------ .../2p/incompressible/problem.hh | 78 +------------ .../2p/incompressible/properties.hh | 104 +++++++++++++++++ .../porousmediumflow/2p/nonisothermal/main.cc | 33 +----- .../2p/nonisothermal/problem.hh | 57 +-------- .../2p/nonisothermal/properties.hh | 90 +++++++++++++++ test/porousmediumflow/tracer/2ptracer/main.cc | 5 +- .../{problem_tracer.hh => problem.hh} | 0 .../{properties_tracer.hh => properties.hh} | 6 +- ...atialparams_tracer.hh => spatialparams.hh} | 0 22 files changed, 591 insertions(+), 539 deletions(-) create mode 100644 test/porousmediumflow/2p/adaptive/properties.hh create mode 100644 test/porousmediumflow/2p/boxdfm/properties.hh create mode 100644 test/porousmediumflow/2p/cornerpoint/properties.hh create mode 100644 test/porousmediumflow/2p/fracture/properties.hh create mode 100644 test/porousmediumflow/2p/incompressible/properties.hh create mode 100644 test/porousmediumflow/2p/nonisothermal/properties.hh rename test/porousmediumflow/tracer/2ptracer/{problem_tracer.hh => problem.hh} (100%) rename test/porousmediumflow/tracer/2ptracer/{properties_tracer.hh => properties.hh} (97%) rename test/porousmediumflow/tracer/2ptracer/{spatialparams_tracer.hh => spatialparams.hh} (100%) diff --git a/test/porousmediumflow/2p/adaptive/main.cc b/test/porousmediumflow/2p/adaptive/main.cc index 4069ce9b4b..ff4cc3a4ee 100644 --- a/test/porousmediumflow/2p/adaptive/main.cc +++ b/test/porousmediumflow/2p/adaptive/main.cc @@ -57,42 +57,9 @@ // Use the incompressible or point source problem for this adaptive test #include <test/porousmediumflow/2p/incompressible/problem.hh> + #include "pointsourceproblem.hh" -#include "problem.hh" - -// Type tags for the adaptive versions of the two-phase incompressible problem -namespace Dumux { -namespace Properties { -//! Type Tags for the adaptive tests -// Create new type tags -namespace TTag { -struct TwoPIncompressibleAdaptiveTpfa { using InheritsFrom = std::tuple<TwoPIncompressibleTpfa>; }; -struct TwoPIncompressibleAdaptiveMpfa { using InheritsFrom = std::tuple<TwoPIncompressibleMpfa>; }; -struct TwoPIncompressibleAdaptiveBox { using InheritsFrom = std::tuple<TwoPIncompressibleBox>; }; -struct TwoPAdaptivePointSource { using InheritsFrom = std::tuple<TwoPIncompressibleAdaptiveTpfa>; }; -} // end namespace TTag - -//! Use non-conforming refinement in the cell-centered tests, conforming for box -#if HAVE_DUNE_ALUGRID -template<class TypeTag> -struct Grid<TypeTag, TTag::TwoPIncompressibleAdaptiveTpfa> { using type = Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>; }; -template<class TypeTag> -struct Grid<TypeTag, TTag::TwoPIncompressibleAdaptiveMpfa> { using type = Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>; }; -#endif -#if HAVE_DUNE_UGGRID -template<class TypeTag> -struct Grid<TypeTag, TTag::TwoPIncompressibleAdaptiveBox> { using type = Dune::UGGrid<2>; }; -#endif -template<class TypeTag> -struct Problem<TypeTag, TTag::TwoPAdaptivePointSource> { using type = PointSourceTestProblem<TypeTag>; }; -template<class TypeTag> -struct Problem<TypeTag, TTag::TwoPIncompressibleAdaptiveTpfa> { using type = TwoPTestProblemAdaptive<TypeTag>; }; -template<class TypeTag> -struct Problem<TypeTag, TTag::TwoPIncompressibleAdaptiveMpfa> { using type = TwoPTestProblemAdaptive<TypeTag>; }; -template<class TypeTag> -struct Problem<TypeTag, TTag::TwoPIncompressibleAdaptiveBox> { using type = TwoPTestProblemAdaptive<TypeTag>; }; -} // end namespace Properties -} // end namespace Dumux +#include "properties.hh" int main(int argc, char** argv) { diff --git a/test/porousmediumflow/2p/adaptive/problem.hh b/test/porousmediumflow/2p/adaptive/problem.hh index 28bf581bd0..78753253ac 100644 --- a/test/porousmediumflow/2p/adaptive/problem.hh +++ b/test/porousmediumflow/2p/adaptive/problem.hh @@ -26,9 +26,8 @@ #ifndef DUMUX_LENSPROBLEM_ADAPTIVE_HH #define DUMUX_LENSPROBLEM_ADAPTIVE_HH -#include "../incompressible/problem.hh" - #include <dumux/io/container.hh> +#include "../incompressible/problem.hh" namespace Dumux { diff --git a/test/porousmediumflow/2p/adaptive/properties.hh b/test/porousmediumflow/2p/adaptive/properties.hh new file mode 100644 index 0000000000..2fc9123634 --- /dev/null +++ b/test/porousmediumflow/2p/adaptive/properties.hh @@ -0,0 +1,67 @@ +// -*- 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 TwoPTests + * \brief Soil contamination problem where DNAPL infiltrates a fully + * water saturated medium. + */ + +#ifndef DUMUX_LENSPROBLEM_ADAPTIVE_PROPERTIES_HH +#define DUMUX_LENSPROBLEM_ADAPTIVE_PROPERTIES_HH + +#include <test/porousmediumflow/2p/incompressible/problem.hh> +#include "../incompressible/properties.hh" +#include "problem.hh" + +// Type tags for the adaptive versions of the two-phase incompressible problem +namespace Dumux::Properties { + +//! Type Tags for the adaptive tests +// Create new type tags +namespace TTag { +struct TwoPIncompressibleAdaptiveTpfa { using InheritsFrom = std::tuple<TwoPIncompressibleTpfa>; }; +struct TwoPIncompressibleAdaptiveMpfa { using InheritsFrom = std::tuple<TwoPIncompressibleMpfa>; }; +struct TwoPIncompressibleAdaptiveBox { using InheritsFrom = std::tuple<TwoPIncompressibleBox>; }; +struct TwoPAdaptivePointSource { using InheritsFrom = std::tuple<TwoPIncompressibleAdaptiveTpfa>; }; +} // end namespace TTag + +//! Use non-conforming refinement in the cell-centered tests, conforming for box +#if HAVE_DUNE_ALUGRID +template<class TypeTag> +struct Grid<TypeTag, TTag::TwoPIncompressibleAdaptiveTpfa> { using type = Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>; }; +template<class TypeTag> +struct Grid<TypeTag, TTag::TwoPIncompressibleAdaptiveMpfa> { using type = Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>; }; +#endif +#if HAVE_DUNE_UGGRID +template<class TypeTag> +struct Grid<TypeTag, TTag::TwoPIncompressibleAdaptiveBox> { using type = Dune::UGGrid<2>; }; +#endif +template<class TypeTag> +struct Problem<TypeTag, TTag::TwoPAdaptivePointSource> { using type = PointSourceTestProblem<TypeTag>; }; +template<class TypeTag> +struct Problem<TypeTag, TTag::TwoPIncompressibleAdaptiveTpfa> { using type = TwoPTestProblemAdaptive<TypeTag>; }; +template<class TypeTag> +struct Problem<TypeTag, TTag::TwoPIncompressibleAdaptiveMpfa> { using type = TwoPTestProblemAdaptive<TypeTag>; }; +template<class TypeTag> +struct Problem<TypeTag, TTag::TwoPIncompressibleAdaptiveBox> { using type = TwoPTestProblemAdaptive<TypeTag>; }; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/2p/boxdfm/main.cc b/test/porousmediumflow/2p/boxdfm/main.cc index e59caef33e..74670c52a0 100644 --- a/test/porousmediumflow/2p/boxdfm/main.cc +++ b/test/porousmediumflow/2p/boxdfm/main.cc @@ -29,8 +29,6 @@ #include <dune/common/parallel/mpihelper.hh> #include <dune/foamgrid/foamgrid.hh> -#include "problem.hh" - #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> #include <dumux/common/dumuxmessage.hh> @@ -47,37 +45,7 @@ #include <dumux/porousmediumflow/boxdfm/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 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) { @@ -94,7 +62,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); // we reuse the facet coupling grid manager to create the grid // from a mesh file with the fractures being incorporated as diff --git a/test/porousmediumflow/2p/boxdfm/problem.hh b/test/porousmediumflow/2p/boxdfm/problem.hh index 41c297aad6..4fcc584b80 100644 --- a/test/porousmediumflow/2p/boxdfm/problem.hh +++ b/test/porousmediumflow/2p/boxdfm/problem.hh @@ -24,92 +24,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/common/properties.hh> +#include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> -#include <dumux/material/components/trichloroethene.hh> -#include <dumux/material/components/simpleh2o.hh> -#include <dumux/material/fluidsystems/1pliquid.hh> -#include <dumux/material/fluidsystems/2pimmiscible.hh> - #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/2p/model.hh> -#include <dumux/porousmediumflow/boxdfm/model.hh> -#include <dumux/porousmediumflow/2p/incompressiblelocalresidual.hh> - -#include "spatialparams.hh" - -#ifndef GRIDTYPE -#define GRIDTYPE Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>; -#endif namespace Dumux { -// forward declarations -template<class TypeTag> class TwoPTestProblem; - -namespace Properties { - -// we need to derive first from twop and then from the box-dfm Model -// because the flux variables cache type of TwoP is overwritten in BoxDfmModel -// Create new type tags -namespace TTag { -struct TwoPIncompressibleBoxDfm { using InheritsFrom = std::tuple<BoxDfmModel, TwoP>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::TwoPIncompressibleBoxDfm> { using type = GRIDTYPE; }; - -// Set the problem type -template<class TypeTag> -struct Problem<TypeTag, TTag::TwoPIncompressibleBoxDfm> { using type = TwoPTestProblem<TypeTag>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::TwoPIncompressibleBoxDfm> -{ -private: - using FVG = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; -public: - using type = TwoPTestSpatialParams<FVG, Scalar>; -}; - -// the local residual containing the analytic derivative methods -template<class TypeTag> -struct LocalResidual<TypeTag, TTag::TwoPIncompressibleBoxDfm> { using type = TwoPIncompressibleLocalResidual<TypeTag>; }; - -// Set the fluid system -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::TwoPIncompressibleBoxDfm> -{ - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >; - using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >; - using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>; -}; - -// Enable caching -template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = false; }; -template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = false; }; -template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = false; }; - -// Enable the box-interface solver -template<class TypeTag> -struct EnableBoxInterfaceSolver<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = true; }; -} // end namespace Properties - /*! * \ingroup TwoPTests * \brief The incompressible 2p-boxdfm test problem. diff --git a/test/porousmediumflow/2p/boxdfm/properties.hh b/test/porousmediumflow/2p/boxdfm/properties.hh new file mode 100644 index 0000000000..f5e4e093cc --- /dev/null +++ b/test/porousmediumflow/2p/boxdfm/properties.hh @@ -0,0 +1,108 @@ +// -*- 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/>. * + *****************************************************************************/ +/*! + * \ingroup TwoPTests + * \brief The properties for the incompressible 2p-boxdfm test. + */ + +#ifndef DUMUX_INCOMPRESSIBLE_TWOPBOXDFM_TEST_PROPERTIES_HH +#define DUMUX_INCOMPRESSIBLE_TWOPBOXDFM_TEST_PROPERTIES_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> +#include <dumux/material/fluidsystems/2pimmiscible.hh> + +#include <dumux/porousmediumflow/2p/model.hh> +#include <dumux/porousmediumflow/boxdfm/model.hh> +#include <dumux/porousmediumflow/2p/incompressiblelocalresidual.hh> + +#include "problem.hh" +#include "spatialparams.hh" + +#ifndef GRIDTYPE +#include <dune/alugrid/grid.hh> +#define GRIDTYPE Dune::ALUGrid<2, 2, Dune::simplex , Dune::conforming>; +#endif + +namespace Dumux::Properties { + +// we need to derive first from twop and then from the box-dfm Model +// because the flux variables cache type of TwoP is overwritten in BoxDfmModel +// Create new type tags +namespace TTag { +struct TwoPIncompressibleBoxDfm { using InheritsFrom = std::tuple<BoxDfmModel, TwoP>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::TwoPIncompressibleBoxDfm> { using type = GRIDTYPE; }; + +// Set the problem type +template<class TypeTag> +struct Problem<TypeTag, TTag::TwoPIncompressibleBoxDfm> { using type = TwoPTestProblem<TypeTag>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::TwoPIncompressibleBoxDfm> +{ +private: + using FVG = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; +public: + using type = TwoPTestSpatialParams<FVG, Scalar>; +}; + +// the local residual containing the analytic derivative methods +template<class TypeTag> +struct LocalResidual<TypeTag, TTag::TwoPIncompressibleBoxDfm> { using type = TwoPIncompressibleLocalResidual<TypeTag>; }; + +// Set the fluid system +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::TwoPIncompressibleBoxDfm> +{ + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >; + using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >; + using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>; +}; + +// Enable caching +template<class TypeTag> +struct EnableGridVolumeVariablesCache<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = false; }; +template<class TypeTag> +struct EnableGridFluxVariablesCache<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = false; }; +template<class TypeTag> +struct EnableGridGeometryCache<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = false; }; + +// Enable the box-interface solver +template<class TypeTag> +struct EnableBoxInterfaceSolver<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = true; }; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/2p/cornerpoint/main.cc b/test/porousmediumflow/2p/cornerpoint/main.cc index 912b99d799..e8eabba321 100644 --- a/test/porousmediumflow/2p/cornerpoint/main.cc +++ b/test/porousmediumflow/2p/cornerpoint/main.cc @@ -30,15 +30,10 @@ #define HAVE_UG 0 #endif -#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> @@ -49,44 +44,11 @@ #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> -#include <dumux/assembly/diffmethod.hh> - -#include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/grid/cpgridmanager.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) { @@ -103,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) CpGridManager gridManager; diff --git a/test/porousmediumflow/2p/cornerpoint/problem.hh b/test/porousmediumflow/2p/cornerpoint/problem.hh index 23ab3739b7..84f53984f4 100644 --- a/test/porousmediumflow/2p/cornerpoint/problem.hh +++ b/test/porousmediumflow/2p/cornerpoint/problem.hh @@ -24,75 +24,13 @@ #ifndef DUMUX_TWOP_CORNERPOINT_TEST_PROBLEM_HH #define DUMUX_TWOP_CORNERPOINT_TEST_PROBLEM_HH -#if HAVE_OPM_GRID -#include <opm/grid/CpGrid.hpp> - +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> #include <dumux/common/boundarytypes.hh> -#include <dumux/discretization/cctpfa.hh> - -#include <dumux/material/components/trichloroethene.hh> -#include <dumux/material/components/simpleh2o.hh> -#include <dumux/material/fluidsystems/1pliquid.hh> -#include <dumux/material/fluidsystems/2pimmiscible.hh> - #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/2p/model.hh> -#include <dumux/porousmediumflow/2p/incompressiblelocalresidual.hh> - -#include "spatialparams.hh" namespace Dumux { -// forward declarations -template<class TypeTag> class TwoPCornerPointTestProblem; - -namespace Properties { -// Create new type tags -namespace TTag { -struct TwoPCornerPoint { using InheritsFrom = std::tuple<CCTpfaModel, TwoP>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::TwoPCornerPoint> { using type = Dune::CpGrid; }; - -// Set the problem type -template<class TypeTag> -struct Problem<TypeTag, TTag::TwoPCornerPoint> { using type = TwoPCornerPointTestProblem<TypeTag>; }; - -// the local residual containing the analytic derivative methods -template<class TypeTag> -struct LocalResidual<TypeTag, TTag::TwoPCornerPoint> { using type = TwoPIncompressibleLocalResidual<TypeTag>; }; - -// Set the fluid system -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::TwoPCornerPoint> -{ - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >; - using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >; - using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>; -}; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::TwoPCornerPoint> -{ -private: - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; -public: - using type = TwoPCornerPointTestSpatialParams<GridGeometry, Scalar>; -}; - -// Enable caching -template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::TwoPCornerPoint> { static constexpr bool value = false; }; -template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::TwoPCornerPoint> { static constexpr bool value = false; }; -template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::TwoPCornerPoint> { static constexpr bool value = false; }; -} // end namespace Properties /*! * \ingroup TwoPTests @@ -266,8 +204,5 @@ private: } // end namespace Dumux -#else -#warning "The opm-grid module is needed to use this class!" -#endif #endif diff --git a/test/porousmediumflow/2p/cornerpoint/properties.hh b/test/porousmediumflow/2p/cornerpoint/properties.hh new file mode 100644 index 0000000000..a7021b62a0 --- /dev/null +++ b/test/porousmediumflow/2p/cornerpoint/properties.hh @@ -0,0 +1,93 @@ +// -*- 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/>. * + *****************************************************************************/ +/*! + * \ingroup TwoPTests + * \brief The properties for the 2p cornerpoint test. + */ + +#ifndef DUMUX_TWOP_CORNERPOINT_TEST_PROPERTIES_HH +#define DUMUX_TWOP_CORNERPOINT_TEST_PROPERTIES_HH + +#if HAVE_OPM_GRID +#include <opm/grid/CpGrid.hpp> + +#include <dumux/discretization/cctpfa.hh> + +#include <dumux/material/components/trichloroethene.hh> +#include <dumux/material/components/simpleh2o.hh> +#include <dumux/material/fluidsystems/1pliquid.hh> +#include <dumux/material/fluidsystems/2pimmiscible.hh> + +#include "problem.hh" +#include "spatialparams.hh" + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct TwoPCornerPoint { using InheritsFrom = std::tuple<CCTpfaModel, TwoP>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::TwoPCornerPoint> { using type = Dune::CpGrid; }; + +// Set the problem type +template<class TypeTag> +struct Problem<TypeTag, TTag::TwoPCornerPoint> { using type = TwoPCornerPointTestProblem<TypeTag>; }; + +// the local residual containing the analytic derivative methods +template<class TypeTag> +struct LocalResidual<TypeTag, TTag::TwoPCornerPoint> { using type = TwoPIncompressibleLocalResidual<TypeTag>; }; + +// Set the fluid system +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::TwoPCornerPoint> +{ + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >; + using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >; + using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>; +}; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::TwoPCornerPoint> +{ +private: + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; +public: + using type = TwoPCornerPointTestSpatialParams<GridGeometry, Scalar>; +}; + +// Enable caching +template<class TypeTag> +struct EnableGridVolumeVariablesCache<TypeTag, TTag::TwoPCornerPoint> { static constexpr bool value = false; }; +template<class TypeTag> +struct EnableGridFluxVariablesCache<TypeTag, TTag::TwoPCornerPoint> { static constexpr bool value = false; }; +template<class TypeTag> +struct EnableGridGeometryCache<TypeTag, TTag::TwoPCornerPoint> { static constexpr bool value = false; }; +} // end namespace Properties + +#else +#warning "The opm-grid module is needed to use this class!" +#endif + +#endif diff --git a/test/porousmediumflow/2p/fracture/main.cc b/test/porousmediumflow/2p/fracture/main.cc index 65ee5f3c5b..b2a06cbb52 100644 --- a/test/porousmediumflow/2p/fracture/main.cc +++ b/test/porousmediumflow/2p/fracture/main.cc @@ -42,7 +42,7 @@ #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/grid/gridmanager_foam.hh> -#include "problem.hh" +#include "properties.hh" //////////////////////// // the main function diff --git a/test/porousmediumflow/2p/fracture/problem.hh b/test/porousmediumflow/2p/fracture/problem.hh index d69d4a5a0d..dab7fb15dc 100644 --- a/test/porousmediumflow/2p/fracture/problem.hh +++ b/test/porousmediumflow/2p/fracture/problem.hh @@ -26,82 +26,14 @@ #ifndef DUMUX_TWOP_FRACTURE_TEST_PROBLEM_HH #define DUMUX_TWOP_FRACTURE_TEST_PROBLEM_HH -#if HAVE_DUNE_FOAMGRID -#include <dune/foamgrid/foamgrid.hh> -#endif - -#include <dumux/material/components/simpleh2o.hh> -#include <dumux/material/components/trichloroethene.hh> -#include <dumux/material/fluidsystems/2pimmiscible.hh> -#include <dumux/material/fluidsystems/1pliquid.hh> - -#include <dumux/porousmediumflow/2p/model.hh> -#include <dumux/porousmediumflow/problem.hh> - +#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 "spatialparams.hh" +#include <dumux/porousmediumflow/problem.hh> namespace Dumux { -template <class TypeTag> -class FractureProblem; - -namespace Properties { -// Create new type tags -namespace TTag { -struct Fracture { using InheritsFrom = std::tuple<TwoP>; }; -struct FractureBox { using InheritsFrom = std::tuple<Fracture, BoxModel>; }; -struct FractureCCTpfa { using InheritsFrom = std::tuple<Fracture, CCTpfaModel>; }; -struct FractureCCMpfa { using InheritsFrom = std::tuple<Fracture, CCMpfaModel>; }; -} // end namespace TTag - -// set the grid property -#if HAVE_DUNE_FOAMGRID -template<class TypeTag> -struct Grid<TypeTag, TTag::Fracture> { using type = Dune::FoamGrid<2, 3>; }; -#endif - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::Fracture> { using type = Dumux::FractureProblem<TypeTag>; }; - -// Set the fluid system -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::Fracture> -{ - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >; - using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >; - using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>; -}; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::Fracture> -{ - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = FractureSpatialParams<GridGeometry, Scalar>; -}; - -// Use global caching -template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::Fracture> { static constexpr bool value = true; }; -template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::Fracture> { static constexpr bool value = true; }; -template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::Fracture> { static constexpr bool value = true; }; - -// permeablility is solution-independent -template<class TypeTag> -struct SolutionDependentAdvection<TypeTag, TTag::Fracture> { static constexpr bool value = false; }; -} // end namespace Properties - /*! * \ingroup TwoPTests * \brief Trichloroethene (DNAPL) transport through a fracture network (2d in 3d). diff --git a/test/porousmediumflow/2p/fracture/properties.hh b/test/porousmediumflow/2p/fracture/properties.hh new file mode 100644 index 0000000000..fd8f7ed07b --- /dev/null +++ b/test/porousmediumflow/2p/fracture/properties.hh @@ -0,0 +1,100 @@ +// -*- 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 TwoPTests + * \brief A discrete fracture network embedded in an impermeable matrix. + * + * The fracture is a 2D network embedded in 3D. + */ +#ifndef DUMUX_TWOP_FRACTURE_TEST_PROPERTIES_HH +#define DUMUX_TWOP_FRACTURE_TEST_PROPERTIES_HH + +#if HAVE_DUNE_FOAMGRID +#include <dune/foamgrid/foamgrid.hh> +#endif + +#include <dumux/material/components/simpleh2o.hh> +#include <dumux/material/components/trichloroethene.hh> +#include <dumux/material/fluidsystems/2pimmiscible.hh> +#include <dumux/material/fluidsystems/1pliquid.hh> + +#include <dumux/porousmediumflow/2p/model.hh> + +#include <dumux/discretization/cctpfa.hh> +#include <dumux/discretization/ccmpfa.hh> +#include <dumux/discretization/box.hh> + +#include "problem.hh" +#include "spatialparams.hh" + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct Fracture { using InheritsFrom = std::tuple<TwoP>; }; +struct FractureBox { using InheritsFrom = std::tuple<Fracture, BoxModel>; }; +struct FractureCCTpfa { using InheritsFrom = std::tuple<Fracture, CCTpfaModel>; }; +struct FractureCCMpfa { using InheritsFrom = std::tuple<Fracture, CCMpfaModel>; }; +} // end namespace TTag + +// set the grid property +#if HAVE_DUNE_FOAMGRID +template<class TypeTag> +struct Grid<TypeTag, TTag::Fracture> { using type = Dune::FoamGrid<2, 3>; }; +#endif + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::Fracture> { using type = Dumux::FractureProblem<TypeTag>; }; + +// Set the fluid system +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::Fracture> +{ + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >; + using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >; + using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>; +}; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::Fracture> +{ + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = FractureSpatialParams<GridGeometry, Scalar>; +}; + +// Use global caching +template<class TypeTag> +struct EnableGridGeometryCache<TypeTag, TTag::Fracture> { static constexpr bool value = true; }; +template<class TypeTag> +struct EnableGridVolumeVariablesCache<TypeTag, TTag::Fracture> { static constexpr bool value = true; }; +template<class TypeTag> +struct EnableGridFluxVariablesCache<TypeTag, TTag::Fracture> { static constexpr bool value = true; }; + +// permeablility is solution-independent +template<class TypeTag> +struct SolutionDependentAdvection<TypeTag, TTag::Fracture> { static constexpr bool value = false; }; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/2p/incompressible/main.cc b/test/porousmediumflow/2p/incompressible/main.cc index 3824474246..19e46cf60a 100644 --- a/test/porousmediumflow/2p/incompressible/main.cc +++ b/test/porousmediumflow/2p/incompressible/main.cc @@ -23,16 +23,11 @@ */ #include <config.h> -#include <ctime> #include <iostream> #include <sstream> #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> @@ -43,50 +38,17 @@ #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> -#include <dumux/assembly/diffmethod.hh> - -#include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/grid/gridmanager.hh> #include <dumux/io/loadsolution.hh> +#include "properties.hh" + #ifndef DIFFMETHOD #define DIFFMETHOD DiffMethod::numeric #endif -/*! - * \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"; - } -} - int main(int argc, char** argv) { using namespace Dumux; @@ -102,7 +64,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/2p/incompressible/problem.hh b/test/porousmediumflow/2p/incompressible/problem.hh index 6ee06cf5b9..ef6228e4b9 100644 --- a/test/porousmediumflow/2p/incompressible/problem.hh +++ b/test/porousmediumflow/2p/incompressible/problem.hh @@ -23,87 +23,13 @@ #ifndef DUMUX_INCOMPRESSIBLE_TWOP_TEST_PROBLEM_HH #define DUMUX_INCOMPRESSIBLE_TWOP_TEST_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/box.hh> -#include <dumux/discretization/cctpfa.hh> -#include <dumux/discretization/ccmpfa.hh> - -#include <dumux/material/components/trichloroethene.hh> -#include <dumux/material/components/simpleh2o.hh> -#include <dumux/material/fluidsystems/1pliquid.hh> -#include <dumux/material/fluidsystems/2pimmiscible.hh> - #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/2p/model.hh> -#include <dumux/porousmediumflow/2p/incompressiblelocalresidual.hh> - -#include "spatialparams.hh" - -#ifndef ENABLEINTERFACESOLVER -#define ENABLEINTERFACESOLVER 0 -#endif namespace Dumux { -// forward declarations -template<class TypeTag> class TwoPTestProblem; - -namespace Properties { -// Create new type tags -namespace TTag { -struct TwoPIncompressible { using InheritsFrom = std::tuple<TwoP>; }; -struct TwoPIncompressibleTpfa { using InheritsFrom = std::tuple<TwoPIncompressible, CCTpfaModel>; }; -struct TwoPIncompressibleMpfa { using InheritsFrom = std::tuple<TwoPIncompressible, CCMpfaModel>; }; -struct TwoPIncompressibleBox { using InheritsFrom = std::tuple<TwoPIncompressible, BoxModel>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::TwoPIncompressible> { using type = Dune::YaspGrid<2>; }; - -// Set the problem type -template<class TypeTag> -struct Problem<TypeTag, TTag::TwoPIncompressible> { using type = TwoPTestProblem<TypeTag>; }; - -// the local residual containing the analytic derivative methods -template<class TypeTag> -struct LocalResidual<TypeTag, TTag::TwoPIncompressible> { using type = TwoPIncompressibleLocalResidual<TypeTag>; }; - -// Set the fluid system -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::TwoPIncompressible> -{ - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >; - using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >; - using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>; -}; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::TwoPIncompressible> -{ -private: - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; -public: - using type = TwoPTestSpatialParams<GridGeometry, Scalar>; -}; - -// Enable caching -template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = false; }; -template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = false; }; -template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = false; }; - -// Maybe enable the box-interface solver -template<class TypeTag> -struct EnableBoxInterfaceSolver<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = ENABLEINTERFACESOLVER; }; -} // end namespace Properties /*! * \ingroup TwoPTests diff --git a/test/porousmediumflow/2p/incompressible/properties.hh b/test/porousmediumflow/2p/incompressible/properties.hh new file mode 100644 index 0000000000..0d7ac95496 --- /dev/null +++ b/test/porousmediumflow/2p/incompressible/properties.hh @@ -0,0 +1,104 @@ +// -*- 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/>. * + *****************************************************************************/ +/*! + * \ingroup TwoPTests + * \brief The properties for the incompressible 2p test. + */ +#ifndef DUMUX_INCOMPRESSIBLE_TWOP_TEST_PROPERTIES_HH +#define DUMUX_INCOMPRESSIBLE_TWOP_TEST_PROPERTIES_HH + +#include <dune/grid/yaspgrid.hh> + +#include <dumux/discretization/box.hh> +#include <dumux/discretization/cctpfa.hh> +#include <dumux/discretization/ccmpfa.hh> + +#include <dumux/material/components/trichloroethene.hh> +#include <dumux/material/components/simpleh2o.hh> +#include <dumux/material/fluidsystems/1pliquid.hh> +#include <dumux/material/fluidsystems/2pimmiscible.hh> + +#include <dumux/porousmediumflow/2p/model.hh> +#include <dumux/porousmediumflow/2p/incompressiblelocalresidual.hh> + +#include "problem.hh" +#include "spatialparams.hh" + +#ifndef ENABLEINTERFACESOLVER +#define ENABLEINTERFACESOLVER 0 +#endif + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct TwoPIncompressible { using InheritsFrom = std::tuple<TwoP>; }; +struct TwoPIncompressibleTpfa { using InheritsFrom = std::tuple<TwoPIncompressible, CCTpfaModel>; }; +struct TwoPIncompressibleMpfa { using InheritsFrom = std::tuple<TwoPIncompressible, CCMpfaModel>; }; +struct TwoPIncompressibleBox { using InheritsFrom = std::tuple<TwoPIncompressible, BoxModel>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::TwoPIncompressible> { using type = Dune::YaspGrid<2>; }; + +// Set the problem type +template<class TypeTag> +struct Problem<TypeTag, TTag::TwoPIncompressible> { using type = TwoPTestProblem<TypeTag>; }; + +// the local residual containing the analytic derivative methods +template<class TypeTag> +struct LocalResidual<TypeTag, TTag::TwoPIncompressible> { using type = TwoPIncompressibleLocalResidual<TypeTag>; }; + +// Set the fluid system +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::TwoPIncompressible> +{ + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >; + using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >; + using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>; +}; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::TwoPIncompressible> +{ +private: + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; +public: + using type = TwoPTestSpatialParams<GridGeometry, Scalar>; +}; + +// Enable caching +template<class TypeTag> +struct EnableGridVolumeVariablesCache<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = false; }; +template<class TypeTag> +struct EnableGridFluxVariablesCache<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = false; }; +template<class TypeTag> +struct EnableGridGeometryCache<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = false; }; + +// Maybe enable the box-interface solver +template<class TypeTag> +struct EnableBoxInterfaceSolver<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = ENABLEINTERFACESOLVER; }; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/2p/nonisothermal/main.cc b/test/porousmediumflow/2p/nonisothermal/main.cc index 3ea0c65e18..16f49b8bb5 100644 --- a/test/porousmediumflow/2p/nonisothermal/main.cc +++ b/test/porousmediumflow/2p/nonisothermal/main.cc @@ -23,13 +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/vtksequencewriter.hh> -#include <dune/istl/io.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> @@ -43,33 +40,7 @@ #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/grid/gridmanager.hh> -#include "problem.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.Cells Number of cells in respective coordinate directions\n" - "\t-Grid.UpperRight Upper right corner coordinates\n"; - - std::cout << errorMessageOut - << "\n"; - } -} +#include "properties.hh" //////////////////////// // the main function @@ -89,7 +60,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/2p/nonisothermal/problem.hh b/test/porousmediumflow/2p/nonisothermal/problem.hh index 60aafefa56..1e81ef0129 100644 --- a/test/porousmediumflow/2p/nonisothermal/problem.hh +++ b/test/porousmediumflow/2p/nonisothermal/problem.hh @@ -28,69 +28,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/common/parameters.hh> #include <dumux/common/boundarytypes.hh> -#include <dumux/porousmediumflow/2p/model.hh> #include <dumux/porousmediumflow/problem.hh> -#include <dumux/discretization/box.hh> -#include <dumux/discretization/cctpfa.hh> - -#include <dumux/material/fluidsystems/h2on2.hh> -#include <dumux/material/components/n2.hh> - -// use the spatial parameters as the injection problem of the 2p2c test program -#include <test/porousmediumflow/2p2c/injection/spatialparams.hh> - -#ifndef GRIDTYPE // default to yasp grid if not provided by CMake -#define GRIDTYPE Dune::YaspGrid<2> -#endif - namespace Dumux { -//! Forward declaration of the problem class -template <class TypeTag> class InjectionProblem2PNI; - -namespace Properties { -// Create new type tags -namespace TTag { -struct Injection2PNITypeTag { using InheritsFrom = std::tuple<TwoPNI>; }; -struct InjectionBox2PNITypeTag { using InheritsFrom = std::tuple<Injection2PNITypeTag, BoxModel>; }; -struct InjectionCC2PNITypeTag { using InheritsFrom = std::tuple<Injection2PNITypeTag, CCTpfaModel>; }; -} // end namespace TTag - -// Obtain grid type from COMPILE_DEFINITIONS -template<class TypeTag> -struct Grid<TypeTag, TTag::Injection2PNITypeTag> { using type = GRIDTYPE; }; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::Injection2PNITypeTag> { using type = InjectionProblem2PNI<TypeTag>; }; - -// Use the same fluid system as the 2p2c injection problem -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::Injection2PNITypeTag> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::Injection2PNITypeTag> -{ - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = InjectionSpatialParams<GridGeometry, Scalar>; -}; - -} // namespace Properties - /*! * \ingroup TwoPTests * \brief Non-isothermal gas injection problem where a gas (e.g. air) is injected into a fully diff --git a/test/porousmediumflow/2p/nonisothermal/properties.hh b/test/porousmediumflow/2p/nonisothermal/properties.hh new file mode 100644 index 0000000000..f308f42870 --- /dev/null +++ b/test/porousmediumflow/2p/nonisothermal/properties.hh @@ -0,0 +1,90 @@ +// -*- 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 TwoPTests + * \brief Non-isothermal gas injection problem where a gas (e.g. air) is injected into a fully + * water saturated medium. + * + * During buoyancy driven upward migration the gas passes a high temperature area. + */ + +#ifndef DUMUX_INJECTION_PROPERTIES_2PNI_HH +#define DUMUX_INJECTION_PROPERTIES_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/discretization/box.hh> +#include <dumux/discretization/cctpfa.hh> + +#include <dumux/material/fluidsystems/h2on2.hh> +#include <dumux/material/components/n2.hh> + +// use the spatial parameters as the injection problem of the 2p2c test program +#include "problem.hh" +#include <test/porousmediumflow/2p2c/injection/spatialparams.hh> + +#ifndef GRIDTYPE // default to yasp grid if not provided by CMake +#define GRIDTYPE Dune::YaspGrid<2> +#endif + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct Injection2PNITypeTag { using InheritsFrom = std::tuple<TwoPNI>; }; +struct InjectionBox2PNITypeTag { using InheritsFrom = std::tuple<Injection2PNITypeTag, BoxModel>; }; +struct InjectionCC2PNITypeTag { using InheritsFrom = std::tuple<Injection2PNITypeTag, CCTpfaModel>; }; +} // end namespace TTag + +// Obtain grid type from COMPILE_DEFINITIONS +template<class TypeTag> +struct Grid<TypeTag, TTag::Injection2PNITypeTag> { using type = GRIDTYPE; }; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::Injection2PNITypeTag> { using type = InjectionProblem2PNI<TypeTag>; }; + +// Use the same fluid system as the 2p2c injection problem +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::Injection2PNITypeTag> +{ using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::Injection2PNITypeTag> +{ + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = InjectionSpatialParams<GridGeometry, Scalar>; +}; + +} // namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/tracer/2ptracer/main.cc b/test/porousmediumflow/tracer/2ptracer/main.cc index 66625cb9ae..0c46226265 100644 --- a/test/porousmediumflow/tracer/2ptracer/main.cc +++ b/test/porousmediumflow/tracer/2ptracer/main.cc @@ -30,9 +30,6 @@ #include <dune/common/timer.hh> #include <dune/grid/io/file/vtk.hh> -#include <test/porousmediumflow/2p/incompressible/problem.hh> -#include "properties_tracer.hh" - #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> #include <dumux/common/dumuxmessage.hh> @@ -50,6 +47,8 @@ #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/grid/gridmanager.hh> +#include "properties.hh" + int main(int argc, char** argv) { using namespace Dumux; diff --git a/test/porousmediumflow/tracer/2ptracer/problem_tracer.hh b/test/porousmediumflow/tracer/2ptracer/problem.hh similarity index 100% rename from test/porousmediumflow/tracer/2ptracer/problem_tracer.hh rename to test/porousmediumflow/tracer/2ptracer/problem.hh diff --git a/test/porousmediumflow/tracer/2ptracer/properties_tracer.hh b/test/porousmediumflow/tracer/2ptracer/properties.hh similarity index 97% rename from test/porousmediumflow/tracer/2ptracer/properties_tracer.hh rename to test/porousmediumflow/tracer/2ptracer/properties.hh index f248cd3db7..e0a3338900 100644 --- a/test/porousmediumflow/tracer/2ptracer/properties_tracer.hh +++ b/test/porousmediumflow/tracer/2ptracer/properties.hh @@ -30,11 +30,13 @@ #include <dumux/porousmediumflow/tracer/model.hh> #include <dumux/material/fluidsystems/base.hh> -#include "spatialparams_tracer.hh" +#include <test/porousmediumflow/2p/incompressible/properties.hh> -#include "problem_tracer.hh" +#include "spatialparams.hh" +#include "problem.hh" namespace Dumux::Properties { + //Create new type tags namespace TTag { struct TwoPTracerTest { using InheritsFrom = std::tuple<Tracer>; }; diff --git a/test/porousmediumflow/tracer/2ptracer/spatialparams_tracer.hh b/test/porousmediumflow/tracer/2ptracer/spatialparams.hh similarity index 100% rename from test/porousmediumflow/tracer/2ptracer/spatialparams_tracer.hh rename to test/porousmediumflow/tracer/2ptracer/spatialparams.hh -- GitLab