3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/2p/implicit/nonisothermal/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 *****************************************************************************/
28#ifndef DUMUX_INJECTION_PROBLEM_2PNI_HH
29#define DUMUX_INJECTION_PROBLEM_2PNI_HH
30
31#if HAVE_DUNE_ALUGRID
32#include <dune/alugrid/grid.hh>
33#endif
34#if HAVE_UG
35#include <dune/grid/uggrid.hh>
36#endif
37#include <dune/grid/yaspgrid.hh>
38
42
45
48
49// use the spatial parameters as the injection problem of the 2p2c test program
51
52#ifndef GRIDTYPE // default to yasp grid if not provided by CMake
53#define GRIDTYPE Dune::YaspGrid<2>
54#endif
55
56namespace Dumux {
57
59template <class TypeTag> class InjectionProblem2PNI;
60
61namespace Properties {
62// Create new type tags
63namespace TTag {
64struct Injection2PNITypeTag { using InheritsFrom = std::tuple<TwoPNI>; };
65struct InjectionBox2PNITypeTag { using InheritsFrom = std::tuple<Injection2PNITypeTag, BoxModel>; };
66struct InjectionCC2PNITypeTag { using InheritsFrom = std::tuple<Injection2PNITypeTag, CCTpfaModel>; };
67} // end namespace TTag
68
69// Obtain grid type from COMPILE_DEFINITIONS
70template<class TypeTag>
71struct Grid<TypeTag, TTag::Injection2PNITypeTag> { using type = GRIDTYPE; };
72
73// Set the problem property
74template<class TypeTag>
75struct Problem<TypeTag, TTag::Injection2PNITypeTag> { using type = InjectionProblem2PNI<TypeTag>; };
76
77// Use the same fluid system as the 2p2c injection problem
78template<class TypeTag>
79struct FluidSystem<TypeTag, TTag::Injection2PNITypeTag> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>; };
80
81// Set the spatial parameters
82template<class TypeTag>
83struct SpatialParams<TypeTag, TTag::Injection2PNITypeTag>
84{
88};
89
90} // namespace Properties
91
120template<class TypeTag>
122{
126 using Element = typename GridView::template Codim<0>::Entity;
127 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
128
131 using Indices = typename ModelTraits::Indices;
132
133 enum
134 {
136 pressureIdx = Indices::pressureIdx,
137 saturationIdx = Indices::saturationIdx,
138 temperatureIdx = Indices::temperatureIdx,
139
141 contiN2EqIdx = Indices::conti0EqIdx + FluidSystem::N2Idx,
142 energyEqIdx = Indices::energyEqIdx,
143
145 wPhaseIdx = FluidSystem::H2OIdx,
146 nPhaseIdx = FluidSystem::N2Idx,
147
148 // world dimension
149 dimWorld = GridView::dimensionworld
150 };
151
155 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
156 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
157 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
159
160public:
161 InjectionProblem2PNI(std::shared_ptr<const GridGeometry> gridGeometry)
163 {
164 maxDepth_ = 2700.0; // [m]
165
166 // initialize the tables of the fluid system
167 FluidSystem::init(/*tempMin=*/273.15,
168 /*tempMax=*/423.15,
169 /*numTemp=*/50,
170 /*pMin=*/0.0,
171 /*pMax=*/30e6,
172 /*numP=*/300);
173
174 name_ = getParam<std::string>("Problem.Name");
175 }
176
180 // \{
181
187 const std::string name() const
188 { return name_; }
189
195 NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
196 {
197 NumEqVector values(0.0);
198 values = 0;
199 return values;
200 }
201
202 // \}
203
207 // \{
208
215 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
216 {
217 BoundaryTypes values;
218 if (globalPos[0] < eps_)
219 values.setAllDirichlet();
220 else
221 values.setAllNeumann();
222
223 return values;
224 }
225
231 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
232 {
233 PrimaryVariables values;
234 Scalar densityW = 1000.0;
235 values[pressureIdx] = 1e5 + (maxDepth_ - globalPos[dimWorld-1])*densityW*9.81;
236 values[saturationIdx] = 0.0;
237 values[temperatureIdx] = 283.0 + (maxDepth_ - globalPos[dimWorld-1])*0.03;
238 return values;
239 }
240
249 NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
250 {
251 NumEqVector values(0.0);
252
253 if (globalPos[1] < 13.75 + eps_ && globalPos[1] > 6.875 - eps_)
254 {
255 // inject air. negative values mean injection
256 values[contiN2EqIdx] = -1e-3; // kg/(s*m^2)
257
258 // compute enthalpy flux associated with this injection [(J/(kg*s)]
260 FluidState fs;
261
262 const auto initialValues = initialAtPos(globalPos);
263 fs.setPressure(wPhaseIdx, initialValues[pressureIdx]);
264 fs.setPressure(nPhaseIdx, initialValues[pressureIdx]); // assume pressure equality here
265 fs.setTemperature(wPhaseIdx,initialValues[temperatureIdx]);
266 fs.setTemperature(nPhaseIdx,initialValues[temperatureIdx]);
267
268 // energy flux is mass flux times specific enthalpy
269 values[energyEqIdx] = values[contiN2EqIdx]*FluidSystem::enthalpy(fs, nPhaseIdx);
270 }
271
272 return values;
273 }
274
275 // \}
276
277
281 // \{
282
288 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
289 {
290 PrimaryVariables values;
291 Scalar densityW = 1000.0;
292 values[pressureIdx] = 1e5 + (maxDepth_ - globalPos[1])*densityW*9.81;
293 values[saturationIdx] = 0.0;
294 values[temperatureIdx] = 283.0 + (maxDepth_ - globalPos[1])*0.03;
295
296 if (globalPos[0] > 21.25 - eps_ && globalPos[0] < 28.75 + eps_ && globalPos[1] > 6.25 - eps_ && globalPos[1] < 33.75 + eps_)
297 values[temperatureIdx] = 380;
298
299 return values;
300 }
301 // \}
302
303private:
304 Scalar maxDepth_;
305 static constexpr Scalar eps_ = 1.5e-7;
306 std::string name_;
307};
308
309} // end namespace Dumux
310
311#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.
Properties of pure molecular nitrogen .
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
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
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
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
Forward declaration of the problem class.
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:122
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/2p/implicit/nonisothermal/problem.hh:215
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial values for a control volume.
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:288
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:231
const std::string name() const
Returns the problem name.
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:187
NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:249
NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
Returns the source term.
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:195
InjectionProblem2PNI(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:161
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:64
std::tuple< TwoPNI > InheritsFrom
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:64
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:65
std::tuple< Injection2PNITypeTag, BoxModel > InheritsFrom
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:65
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:66
std::tuple< Injection2PNITypeTag, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:66
GRIDTYPE type
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:71
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:86
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:85
Definition of the spatial parameters for the injection problem which uses the isothermal two-phase tw...
Definition: porousmediumflow/2p2c/implicit/injection/spatialparams.hh:45
Declares all properties used in Dumux.
Adaption of the fully implicit scheme to the two-phase flow model.
Base class for all porous media problems.
#define GRIDTYPE
Definition: test/porousmediumflow/2p/implicit/nonisothermal/problem.hh:53
Definition of the spatial parameters for the injection problem which uses the isothermal two-phase tw...