3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
1p_2p/problem_darcy.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 *****************************************************************************/
25#ifndef DUMUX_DARCY_SUBPROBLEM_HH
26#define DUMUX_DARCY_SUBPROBLEM_HH
27
28#include <dune/grid/yaspgrid.hh>
29
31
34
35#include "spatialparams.hh"
36
37namespace Dumux {
38template <class TypeTag>
39class DarcySubProblem;
40
41namespace Properties {
42// Create new type tags
43namespace TTag {
44struct DarcyTwoP { using InheritsFrom = std::tuple<TwoP, CCTpfaModel>; };
45} // end namespace TTag
46
47// Set the problem property
48template<class TypeTag>
49struct Problem<TypeTag, TTag::DarcyTwoP> { using type = Dumux::DarcySubProblem<TypeTag>; };
50
51// Set the grid type
52#if ENABLE_3D
53template<class TypeTag>
54struct Grid<TypeTag, TTag::DarcyTwoP> { using type = Dune::YaspGrid<3>; };
55#else
56template<class TypeTag>
57struct Grid<TypeTag, TTag::DarcyTwoP> { using type = Dune::YaspGrid<2>; };
58#endif
59
60template<class TypeTag>
61struct UseMoles<TypeTag, TTag::DarcyTwoP> { static constexpr bool value = false; };
62
63template<class TypeTag>
64struct SpatialParams<TypeTag, TTag::DarcyTwoP>
65{
69};
70
72template<class TypeTag>
73struct Formulation<TypeTag, TTag::DarcyTwoP>
74{ static constexpr auto value = TwoPFormulation::p1s0; };
75} // end namespace Properties
76
77template <class TypeTag>
79{
87 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
88 using ElementFluxVariablesCache = typename GridVariables::GridFluxVariablesCache::LocalView;
89 using VolumeVariables = typename GridVariables::GridVolumeVariables::VolumeVariables;
90
91 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
92 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
93 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
95
97
98 // copy some indices for convenience
100 enum {
101 // primary variable indices
102 conti0EqIdx = Indices::conti0EqIdx,
103 pressureIdx = Indices::pressureIdx,
104 saturationIdx = Indices::saturationIdx,
105 };
106
107 using Element = typename GridView::template Codim<0>::Entity;
108 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
109
111
112public:
113 DarcySubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
114 std::shared_ptr<CouplingManager> couplingManager)
115 : ParentType(gridGeometry, "Darcy"), eps_(1e-7), couplingManager_(couplingManager)
116 {
117 pressure_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.Pressure");
118 saturation_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.Saturation");
119 temperature_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.Temperature");
120 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
121 }
122
126 const std::string& name() const
127 {
128 return problemName_;
129 }
130
134 // \{
135
140 { return false; }
141
145 // \{
146
147 bool shouldWriteOutput() const // define output
148 { return true; }
149
150
155 Scalar temperature() const
156 { return temperature_; }
157 // \}
158
162 // \{
163
171 BoundaryTypes boundaryTypes(const Element& element,
172 const SubControlVolumeFace& scvf) const
173 {
174 BoundaryTypes values;
175
176 values.setAllNeumann(); // left/right wall
177
178 if(onLowerBoundary_(scvf.center()))
179 values.setAllDirichlet();
180
181 if(couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf))
182 values.setAllCouplingNeumann();
183
184 return values;
185 }
186
195 PrimaryVariables dirichlet(const Element &element, const SubControlVolumeFace &scvf) const
196 {
197 PrimaryVariables values(0.0);
198 values = initial(element);
199
200 return values;
201 }
202
214 NumEqVector neumann(const Element& element,
215 const FVElementGeometry& fvGeometry,
216 const ElementVolumeVariables& elemVolVars,
217 const ElementFluxVariablesCache& elemFluxVarsCache,
218 const SubControlVolumeFace& scvf) const
219 {
220 NumEqVector values(0.0);
221
222 if(couplingManager().isCoupledEntity(CouplingManager::darcyIdx, scvf))
223 values = couplingManager().couplingData().massCouplingCondition(element, fvGeometry, elemVolVars, scvf);
224
225 return values;
226 }
227
228 // \}
229
233 // \{
248 NumEqVector source(const Element &element,
249 const FVElementGeometry& fvGeometry,
250 const ElementVolumeVariables& elemVolVars,
251 const SubControlVolume &scv) const
252 { return NumEqVector(0.0); }
253
254 // \}
255
264 PrimaryVariables initial(const Element &element) const
265 {
266 PrimaryVariables values(0.0);
267 values[pressureIdx] = pressure_;
268 values[saturationIdx] = saturation_;
269
270 return values;
271 }
272
273 // \}
274
278 const CouplingManager& couplingManager() const
279 { return *couplingManager_; }
280
281private:
282 bool onLeftBoundary_(const GlobalPosition &globalPos) const
283 { return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_; }
284
285 bool onRightBoundary_(const GlobalPosition &globalPos) const
286 { return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_; }
287
288 bool onLowerBoundary_(const GlobalPosition &globalPos) const
289 { return globalPos[1] < this->gridGeometry().bBoxMin()[1] + eps_; }
290
291 bool onUpperBoundary_(const GlobalPosition &globalPos) const
292 { return globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_; }
293
294 Scalar eps_;
295 Scalar pressure_;
296 Scalar saturation_;
297 Scalar temperature_;
298 std::string problemName_;
299 std::shared_ptr<CouplingManager> couplingManager_;
300};
301} // end namespace Dumux
302
303#endif //DUMUX_DARCY_SUBPROBLEM_HH
Properties for all models using cell-centered finite volume scheme with TPFA.
@ 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
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
UndefinedProperty type
Definition: common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
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 formulation of the model.
Definition: common/properties.hh:237
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
Definition: 1p_2p/problem_darcy.hh:79
bool shouldWriteOutput() const
Definition: 1p_2p/problem_darcy.hh:147
const CouplingManager & couplingManager() const
Get the coupling manager.
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:266
bool shouldWriteRestartFile() const
Returns true if a restart file should be written to disk.
Definition: 1p_2p/problem_darcy.hh:139
PrimaryVariables initial(const Element &element) const
Evaluates the initial value for a control volume.
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_darcy.hh:254
DarcySubProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager)
Definition: 1p_2p/problem_darcy.hh:113
PrimaryVariables dirichlet(const Element &element, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: 1p_2p/problem_darcy.hh:195
NumEqVector neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a Neumann control volume.
Definition: 1p_2p/problem_darcy.hh:214
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: 1p_2p/problem_darcy.hh:155
BoundaryTypes boundaryTypes(const Element &element, const SubControlVolumeFace &scvf) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: 1p_2p/problem_darcy.hh:171
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluates the source term for all phases within a given sub control volume.
Definition: 1p_2p/problem_darcy.hh:248
const std::string & name() const
The problem name.
Definition: 1p_2p/problem_darcy.hh:126
Definition: 1p_2p/problem_darcy.hh:44
std::tuple< TwoP, CCTpfaModel > InheritsFrom
Definition: 1p_2p/problem_darcy.hh:44
Dune::YaspGrid< 2 > type
Definition: 1p_2p/problem_darcy.hh:57
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: 1p_2p/problem_darcy.hh:66
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: 1p_2p/problem_darcy.hh:67
The spatial parameters class for the test problem using the 1p cc model.
Definition: multidomain/boundary/stokesdarcy/1p_2p/spatialparams.hh:45
Adaption of the fully implicit scheme to the two-phase flow model.
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.