3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/tracer/constvel/problem.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
26#ifndef DUMUX_TRACER_TEST_PROBLEM_HH
27#define DUMUX_TRACER_TEST_PROBLEM_HH
28
29#include <dune/grid/yaspgrid.hh>
30
37
38#include "spatialparams.hh"
39
40#ifndef USEMOLES // default to true if not set through CMake
41#define USEMOLES true
42#endif
43
44namespace Dumux {
50template <class TypeTag>
51class TracerTest;
52
53namespace Properties {
54// Create new type tags
55namespace TTag {
56struct TracerTest { using InheritsFrom = std::tuple<Tracer>; };
57struct TracerTestTpfa { using InheritsFrom = std::tuple<TracerTest, CCTpfaModel>; };
58struct TracerTestMpfa { using InheritsFrom = std::tuple<TracerTest, CCMpfaModel>; };
59struct TracerTestBox { using InheritsFrom = std::tuple<TracerTest, BoxModel>; };
60} // end namespace TTag
61
62// enable caching
63template<class TypeTag>
64struct EnableGridVolumeVariablesCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; };
65template<class TypeTag>
66struct EnableGridFluxVariablesCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; };
67template<class TypeTag>
68struct EnableGridGeometryCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; };
69
70// Set the grid type
71template<class TypeTag>
72struct Grid<TypeTag, TTag::TracerTest> { using type = Dune::YaspGrid<2>; };
73
74// Set the problem property
75template<class TypeTag>
76struct Problem<TypeTag, TTag::TracerTest> { using type = TracerTest<TypeTag>; };
77
78// Set the spatial parameters
79template<class TypeTag>
80struct SpatialParams<TypeTag, TTag::TracerTest>
81{
85};
86
87// Define whether mole(true) or mass (false) fractions are used
88template<class TypeTag>
89struct UseMoles<TypeTag, TTag::TracerTest> { static constexpr bool value = USEMOLES; };
90
92template<class TypeTag>
93class TracerFluidSystem : public FluidSystems::Base<GetPropType<TypeTag, Properties::Scalar>,
94 TracerFluidSystem<TypeTag>>
95{
99 using Element = typename GridView::template Codim<0>::Entity;
100 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
101 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
102
103public:
104 static constexpr bool isTracerFluidSystem()
105 { return true; }
106
108 static constexpr int getMainComponent(int phaseIdx)
109 { return -1; }
110
112 static constexpr int numComponents = 2;
113 static constexpr int numPhases = 1;
114
116 static std::string componentName(int compIdx)
117 { return "tracer_" + std::to_string(compIdx); }
118
120 static std::string phaseName(int phaseIdx = 0)
121 { return "Groundwater"; }
122
124 static Scalar molarMass(unsigned int compIdx)
125 { return 0.300; }
126
129 static Scalar binaryDiffusionCoefficient(unsigned int compIdx,
130 const Problem& problem,
131 const Element& element,
132 const SubControlVolume& scv)
133 {
134 static const Scalar D = getParam<Scalar>("Problem.D");
135 static const Scalar D2 = getParam<Scalar>("Problem.D2");
136 if (compIdx == 0)
137 return D;
138 else
139 return D2;
140 }
141
145 static constexpr bool isCompressible(int phaseIdx)
146 { return false; }
147
151 static constexpr bool viscosityIsConstant(int phaseIdx)
152 { return true; }
153};
154
155template<class TypeTag>
156struct FluidSystem<TypeTag, TTag::TracerTest> { using type = TracerFluidSystem<TypeTag>; };
157
158} // end namespace Properties
159
160
173template <class TypeTag>
174class TracerTest : public PorousMediumFlowProblem<TypeTag>
175{
177
186
188 static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>();
189 using Element = typename GridGeometry::GridView::template Codim<0>::Entity;
190 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
191
192public:
193 TracerTest(std::shared_ptr<const GridGeometry> gridGeometry)
195 {
196 // stating in the console whether mole or mass fractions are used
197 if(useMoles)
198 std::cout<<"problem uses mole fractions" << '\n';
199 else
200 std::cout<<"problem uses mass fractions" << '\n';
201 }
202
206 // \{
207
214 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
215 {
216 BoundaryTypes values;
217 values.setAllNeumann(); // no-flow
218 return values;
219 }
220 // \}
221
225 // \{
226
235 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
236 {
237 PrimaryVariables initialValues(0.0);
238 if (globalPos[1] > 0.4 - eps_ && globalPos[1] < 0.6 + eps_)
239 {
240 if (useMoles)
241 initialValues = 1e-9;
242 else
243 initialValues = 1e-9*FluidSystem::molarMass(0)/this->spatialParams().fluidMolarMass(globalPos);
244 }
245 return initialValues; }
246
247 // \}
248
249private:
250 static constexpr Scalar eps_ = 1e-6;
251};
252
253} // end namespace Dumux
254
255#endif
Defines a type tag and some properties for models using the box scheme.
Properties for all models using cell-centered finite volume scheme with mpfa.
Properties for all models using cell-centered finite volume scheme with TPFA.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
The DUNE grid type.
Definition: common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
Property whether to use moles or kg as amount unit for balance equations.
Definition: common/properties.hh:102
If disabled, the volume variables are not stored (reduces memory, but is slower)
Definition: common/properties.hh:178
The type of the spatial parameters object.
Definition: common/properties.hh:221
The type of the fluid system to use.
Definition: common/properties.hh:223
Fluid system base class.
Definition: fluidsystems/base.hh:45
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/problem.hh:146
GetPropType< TypeTag, Properties::SpatialParams > SpatialParams
Export spatial parameter type.
Definition: dumux/porousmediumflow/problem.hh:58
A simple fluid system with one tracer component.
Definition: tracerfluidsystem.hh:37
Definition of a problem, for the tracer problem: A rotating velocity field mixes a tracer band in a p...
Definition: 1ptracer/problem_tracer.hh:150
Definition: 1ptracer/problem_tracer.hh:50
std::tuple< Tracer > InheritsFrom
Definition: 1ptracer/problem_tracer.hh:50
Dune::YaspGrid< 2 > type
Definition: 1ptracer/problem_tracer.hh:64
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: 1ptracer/problem_tracer.hh:74
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: 1ptracer/problem_tracer.hh:75
A simple fluid system with one tracer component.
Definition: 1ptracer/problem_tracer.hh:89
static constexpr bool viscosityIsConstant(int phaseIdx)
Returns true if and only if a fluid phase is assumed to have a constant viscosity.
Definition: test/porousmediumflow/tracer/constvel/problem.hh:151
static constexpr int numComponents
The number of components.
Definition: 1ptracer/problem_tracer.hh:107
static Scalar binaryDiffusionCoefficient(unsigned int compIdx, const Problem &problem, const Element &element, const SubControlVolume &scv)
Definition: test/porousmediumflow/tracer/constvel/problem.hh:129
static std::string componentName(int compIdx)
Human readable component name (index compIdx) (for vtk output)
Definition: test/porousmediumflow/tracer/constvel/problem.hh:116
static std::string phaseName(int phaseIdx=0)
Human readable phase name (index phaseIdx) (for velocity vtk output)
Definition: test/porousmediumflow/tracer/constvel/problem.hh:120
static constexpr bool isTracerFluidSystem()
Definition: test/porousmediumflow/tracer/constvel/problem.hh:104
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: test/porousmediumflow/tracer/constvel/problem.hh:145
static constexpr int numPhases
Definition: test/porousmediumflow/tracer/constvel/problem.hh:113
static Scalar molarMass(unsigned int compIdx)
Molar mass in kg/mol of the component with index compIdx.
Definition: test/porousmediumflow/tracer/constvel/problem.hh:124
static constexpr int getMainComponent(int phaseIdx)
None of the components are the main component of the phase.
Definition: test/porousmediumflow/tracer/constvel/problem.hh:108
Definition of the spatial parameters for the tracer problem.
Definition: porousmediumflow/tracer/1ptracer/spatialparams_tracer.hh:41
Definition of a problem for the tracer problem: A rotating velocity field mixes a tracer band in a po...
Definition: test/porousmediumflow/tracer/constvel/problem.hh:175
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: test/porousmediumflow/tracer/constvel/problem.hh:214
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/porousmediumflow/tracer/constvel/problem.hh:235
TracerTest(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/tracer/constvel/problem.hh:193
Definition: test/porousmediumflow/tracer/constvel/problem.hh:57
std::tuple< TracerTest, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/tracer/constvel/problem.hh:57
Definition: test/porousmediumflow/tracer/constvel/problem.hh:58
std::tuple< TracerTest, CCMpfaModel > InheritsFrom
Definition: test/porousmediumflow/tracer/constvel/problem.hh:58
Definition: test/porousmediumflow/tracer/constvel/problem.hh:59
std::tuple< TracerTest, BoxModel > InheritsFrom
Definition: test/porousmediumflow/tracer/constvel/problem.hh:59
Adaption of the fully implicit scheme to the tracer transport model.
Base class for all porous media problems.
#define USEMOLES
Definition: test/porousmediumflow/tracer/constvel/problem.hh:41
Fluid system base class.
Definition of the spatial parameters for the MaxwellStefan problem.