3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/2p2c/implicit/mpnccomparison/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 *****************************************************************************/
27#ifndef DUMUX_TWOPTWOC_MPNC_PROBLEM_HH
28#define DUMUX_TWOPTWOC_MPNC_PROBLEM_HH
29
30#include <dune/grid/yaspgrid.hh>
31
32#include <dune/common/parametertreeparser.hh>
33
36
39
42
43#include "spatialparams.hh"
44#include "iofields.hh"
45
46namespace Dumux {
47
48template <class TypeTag>
49class TwoPTwoCComparisonProblem;
50
51namespace Properties {
52// Create new type tags
53namespace TTag {
54struct TwoPTwoCComparison { using InheritsFrom = std::tuple<TwoPTwoC>; };
55struct TwoPTwoCComparisonBox { using InheritsFrom = std::tuple<TwoPTwoCComparison, BoxModel>; };
56struct TwoPTwoCComparisonCC { using InheritsFrom = std::tuple<TwoPTwoCComparison, CCTpfaModel>; };
57} // end namespace TTag
58
59// Set the grid type
60template<class TypeTag>
61struct Grid<TypeTag, TTag::TwoPTwoCComparison> { using type = Dune::YaspGrid<2>; };
62
63// Set the problem property
64template<class TypeTag>
65struct Problem<TypeTag, TTag::TwoPTwoCComparison> { using type = TwoPTwoCComparisonProblem<TypeTag>; };
66
67// Set fluid configuration
68template<class TypeTag>
69struct FluidSystem<TypeTag, TTag::TwoPTwoCComparison>
70{
72 FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>;
73};
74
75// Set the spatial parameters
76template<class TypeTag>
77struct SpatialParams<TypeTag, TTag::TwoPTwoCComparison>
78{
82};
83
84// decide which type to use for floating values (double / quad)
85template<class TypeTag>
86struct Scalar<TypeTag, TTag::TwoPTwoCComparison> { using type = double; };
87template<class TypeTag>
88struct Formulation<TypeTag, TTag::TwoPTwoCComparison>
89{
90public:
92};
93
94template<class TypeTag>
95struct UseMoles<TypeTag, TTag::TwoPTwoCComparison> { static constexpr bool value = true; };
96
97template<class TypeTag>
98struct IOFields<TypeTag, TTag::TwoPTwoCComparison> { using type = TwoPTwoCMPNCIOFields; };
99} // end namespace Properties
100
107template <class TypeTag>
109{
116 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
117 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
119 using Element = typename GridView::template Codim<0>::Entity;
120 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
122
124 using Indices = typename ModelTraits::Indices;
125
126public:
127 TwoPTwoCComparisonProblem(std::shared_ptr<const GridGeometry> gridGeometry)
129 {
130 temperature_ = 273.15 + 25; // -> 25°C
131
132 // initialize the tables of the fluid system
133 Scalar Tmin = temperature_ - 1.0;
134 Scalar Tmax = temperature_ + 1.0;
135 int nT = 3;
136
137 Scalar pmin = 1.0e5 * 0.75;
138 Scalar pmax = 2.0e5 * 1.25;
139 int np = 1000;
140
141 FluidSystem::init(Tmin, Tmax, nT, pmin, pmax, np);
142 name_ = getParam<std::string>("Problem.Name");
143 }
144
148 // \{
149
155 const std::string name() const
156 { return name_; }
157
162 Scalar temperature() const
163 { return temperature_; }
164
172 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
173 {
174 BoundaryTypes bcTypes;
175 if (onOutlet_(globalPos))
176 bcTypes.setAllDirichlet();
177 else
178 bcTypes.setAllNeumann();
179 return bcTypes;
180 }
181
187 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
188 {
189 return initial_(globalPos);
190 }
191
196 NeumannFluxes neumannAtPos(const GlobalPosition& globalPos) const
197 {
198 NeumannFluxes values(0.0);
199 Scalar injectedAirMass = -1e-3;
200 Scalar injectedAirMolarMass = injectedAirMass/FluidSystem::molarMass(FluidSystem::N2Idx);
201 if (onInlet_(globalPos))
202 values[Indices::conti0EqIdx + FluidSystem::N2Idx] = injectedAirMolarMass;
203 return values;
204 }
205
206 // \}
207
216 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
217 {
218 return initial_(globalPos);
219 }
220
221 // \}
222
223private:
224 // the internal method for the initial condition
225 PrimaryVariables initial_(const GlobalPosition &globalPos) const
226 {
227 PrimaryVariables values(0.0);
228 values[Indices::pressureIdx] = 1e5; // air pressure
229 values[Indices::switchIdx] = 0.8; // water saturation
230 values.setState(Indices::bothPhases);
231
232 return values;
233 }
234
235 bool onInlet_(const GlobalPosition &globalPos) const
236 {
237 Scalar x = globalPos[0];
238 Scalar y = globalPos[1];
239 return x >= 60 - eps_ && y <= 10 + eps_;
240 }
241
242 bool onOutlet_(const GlobalPosition &globalPos) const
243 {
244 Scalar x = globalPos[0];
245 Scalar y = globalPos[1];
246 return x < eps_ && y <= 10 + eps_;
247 }
248
249 Scalar temperature_;
250 static constexpr Scalar eps_ = 1e-6;
251 std::string name_;
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 TPFA.
Represents all relevant thermodynamic quantities of a multi-phase, multi-component fluid system assum...
TwoPFormulation
Enumerates the formulations which the two-phase model accepts.
Definition: formulation.hh:35
@ p1s0
first phase saturation and second phase pressure as primary variables
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
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
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
Property to specify the type of scalar values.
Definition: common/properties.hh:53
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
A class helping models to define input and output fields.
Definition: common/properties.hh:78
Property whether to use moles or kg as amount unit for balance equations.
Definition: common/properties.hh:102
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
The formulation of the model.
Definition: common/properties.hh:237
Policy for the H2O-N2 fluid system.
Definition: h2on2.hh:52
A two-phase fluid system with two components water Nitrogen for non-equilibrium models.
Definition: h2on2.hh:69
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
Adds I/O fields specific to the two-phase two-component model.
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/iofields.hh:36
Problem where air is injected in a unsaturated porous medium.
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:109
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:172
NeumannFluxes neumannAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:196
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:216
TwoPTwoCComparisonProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:127
Scalar temperature() const
Returns the temperature .
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:162
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet oundary segment.
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:187
const std::string name() const
Returns the problem name.
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:155
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:54
std::tuple< TwoPTwoC > InheritsFrom
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:54
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:55
std::tuple< TwoPTwoCComparison, BoxModel > InheritsFrom
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:55
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:56
std::tuple< TwoPTwoCComparison, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:56
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:61
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:79
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:80
double type
Definition: test/porousmediumflow/2p2c/implicit/mpnccomparison/problem.hh:86
The spatial parameters for the 2p2c mpnc comparison problem.
Definition: porousmediumflow/2p2c/implicit/mpnccomparison/spatialparams.hh:45
Adaption of the fully implicit scheme to the two-phase two-component fully implicit model.
Adds I/O fields specific to the twop model.
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.