3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
problem_2p.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_2P_SUB_PROBLEM_HH
27#define DUMUX_2P_SUB_PROBLEM_HH
28
29#include <dune/grid/yaspgrid.hh>
30
34
36
37#include "spatialparams_2p.hh"
38#include "co2tables_el2p.hh"
39
40namespace Dumux {
41
42// forward declaration of the problem class
43template <class TypeTag>
44class TwoPSubProblem;
45
46namespace Properties {
47
48// Create new type tags
49namespace TTag {
50struct TwoPSub { using InheritsFrom = std::tuple<TwoP, CCTpfaModel>; };
51} // end namespace TTag
52
53// Set the fluid system for TwoPSubProblem
54template<class TypeTag>
55struct FluidSystem<TypeTag, TTag::TwoPSub>
56{
59};
60
61// Set the grid type
62template<class TypeTag>
63struct Grid<TypeTag, TTag::TwoPSub> { using type = Dune::YaspGrid<3>; };
64// Set the problem property
65template<class TypeTag>
66struct Problem<TypeTag, TTag::TwoPSub> { using type = TwoPSubProblem<TypeTag> ; };
67// Set the spatial parameters
68template<class TypeTag>
69struct SpatialParams<TypeTag, TTag::TwoPSub>
70{
75};
76} // end namespace Properties
77
82template <class TypeTag>
84{
86
90 using Element = typename GridView::template Codim<0>::Entity;
91 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
92
93 // copy pressure index for convenience
94 enum {
97 waterPhaseIdx = FluidSystem::phase0Idx,
98 gasPhaseIdx = FluidSystem::phase1Idx,
99 dimWorld = GridView::dimensionworld
100 };
101
106
107public:
108 TwoPSubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
110 const std::string& paramGroup = "TwoP")
112 {
113 FluidSystem::init();
114 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
115 }
116
120 const std::string& name() const
121 {
122 return problemName_;
123 }
124
126 Scalar temperature() const
127 { return 273.15 + 10; } // 10C
128
130 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
131 { return initialAtPos(globalPos); }
132
134 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
135 {
136 PrimaryVariables values;
137
138 values[pressureIdx] = 1.5e7;
139 values[saturationNIdx] = 0.0;
140 return values;
141 }
142
144 NumEqVector sourceAtPos(const GlobalPosition& globalPos) const
145 {
146 NumEqVector values(0.0);
147
148 static const Scalar sourceG = getParam<Scalar>("Problem.InjectionRateGas");
149 static const Scalar sourceW = getParam<Scalar>("Problem.InjectionRateWater");
150 if(globalPos[0] > 250 + eps_ && globalPos[0] < 750 - eps_
151 && globalPos[1] > 250 + eps_ && globalPos[1] < 750 - eps_
152 && globalPos[dimWorld-1] > 250 + eps_ && globalPos[dimWorld-1] < 750 - eps_)
153 {
154 values[gasPhaseIdx] = sourceG;
155 values[waterPhaseIdx] = sourceW;
156 }
157 return values;
158 }
159
166 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
167 {
168 BoundaryTypes values;
169 if (globalPos[dimWorld-1] < eps_)
170 values.setAllNeumann();
171 else
172 values.setAllDirichlet();
173 return values;
174 }
175
176private:
177 static constexpr Scalar eps_ = 1.0e-6;
178 std::string problemName_;
179};
180
181} // end namespace Dumux
182
183#endif
Properties for all models using cell-centered finite volume scheme with TPFA.
A compositional fluid with brine (H2O & NaCl) and carbon dioxide as components in both the liquid and...
Provides the class with the tabulated values of CO2.
The spatial parameters class for the two-phase sub problem in the el2p test problem.
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 std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition: common/fvproblem.hh:592
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 compositional fluid with brine (H2O & NaCl) and carbon dioxide as components in both the liquid and...
Definition: brineco2.hh:119
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
The two-phase sub problem in the el2p coupled problem.
Definition: problem_2p.hh:84
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: problem_2p.hh:134
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: problem_2p.hh:126
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: problem_2p.hh:166
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: problem_2p.hh:130
NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
Evaluates source terms.
Definition: problem_2p.hh:144
TwoPSubProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< GetPropType< TypeTag, Properties::SpatialParams > > spatialParams, const std::string &paramGroup="TwoP")
Definition: problem_2p.hh:108
const std::string & name() const
The problem name.
Definition: problem_2p.hh:120
Definition: problem_2p.hh:50
std::tuple< TwoP, CCTpfaModel > InheritsFrom
Definition: problem_2p.hh:50
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: problem_2p.hh:57
Dune::YaspGrid< 3 > type
Definition: problem_2p.hh:63
GetPropType< TypeTag, Properties::CouplingManager > CouplingManager
Definition: problem_2p.hh:73
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: problem_2p.hh:72
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: problem_2p.hh:71
The spatial parameters class for the two-phase sub problem in the el2p test problem.
Definition: spatialparams_2p.hh:46
Adaption of the fully implicit scheme to the two-phase flow model.
Base class for all porous media problems.