3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/3p3c/implicit/columnxylol/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 vesion. *
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_COLUMNXYLOLPROBLEM_HH
27#define DUMUX_COLUMNXYLOLPROBLEM_HH
28
29#include <dune/grid/yaspgrid.hh>
30
35
40
41#include "spatialparams.hh"
42
43#define ISOTHERMAL 0
44
45namespace Dumux {
51template <class TypeTag>
52class ColumnProblem;
53
54namespace Properties {
55// Create new type tags
56namespace TTag {
57struct Column { using InheritsFrom = std::tuple<ThreePThreeCNI>; };
58struct ColumnBox { using InheritsFrom = std::tuple<Column, BoxModel>; };
59struct ColumnCCTpfa { using InheritsFrom = std::tuple<Column, CCTpfaModel>; };
60} // end namespace TTag
61
62// Set the grid type
63template<class TypeTag>
64struct Grid<TypeTag, TTag::Column> { using type = Dune::YaspGrid<2>; };
65
66// Set the problem property
67template<class TypeTag>
68struct Problem<TypeTag, TTag::Column> { using type = ColumnProblem<TypeTag>; };
69
70// Set the fluid system
71template<class TypeTag>
72struct FluidSystem<TypeTag, TTag::Column>
74
75template<class TypeTag>
76struct SolidSystem<TypeTag, TTag::Column>
77{
81};
82
84template<class TypeTag>
85struct SolidState<TypeTag, TTag::Column>
86{
87private:
90public:
92};
93
94// Set the spatial parameters
95template<class TypeTag>
96struct SpatialParams<TypeTag, TTag::Column>
97{
101};
102} // end namespace Properties
103
129template <class TypeTag >
131{
135
138 using Indices = typename ModelTraits::Indices;
139
140 enum
141 {
142 // primary variable indices
143 pressureIdx = Indices::pressureIdx,
144 switch1Idx = Indices::switch1Idx,
145 switch2Idx = Indices::switch2Idx,
146 temperatureIdx = Indices::temperatureIdx,
147
148 // equation indices
149 energyEqIdx = Indices::energyEqIdx,
150 contiWEqIdx = Indices::conti0EqIdx + FluidSystem::wCompIdx,
151 contiGEqIdx = Indices::conti0EqIdx + FluidSystem::gCompIdx,
152 contiNEqIdx = Indices::conti0EqIdx + FluidSystem::nCompIdx,
153
154 // Phase State
155 threePhases = Indices::threePhases
156 };
157
161 using Element = typename GridView::template Codim<0>::Entity;
162 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
163 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
165 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
166 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
167
168public:
169 ColumnProblem(std::shared_ptr<const GridGeometry> gridGeometry)
171 {
172 FluidSystem::init();
173 name_ = getParam<std::string>("Problem.Name");
174 }
175
179 // \{
180
186 const std::string name() const
187 { return name_; }
188
189 // \}
190
194 // \{
195
202 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
203 {
204 BoundaryTypes bcTypes;
205 if (globalPos[1] < eps_)
206 bcTypes.setAllDirichlet();
207 else
208 bcTypes.setAllNeumann();
209 return bcTypes;
210 }
211
219 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
220 {
221 return initial_(globalPos);
222 }
223
232 NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
233 {
234 NumEqVector values(0.0);
235
236 // negative values for injection
237 if (globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_)
238 {
239 values[contiWEqIdx] = -0.395710;
240 values[contiGEqIdx] = -0.000001;
241 values[contiNEqIdx] = -0.00;
242 values[energyEqIdx] = -17452.97;
243 }
244 return values;
245 }
246
247 // \}
248
249
258 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
259 {
260 return initial_(globalPos);
261 }
262
263
271 template<class VTKWriter>
272 void addVtkFields(VTKWriter& vtk)
273 {
274 const auto& gg = this->gridGeometry();
275 Kxx_.resize(gg.numDofs());
276 vtk.addField(Kxx_, "permeability");
277
278 for (const auto& element : elements(this->gridView()))
279 {
280 auto fvGeometry = localView(gg);
281 fvGeometry.bindElement(element);
282
283 for (const auto& scv : scvs(fvGeometry))
284 Kxx_[scv.dofIndex()] = this->spatialParams().intrinsicPermeabilityAtPos(scv.dofPosition());
285 }
286 }
287
288private:
289 // internal method for the initial condition (reused for the
290 // dirichlet conditions!)
291 PrimaryVariables initial_(const GlobalPosition &globalPos) const
292 {
293 PrimaryVariables values;
294 values.setState(threePhases);
295 const auto y = globalPos[1];
296 const auto yMax = this->gridGeometry().bBoxMax()[1];
297
298 values[temperatureIdx] = 296.15;
299 values[pressureIdx] = 1.e5;
300 values[switch1Idx] = 0.005;
301
302 if (y > yMax - eps_)
303 values[switch2Idx] = 0.112;
304 else if (y > yMax - 0.0148 - eps_)
305 values[switch2Idx] = 0 + ((yMax - y)/0.0148)*0.112;
306 else if (y > yMax - 0.0296 - eps_)
307 values[switch2Idx] = 0.112 + (((yMax - y) - 0.0148)/0.0148)*(0.120 - 0.112);
308 else if (y > yMax - 0.0444 - eps_)
309 values[switch2Idx] = 0.120 + (((yMax - y) - 0.0296)/0.0148)*(0.125 - 0.120);
310 else if (y > yMax - 0.0592 - eps_)
311 values[switch2Idx] = 0.125 + (((yMax - y) - 0.0444)/0.0148)*(0.137 - 0.125);
312 else if (y > yMax - 0.0740 - eps_)
313 values[switch2Idx] = 0.137 + (((yMax - y) - 0.0592)/0.0148)*(0.150 - 0.137);
314 else if (y > yMax - 0.0888 - eps_)
315 values[switch2Idx] = 0.150 + (((yMax - y) - 0.0740)/0.0148)*(0.165 - 0.150);
316 else if (y > yMax - 0.1036 - eps_)
317 values[switch2Idx] = 0.165 + (((yMax - y) - 0.0888)/0.0148)*(0.182 - 0.165);
318 else if (y > yMax - 0.1184 - eps_)
319 values[switch2Idx] = 0.182 + (((yMax - y) - 0.1036)/0.0148)*(0.202 - 0.182);
320 else if (y > yMax - 0.1332 - eps_)
321 values[switch2Idx] = 0.202 + (((yMax - y) - 0.1184)/0.0148)*(0.226 - 0.202);
322 else if (y > yMax - 0.1480 - eps_)
323 values[switch2Idx] = 0.226 + (((yMax - y) - 0.1332)/0.0148)*(0.257 - 0.226);
324 else if (y > yMax - 0.1628 - eps_)
325 values[switch2Idx] = 0.257 + (((yMax - y) - 0.1480)/0.0148)*(0.297 - 0.257);
326 else if (y > yMax - 0.1776 - eps_)
327 values[switch2Idx] = 0.297 + (((yMax - y) - 0.1628)/0.0148)*(0.352 - 0.297);
328 else if (y > yMax - 0.1924 - eps_)
329 values[switch2Idx] = 0.352 + (((yMax - y) - 0.1776)/0.0148)*(0.426 - 0.352);
330 else if (y > yMax - 0.2072 - eps_)
331 values[switch2Idx] = 0.426 + (((yMax - y) - 0.1924)/0.0148)*(0.522 - 0.426);
332 else if (y > yMax - 0.2220 - eps_)
333 values[switch2Idx] = 0.522 + (((yMax - y) - 0.2072)/0.0148)*(0.640 - 0.522);
334 else if (y > yMax - 0.2368 - eps_)
335 values[switch2Idx] = 0.640 + (((yMax - y) - 0.2220)/0.0148)*(0.767 - 0.640);
336 else if (y > yMax - 0.2516 - eps_)
337 values[switch2Idx] = 0.767 + (((yMax - y) - 0.2368)/0.0148)*(0.878 - 0.767);
338 else if (y > yMax - 0.2664 - eps_)
339 values[switch2Idx] = 0.878 + (((yMax - y) - 0.2516)/0.0148)*(0.953 - 0.878);
340 else if (y > yMax - 0.2812 - eps_)
341 values[switch2Idx] = 0.953 + (((yMax - y) - 0.2664)/0.0148)*(0.988 - 0.953);
342 else if (y > yMax - 0.3000 - eps_)
343 values[switch2Idx] = 0.988;
344 else
345 values[switch2Idx] = 1.e-4;
346 return values;
347 }
348
349 static constexpr Scalar eps_ = 1e-6;
350 std::string name_;
351 std::vector<Scalar> Kxx_;
352};
353
354} // end namespace Dumux
355
356#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...
Represents all relevant thermodynamic quantities of a inert solid system.
A solid phase consisting of a single inert solid component.
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
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
The type of the solid system to use.
Definition: common/properties.hh:227
The type of the solid state to use.
Definition: common/properties.hh:229
A component which returns run time specified values for all fluid properties.
Definition: constant.hh:58
A three-phase fluid system featuring gas, NAPL and water as phases and distilled water and air (Pseu...
Definition: h2oairxylene.hh:56
Represents all relevant thermodynamic quantities of a inert solid system.
Definition: inertsolidstate.hh:35
A solid phase consisting of a single inert solid component.
Definition: inertsolidphase.hh:41
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 injection problem where water is injected into a sand column with a NAPL contamination...
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:131
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:219
ColumnProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:169
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:258
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/columnxylol/problem.hh:202
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/columnxylol/problem.hh:272
NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:232
const std::string name() const
The problem name.
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:186
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:57
std::tuple< ThreePThreeCNI > InheritsFrom
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:57
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:58
std::tuple< Column, BoxModel > InheritsFrom
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:58
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:59
std::tuple< Column, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:59
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:64
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:78
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:98
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/3p3c/implicit/columnxylol/problem.hh:99
Definition of the spatial parameters for the column problem.
Definition: porousmediumflow/3p3c/implicit/columnxylol/spatialparams.hh:43
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.