diff --git a/test/porousmediumflow/tracer/2ptracer/main.cc b/test/porousmediumflow/tracer/2ptracer/main.cc index fdc17277fceca7da1fc0ef68c6383021267e22c9..66625cb9ae8496f6e0f2974ce6c048efbc1caab0 100644 --- a/test/porousmediumflow/tracer/2ptracer/main.cc +++ b/test/porousmediumflow/tracer/2ptracer/main.cc @@ -5,7 +5,7 @@ * * * 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 2 of the License, or * + * 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, * @@ -31,7 +31,7 @@ #include <dune/grid/io/file/vtk.hh> #include <test/porousmediumflow/2p/incompressible/problem.hh> -#include "problem_tracer.hh" +#include "properties_tracer.hh" #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> diff --git a/test/porousmediumflow/tracer/2ptracer/problem_tracer.hh b/test/porousmediumflow/tracer/2ptracer/problem_tracer.hh index 75d5e9215c266d1201a0231e494f785fa048617a..4d059a4828986f8044cb94712a96f4db475b16f4 100644 --- a/test/porousmediumflow/tracer/2ptracer/problem_tracer.hh +++ b/test/porousmediumflow/tracer/2ptracer/problem_tracer.hh @@ -24,100 +24,11 @@ #ifndef DUMUX_TWOP_TRACER_TEST_PROBLEM_HH #define DUMUX_TWOP_TRACER_TEST_PROBLEM_HH -#include <dune/grid/yaspgrid.hh> - #include <dumux/common/boundarytypes.hh> -#include <dumux/discretization/cctpfa.hh> -#include <dumux/porousmediumflow/tracer/model.hh> #include <dumux/porousmediumflow/problem.hh> -#include <dumux/material/fluidsystems/base.hh> - -#include "spatialparams_tracer.hh" namespace Dumux { -/*! - * \ingroup TracerTests - * \brief A 2p problem with multiple tracer bands in a porous groundwater reservoir with a lens - */ -template <class TypeTag> -class TwoPTracerTestProblem; - -namespace Properties { -//Create new type tags -namespace TTag { -struct TwoPTracerTest { using InheritsFrom = std::tuple<Tracer>; }; -struct TwoPTracerTestTpfa { using InheritsFrom = std::tuple<TwoPTracerTest, CCTpfaModel>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::TwoPTracerTest> { using type = Dune::YaspGrid<2>; }; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::TwoPTracerTest> { using type = TwoPTracerTestProblem<TypeTag>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::TwoPTracerTest> -{ - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = TwoPTracerTestSpatialParams<GridGeometry, Scalar>; -}; - -// Define whether mole(true) or mass (false) fractions are used -template<class TypeTag> -struct UseMoles<TypeTag, TTag::TwoPTracerTest> { static constexpr bool value = false; }; -template<class TypeTag> -struct SolutionDependentMolecularDiffusion<TypeTag, TTag::TwoPTracerTestTpfa> { static constexpr bool value = false; }; - -//! A simple fluid system with one tracer component -template<class TypeTag> -class TracerFluidSystem : public FluidSystems::Base<GetPropType<TypeTag, Properties::Scalar>, - TracerFluidSystem<TypeTag>> -{ - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using Problem = GetPropType<TypeTag, Properties::Problem>; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; - using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; - using SubControlVolume = typename FVElementGeometry::SubControlVolume; - -public: - //! If the fluid system only contains tracer components - static constexpr bool isTracerFluidSystem() - { return true; } - - //! The number of components - static constexpr int numComponents = 1; - - //! Human readable component name (index compIdx) (for vtk output) - static std::string componentName(int compIdx) - { return "tracer_" + std::to_string(compIdx); } - - //! Molar mass in kg/mol of the component with index compIdx - static Scalar molarMass(unsigned int compIdx) - { return 0.300; } - - //! Binary diffusion coefficient - //! (might depend on spatial parameters like pressure / temperature) - static Scalar binaryDiffusionCoefficient(unsigned int compIdx, - const Problem& problem, - const Element& element, - const SubControlVolume& scv) - { - static const Scalar D = getParam<Scalar>("Problem.BinaryDiffusionCoefficient"); - return D; - } -}; - -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::TwoPTracerTest> { using type = TracerFluidSystem<TypeTag>; }; - -} // end namespace Properties - /*! * \ingroup TracerTests * diff --git a/test/porousmediumflow/tracer/2ptracer/properties_tracer.hh b/test/porousmediumflow/tracer/2ptracer/properties_tracer.hh new file mode 100644 index 0000000000000000000000000000000000000000..f248cd3db7c702f098749b53105b1b97450c3e51 --- /dev/null +++ b/test/porousmediumflow/tracer/2ptracer/properties_tracer.hh @@ -0,0 +1,112 @@ +// -*- 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 TracerTests + * \brief The properties of the 2p problem with multiple tracer bands in a porous groundwater reservoir with a lens + */ +#ifndef DUMUX_2P_TRACER_TEST_PROPERTIES_HH +#define DUMUX_2P_TRACER_TEST_PROPERTIES_HH + +#include <dune/grid/yaspgrid.hh> + +#include <dumux/discretization/cctpfa.hh> +#include <dumux/porousmediumflow/tracer/model.hh> +#include <dumux/material/fluidsystems/base.hh> + +#include "spatialparams_tracer.hh" + +#include "problem_tracer.hh" + +namespace Dumux::Properties { +//Create new type tags +namespace TTag { +struct TwoPTracerTest { using InheritsFrom = std::tuple<Tracer>; }; +struct TwoPTracerTestTpfa { using InheritsFrom = std::tuple<TwoPTracerTest, CCTpfaModel>; }; +} // end namespace TTag + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::TwoPTracerTest> { using type = Dune::YaspGrid<2>; }; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::TwoPTracerTest> { using type = TwoPTracerTestProblem<TypeTag>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::TwoPTracerTest> +{ + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = TwoPTracerTestSpatialParams<GridGeometry, Scalar>; +}; + +// Define whether mole(true) or mass (false) fractions are used +template<class TypeTag> +struct UseMoles<TypeTag, TTag::TwoPTracerTest> { static constexpr bool value = false; }; +template<class TypeTag> +struct SolutionDependentMolecularDiffusion<TypeTag, TTag::TwoPTracerTestTpfa> { static constexpr bool value = false; }; + +//! A simple fluid system with one tracer component +template<class TypeTag> +class TracerFluidSystem : public FluidSystems::Base<GetPropType<TypeTag, Properties::Scalar>, + TracerFluidSystem<TypeTag>> +{ + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using Problem = GetPropType<TypeTag, Properties::Problem>; + using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; + using Element = typename GridView::template Codim<0>::Entity; + using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + +public: + //! If the fluid system only contains tracer components + static constexpr bool isTracerFluidSystem() + { return true; } + + //! The number of components + static constexpr int numComponents = 1; + + //! Human readable component name (index compIdx) (for vtk output) + static std::string componentName(int compIdx) + { return "tracer_" + std::to_string(compIdx); } + + //! Molar mass in kg/mol of the component with index compIdx + static Scalar molarMass(unsigned int compIdx) + { return 0.300; } + + //! Binary diffusion coefficient + //! (might depend on spatial parameters like pressure / temperature) + static Scalar binaryDiffusionCoefficient(unsigned int compIdx, + const Problem& problem, + const Element& element, + const SubControlVolume& scv) + { + static const Scalar D = getParam<Scalar>("Problem.BinaryDiffusionCoefficient"); + return D; + } +}; + +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::TwoPTracerTest> { using type = TracerFluidSystem<TypeTag>; }; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/tracer/2ptracer/spatialparams_tracer.hh b/test/porousmediumflow/tracer/2ptracer/spatialparams_tracer.hh index c4a8695833e238e2047a5ed76ce733c862df582e..356d7b577f841b79cb9dd8c65e83e4e058deed75 100644 --- a/test/porousmediumflow/tracer/2ptracer/spatialparams_tracer.hh +++ b/test/porousmediumflow/tracer/2ptracer/spatialparams_tracer.hh @@ -5,7 +5,7 @@ * * * 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 2 of the License, or * + * 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, * diff --git a/test/porousmediumflow/tracer/constvel/main.cc b/test/porousmediumflow/tracer/constvel/main.cc index ce969bab15b1d42aad0bffc13780234464402836..39f605be34b5dacca1535a894b5566eded3a4501 100644 --- a/test/porousmediumflow/tracer/constvel/main.cc +++ b/test/porousmediumflow/tracer/constvel/main.cc @@ -41,7 +41,7 @@ #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/grid/gridmanager.hh> -#include "problem.hh" +#include "properties.hh" int main(int argc, char** argv) { diff --git a/test/porousmediumflow/tracer/constvel/problem.hh b/test/porousmediumflow/tracer/constvel/problem.hh index 3e52531d857e36be235c3d4f4adfada2b40a6d01..33a0b42e6938ee2bdf6091593f64ce84cf422122 100644 --- a/test/porousmediumflow/tracer/constvel/problem.hh +++ b/test/porousmediumflow/tracer/constvel/problem.hh @@ -26,135 +26,13 @@ #ifndef DUMUX_TRACER_TEST_PROBLEM_HH #define DUMUX_TRACER_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/porousmediumflow/tracer/model.hh> #include <dumux/porousmediumflow/problem.hh> -#include <dumux/material/fluidsystems/base.hh> - -#include "spatialparams.hh" - -#ifndef USEMOLES // default to true if not set through CMake -#define USEMOLES true -#endif namespace Dumux { -/** - * \ingroup TracerTests - * \brief Definition of a problem for the tracer problem: - * A rotating velocity field mixes a tracer band in a porous groundwater reservoir. - */ -template <class TypeTag> -class TracerTest; - -namespace Properties { -// Create new type tags -namespace TTag { -struct TracerTest { using InheritsFrom = std::tuple<Tracer>; }; -struct TracerTestTpfa { using InheritsFrom = std::tuple<TracerTest, CCTpfaModel>; }; -struct TracerTestMpfa { using InheritsFrom = std::tuple<TracerTest, CCMpfaModel>; }; -struct TracerTestBox { using InheritsFrom = std::tuple<TracerTest, BoxModel>; }; -} // end namespace TTag - -// enable caching -template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; }; -template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; }; -template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; }; - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::TracerTest> { using type = Dune::YaspGrid<2>; }; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::TracerTest> { using type = TracerTest<TypeTag>; }; - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::TracerTest> -{ - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = TracerTestSpatialParams<GridGeometry, Scalar>; -}; - -// Define whether mole(true) or mass (false) fractions are used -template<class TypeTag> -struct UseMoles<TypeTag, TTag::TracerTest> { static constexpr bool value = USEMOLES; }; - -//! A simple fluid system with one tracer component -template<class TypeTag> -class TracerFluidSystem : public FluidSystems::Base<GetPropType<TypeTag, Properties::Scalar>, - TracerFluidSystem<TypeTag>> -{ - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using Problem = GetPropType<TypeTag, Properties::Problem>; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; - using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; - using SubControlVolume = typename FVElementGeometry::SubControlVolume; - -public: - static constexpr bool isTracerFluidSystem() - { return true; } - - //! The number of components - static constexpr int numComponents = 2; - static constexpr int numPhases = 1; - - //! Human readable component name (index compIdx) (for vtk output) - static std::string componentName(int compIdx) - { return "tracer_" + std::to_string(compIdx); } - - //! Human readable phase name (index phaseIdx) (for velocity vtk output) - static std::string phaseName(int phaseIdx = 0) - { return "Groundwater"; } - - //! Molar mass in kg/mol of the component with index compIdx - static Scalar molarMass(unsigned int compIdx) - { return 0.300; } - - //! Binary diffusion coefficient - //! (might depend on spatial parameters like pressure / temperature) - static Scalar binaryDiffusionCoefficient(unsigned int compIdx, - const Problem& problem, - const Element& element, - const SubControlVolume& scv) - { - static const Scalar D = getParam<Scalar>("Problem.D"); - static const Scalar D2 = getParam<Scalar>("Problem.D2"); - if (compIdx == 0) - return D; - else - return D2; - } - - /*! - * \copydoc Dumux::FluidSystems::Base::isCompressible - */ - static constexpr bool isCompressible(int phaseIdx) - { return false; } - - /*! - * \copydoc Dumux::FluidSystems::Base::viscosityIsConstant - */ - static constexpr bool viscosityIsConstant(int phaseIdx) - { return true; } -}; - -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::TracerTest> { using type = TracerFluidSystem<TypeTag>; }; - -} // end namespace Properties - /*! * \ingroup TracerTests diff --git a/test/porousmediumflow/tracer/constvel/properties.hh b/test/porousmediumflow/tracer/constvel/properties.hh new file mode 100644 index 0000000000000000000000000000000000000000..c8b600e42326c2f5cfbc52d38fa46384fb92bbd6 --- /dev/null +++ b/test/porousmediumflow/tracer/constvel/properties.hh @@ -0,0 +1,147 @@ +// -*- 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 TracerTests + * \brief The properties for the tracer problem: + * A rotating velocity field mixes a tracer band in a porous groundwater reservoir. + */ +#ifndef DUMUX_TRACER_TEST_PROPERTIES_HH +#define DUMUX_TRACER_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/porousmediumflow/tracer/model.hh> +#include <dumux/material/fluidsystems/base.hh> + +#include "spatialparams.hh" + +#ifndef USEMOLES // default to true if not set through CMake +#define USEMOLES true +#endif + +#include "problem.hh" + +namespace Dumux::Properties { +// Create new type tags +namespace TTag { +struct TracerTest { using InheritsFrom = std::tuple<Tracer>; }; +struct TracerTestTpfa { using InheritsFrom = std::tuple<TracerTest, CCTpfaModel>; }; +struct TracerTestMpfa { using InheritsFrom = std::tuple<TracerTest, CCMpfaModel>; }; +struct TracerTestBox { using InheritsFrom = std::tuple<TracerTest, BoxModel>; }; +} // end namespace TTag + +// enable caching +template<class TypeTag> +struct EnableGridVolumeVariablesCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; }; +template<class TypeTag> +struct EnableGridFluxVariablesCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; }; +template<class TypeTag> +struct EnableGridGeometryCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; }; + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::TracerTest> { using type = Dune::YaspGrid<2>; }; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::TracerTest> { using type = TracerTest<TypeTag>; }; + +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::TracerTest> +{ + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = TracerTestSpatialParams<GridGeometry, Scalar>; +}; + +// Define whether mole(true) or mass (false) fractions are used +template<class TypeTag> +struct UseMoles<TypeTag, TTag::TracerTest> { static constexpr bool value = USEMOLES; }; + +//! A simple fluid system with one tracer component +template<class TypeTag> +class TracerFluidSystem : public FluidSystems::Base<GetPropType<TypeTag, Properties::Scalar>, + TracerFluidSystem<TypeTag>> +{ + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using Problem = GetPropType<TypeTag, Properties::Problem>; + using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; + using Element = typename GridView::template Codim<0>::Entity; + using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + +public: + static constexpr bool isTracerFluidSystem() + { return true; } + + //! The number of components + static constexpr int numComponents = 2; + static constexpr int numPhases = 1; + + //! Human readable component name (index compIdx) (for vtk output) + static std::string componentName(int compIdx) + { return "tracer_" + std::to_string(compIdx); } + + //! Human readable phase name (index phaseIdx) (for velocity vtk output) + static std::string phaseName(int phaseIdx = 0) + { return "Groundwater"; } + + //! Molar mass in kg/mol of the component with index compIdx + static Scalar molarMass(unsigned int compIdx) + { return 0.300; } + + //! Binary diffusion coefficient + //! (might depend on spatial parameters like pressure / temperature) + static Scalar binaryDiffusionCoefficient(unsigned int compIdx, + const Problem& problem, + const Element& element, + const SubControlVolume& scv) + { + static const Scalar D = getParam<Scalar>("Problem.D"); + static const Scalar D2 = getParam<Scalar>("Problem.D2"); + if (compIdx == 0) + return D; + else + return D2; + } + + /*! + * \copydoc Dumux::FluidSystems::Base::isCompressible + */ + static constexpr bool isCompressible(int phaseIdx) + { return false; } + + /*! + * \copydoc Dumux::FluidSystems::Base::viscosityIsConstant + */ + static constexpr bool viscosityIsConstant(int phaseIdx) + { return true; } +}; + +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::TracerTest> { using type = TracerFluidSystem<TypeTag>; }; + +} // end namespace Dumux::Properties + +#endif diff --git a/test/porousmediumflow/tracer/multiphase/problem.hh b/test/porousmediumflow/tracer/multiphase/problem.hh index 530a345702c796c85a61626819f656c875730503..3bcd57a40f2262e11b3656815a698381cf9843a4 100644 --- a/test/porousmediumflow/tracer/multiphase/problem.hh +++ b/test/porousmediumflow/tracer/multiphase/problem.hh @@ -26,6 +26,9 @@ #ifndef DUMUX_TRACER_MULTIPHASE_TEST_PROBLEM_HH #define DUMUX_TRACER_MULTIPHASE_TEST_PROBLEM_HH +#include <dumux/common/properties.hh> +#include <dumux/common/parameters.hh> + #include <dumux/common/boundarytypes.hh> #include <dumux/porousmediumflow/problem.hh>