3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
1ptracer/problem_tracer.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
35
37
38namespace Dumux {
44template <class TypeTag>
45class TracerTestProblem;
46
47namespace Properties {
48// Create new type tags
49namespace TTag {
50struct TracerTest { using InheritsFrom = std::tuple<Tracer>; };
51struct TracerTestCC { using InheritsFrom = std::tuple<TracerTest, CCTpfaModel>; };
52} // end namespace TTag
53
54// enable caching
55template<class TypeTag>
56struct EnableGridVolumeVariablesCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; };
57template<class TypeTag>
58struct EnableGridFluxVariablesCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; };
59template<class TypeTag>
60struct EnableGridGeometryCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; };
61
62// Set the grid type
63template<class TypeTag>
64struct Grid<TypeTag, TTag::TracerTest> { using type = Dune::YaspGrid<2>; };
65
66// Set the problem property
67template<class TypeTag>
68struct Problem<TypeTag, TTag::TracerTest> { using type = TracerTestProblem<TypeTag>; };
69
70// Set the spatial parameters
71template<class TypeTag>
72struct SpatialParams<TypeTag, TTag::TracerTest>
73{
77};
78
79// Define whether mole(true) or mass (false) fractions are used
80template<class TypeTag>
81struct UseMoles<TypeTag, TTag::TracerTest> { static constexpr bool value = false; };
82template<class TypeTag>
83struct SolutionDependentMolecularDiffusion<TypeTag, TTag::TracerTestCC> { static constexpr bool value = false; };
84
86template<class TypeTag>
87class TracerFluidSystem : public FluidSystems::Base<GetPropType<TypeTag, Properties::Scalar>,
88 TracerFluidSystem<TypeTag>>
89{
93 using Element = typename GridView::template Codim<0>::Entity;
94 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
95 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
96
97public:
99 static constexpr bool isTracerFluidSystem()
100 { return true; }
101
103 static constexpr int getMainComponent(int phaseIdx)
104 { return -1; }
105
107 static constexpr int numComponents = 1;
108
110 static std::string componentName(int compIdx)
111 { return "tracer_" + std::to_string(compIdx); }
112
114 static std::string phaseName(int phaseIdx = 0)
115 { return "Groundwater"; }
116
118 static Scalar molarMass(unsigned int compIdx)
119 { return 0.300; }
120
123 static Scalar binaryDiffusionCoefficient(unsigned int compIdx,
124 const Problem& problem,
125 const Element& element,
126 const SubControlVolume& scv)
127 { return 0.0; }
128};
129
130template<class TypeTag>
131struct FluidSystem<TypeTag, TTag::TracerTest> { using type = TracerFluidSystem<TypeTag>; };
132
133} // end namespace Properties
134
135
148template <class TypeTag>
150{
152
161
163 static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>();
164
165 using Element = typename GridGeometry::GridView::template Codim<0>::Entity;
166 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
167
168public:
169 TracerTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
171 {
172 // stating in the console whether mole or mass fractions are used
173 if(useMoles)
174 std::cout<<"problem uses mole fractions" << '\n';
175 else
176 std::cout<<"problem uses mass fractions" << '\n';
177 }
178
182 // \{
183
190 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
191 {
192 BoundaryTypes values;
193 values.setAllNeumann();
194 return values;
195 }
196 // \}
197
201 // \{
202
211 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
212 {
213 PrimaryVariables initialValues(0.0);
214 if (globalPos[1] < 0.1 + eps_)
215 {
216 if (useMoles)
217 initialValues = 1e-9;
218 else
219 initialValues = 1e-9*FluidSystem::molarMass(0)/this->spatialParams().fluidMolarMass(globalPos);
220 }
221 return initialValues; }
222
223 // \}
224
225private:
226 static constexpr Scalar eps_ = 1e-6;
227};
228
229} // end namespace Dumux
230
231#endif
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
Definition: common/properties.hh:169
If disabled, the volume variables are not stored (reduces memory, but is slower)
Definition: common/properties.hh:178
specifies if data on flux vars should be saved (faster, but more memory consuming)
Definition: common/properties.hh:188
specifies if the parameters for the diffusive fluxes depend on the solution
Definition: common/properties.hh:214
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
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
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: 1ptracer/problem_tracer.hh:190
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: 1ptracer/problem_tracer.hh:211
TracerTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: 1ptracer/problem_tracer.hh:169
Definition: 1ptracer/problem_tracer.hh:50
std::tuple< Tracer > InheritsFrom
Definition: 1ptracer/problem_tracer.hh:50
Definition: 1ptracer/problem_tracer.hh:51
std::tuple< TracerTest, CCTpfaModel > InheritsFrom
Definition: 1ptracer/problem_tracer.hh:51
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 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: 1ptracer/problem_tracer.hh:123
static std::string componentName(int compIdx)
Human readable component name (index compIdx) (for vtk output)
Definition: 1ptracer/problem_tracer.hh:110
static std::string phaseName(int phaseIdx=0)
Human readable phase name (index phaseIdx) (for velocity vtk output)
Definition: 1ptracer/problem_tracer.hh:114
static constexpr bool isTracerFluidSystem()
If the fluid system only contains tracer components.
Definition: 1ptracer/problem_tracer.hh:99
static Scalar molarMass(unsigned int compIdx)
Molar mass in kg/mol of the component with index compIdx.
Definition: 1ptracer/problem_tracer.hh:118
static constexpr int getMainComponent(int phaseIdx)
No component is the main component.
Definition: 1ptracer/problem_tracer.hh:103
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
Adaption of the fully implicit scheme to the tracer transport model.
Base class for all porous media problems.
Fluid system base class.
Definition of the spatial parameters for the tracer problem.