3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/3p3c/implicit/kuevette/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_KUEVETTE3P3CNIPROBLEM_HH
28#define DUMUX_KUEVETTE3P3CNIPROBLEM_HH
29
30#include <dune/common/float_cmp.hh>
31#include <dune/grid/yaspgrid.hh>
32
39
40#include "spatialparams.hh"
41
42#define ISOTHERMAL 0
43
44namespace Dumux {
45
52template <class TypeTag>
53class KuevetteProblem;
54
55namespace Properties {
56// Create new type tags
57namespace TTag {
58struct Kuevette { using InheritsFrom = std::tuple<ThreePThreeCNI>; };
59struct KuevetteBox { using InheritsFrom = std::tuple<Kuevette, BoxModel>; };
60struct KuevetteCCTpfa { using InheritsFrom = std::tuple<Kuevette, CCTpfaModel>; };
61} // end namespace TTag
62
63// Set the grid type
64template<class TypeTag>
65struct Grid<TypeTag, TTag::Kuevette> { using type = Dune::YaspGrid<2>; };
66
67// Set the problem property
68template<class TypeTag>
69struct Problem<TypeTag, TTag::Kuevette> { using type = KuevetteProblem<TypeTag>; };
70
71// Set the spatial parameters
72template<class TypeTag>
73struct SpatialParams<TypeTag, TTag::Kuevette>
74{
78};
79
80// Set the fluid system
81template<class TypeTag>
82struct FluidSystem<TypeTag, TTag::Kuevette>
84} // end namespace Properties
85
115template <class TypeTag >
117{
121
122 // copy some indices for convenience
125 enum {
126
127 pressureIdx = Indices::pressureIdx,
128 switch1Idx = Indices::switch1Idx,
129 switch2Idx = Indices::switch2Idx,
130 temperatureIdx = Indices::temperatureIdx,
131 contiWEqIdx = Indices::conti0EqIdx + FluidSystem::wCompIdx,
132 contiGEqIdx = Indices::conti0EqIdx + FluidSystem::gCompIdx,
133 contiNEqIdx = Indices::conti0EqIdx + FluidSystem::nCompIdx,
134 energyEqIdx = Indices::energyEqIdx,
135
136 // phase states
137 threePhases = Indices::threePhases,
138 wgPhaseOnly = Indices::wgPhaseOnly,
139
140 // world dimension
141 dimWorld = GridView::dimensionworld
142 };
143
147 using Element = typename GridView::template Codim<0>::Entity;
149 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
151 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
152 using ElementFluxVariablesCache = typename GridVariables::GridFluxVariablesCache::LocalView;
153 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
154
155 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
156
157public:
158 KuevetteProblem(std::shared_ptr<const GridGeometry> gridGeometry)
160 {
161 FluidSystem::init();
162 name_ = getParam<std::string>("Problem.Name");
163 }
164
168 // \{
169
175 const std::string name() const
176 { return name_; }
177
178 // \}
179
183 // \{
184
191 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
192 {
193 BoundaryTypes bcTypes;
194 if(globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_)
195 bcTypes.setAllDirichlet();
196 else
197 bcTypes.setAllNeumann();
198 return bcTypes;
199 }
200
208 PrimaryVariables dirichletAtPos( const GlobalPosition &globalPos) const
209 {
210 return initial_(globalPos);
211 }
212
225 NumEqVector neumann(const Element& element,
226 const FVElementGeometry& fvGeometry,
227 const ElementVolumeVariables& elemVolVars,
228 const ElementFluxVariablesCache& elemFluxVarsCache,
229 const SubControlVolumeFace& scvf) const
230 {
231 NumEqVector values(0.0);
232 const auto& globalPos = scvf.ipGlobal();
233
234 // negative values for injection
235 if (globalPos[0] < eps_)
236 {
237 values[contiWEqIdx] = -0.1435; // 0.3435 [mol/(s m)] in total
238 values[contiGEqIdx] = -0.2;
239 values[contiNEqIdx] = 0.0;
240 values[energyEqIdx] = -6929.;
241 }
242 return values;
243 }
244
245 // \}
246
250 // \{
251
260 PrimaryVariables initialAtPos( const GlobalPosition &globalPos) const
261 {
262 return initial_(globalPos);
263 }
264
272 template<class VTKWriter>
273 void addVtkFields(VTKWriter& vtk)
274 {
275 const auto& gg = this->gridGeometry();
276 Kxx_.resize(gg.numDofs());
277 vtk.addField(Kxx_, "permeability");
278
279 for (const auto& element : elements(this->gridView()))
280 {
281 auto fvGeometry = localView(gg);
282 fvGeometry.bindElement(element);
283
284 for (const auto& scv : scvs(fvGeometry))
285 Kxx_[scv.dofIndex()] = this->spatialParams().intrinsicPermeabilityAtPos(scv.dofPosition());
286 }
287 }
288
289private:
290 // checks, whether a point is located inside the contamination zone
291 bool isInContaminationZone(const GlobalPosition &globalPos) const
292 {
293 return (Dune::FloatCmp::ge<Scalar>(globalPos[0], 0.2)
294 && Dune::FloatCmp::le<Scalar>(globalPos[0], 0.8)
295 && Dune::FloatCmp::ge<Scalar>(globalPos[1], 0.4)
296 && Dune::FloatCmp::le<Scalar>(globalPos[1], 0.65));
297 }
298
299 // internal method for the initial condition (reused for the
300 // dirichlet conditions!)
301 PrimaryVariables initial_(const GlobalPosition &globalPos) const
302 {
303 PrimaryVariables values;
304 if (isInContaminationZone(globalPos))
305 values.setState(threePhases);
306 else
307 values.setState(wgPhaseOnly);
308
309 values[pressureIdx] = 1e5 ;
310 values[switch1Idx] = 0.12;
311 values[switch2Idx] = 1.e-6;
312 values[temperatureIdx] = 293.0;
313
314 if (isInContaminationZone(globalPos))
315 {
316 values[switch2Idx] = 0.07;
317 }
318 return values;
319 }
320
321 static constexpr Scalar eps_ = 1e-6;
322 std::string name_;
323 std::vector<Scalar> Kxx_;
324};
325
326} // end namespace Dumux
327
328#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.
Setting constant fluid properties via the input file.
A three-phase fluid system featuring gas, NAPL and water as phases and distilled water and air (Pseu...
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
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
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
A three-phase fluid system featuring gas, NAPL and water as phases and distilled water and air (Pseu...
Definition: h2oairmesitylene.hh:57
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
Non-isothermal gas injection problem where a gas (e.g. steam/air) is injected into a unsaturated poro...
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:117
const std::string name() const
The problem name.
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:175
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:260
KuevetteProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:158
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:208
void addVtkFields(VTKWriter &vtk)
Appends all quantities of interest which can be derived from the solution of the current time step to...
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:273
NumEqVector neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a N eumann boundary segment.
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:225
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/3p3c/implicit/kuevette/problem.hh:191
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:58
std::tuple< ThreePThreeCNI > InheritsFrom
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:58
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:59
std::tuple< Kuevette, BoxModel > InheritsFrom
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:59
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:60
std::tuple< Kuevette, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:60
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:65
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:75
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/3p3c/implicit/kuevette/problem.hh:76
Definition of the spatial parameters for the kuevette problem.
Definition: porousmediumflow/3p3c/implicit/kuevette/spatialparams.hh:46
Adaption of the fully implicit scheme to the three-phase three-component flow model.
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.