3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
1p_2p/problem_stokes.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_STOKES_SUBPROBLEM_HH
26#define DUMUX_STOKES_SUBPROBLEM_HH
27
28#include <dune/grid/yaspgrid.hh>
29
33
34namespace Dumux {
35template <class TypeTag>
36class StokesSubProblem;
37
38namespace Properties {
39// Create new type tags
40namespace TTag {
41struct StokesOneP { using InheritsFrom = std::tuple<NavierStokes, StaggeredFreeFlowModel>; };
42} // end namespace TTag
43
44// Set the grid type
45template<class TypeTag>
46struct Grid<TypeTag, TTag::StokesOneP> { using type = Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; };
47
48// Set the problem property
49template<class TypeTag>
50struct Problem<TypeTag, TTag::StokesOneP> { using type = Dumux::StokesSubProblem<TypeTag> ; };
51
52template<class TypeTag>
53struct EnableGridGeometryCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; };
54template<class TypeTag>
55struct EnableGridFluxVariablesCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; };
56template<class TypeTag>
57struct EnableGridVolumeVariablesCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; };
58} // end namespace Properties
59
66template <class TypeTag>
68{
69 using ParentType = NavierStokesProblem<TypeTag>;
70
73
75
77
79
81 using FVElementGeometry = typename GridGeometry::LocalView;
82 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
83 using Element = typename GridView::template Codim<0>::Entity;
84 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
85 using ElementFaceVariables = typename GetPropType<TypeTag, Properties::GridFaceVariables>::LocalView;
86
87 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
88
91
93
94public:
95 StokesSubProblem(std::shared_ptr<const GridGeometry> gridGeometry, std::shared_ptr<CouplingManager> couplingManager)
96 : ParentType(gridGeometry, "Stokes"), eps_(1e-6), couplingManager_(couplingManager)
97 {
98 inletVelocity_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.Velocity");
99 pressure_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.Pressure");
100 temperature_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.Temperature");
101 problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
102 }
103
107 const std::string& name() const
108 {
109 return problemName_;
110 }
111
115 // \{
116
118 { return false; }
119
123 Scalar temperature() const
124 { return temperature_; }
125
131 NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
132 { return NumEqVector(0.0); }
133 // \}
134
138 // \{
139
147 BoundaryTypes boundaryTypes(const Element& element,
148 const SubControlVolumeFace& scvf) const
149 {
150 BoundaryTypes values;
151
152 if(couplingManager().isCoupledEntity(CouplingManager::stokesIdx, scvf))
153 {
154 values.setCouplingNeumann(Indices::conti0EqIdx);
155 values.setCouplingNeumann(Indices::momentumYBalanceIdx);
156 values.setBJS(Indices::momentumXBalanceIdx);
157 }
158 else
159 {
160 values.setDirichlet(Indices::velocityXIdx);
161 values.setDirichlet(Indices::velocityYIdx);
162 }
163
164 return values;
165 }
166
170 PrimaryVariables dirichletAtPos(const GlobalPosition& pos) const
171 {
172 PrimaryVariables values(0.0);
173 values = initialAtPos(pos);
174
175 return values;
176 }
177
189 NumEqVector neumann(const Element& element,
190 const FVElementGeometry& fvGeometry,
191 const ElementVolumeVariables& elemVolVars,
192 const ElementFaceVariables& elemFaceVars,
193 const SubControlVolumeFace& scvf) const
194 {
195 NumEqVector values(0.0);
196
197 if(couplingManager().isCoupledEntity(CouplingManager::stokesIdx, scvf))
198 {
199 values[Indices::conti0EqIdx] = couplingManager().couplingData().massCouplingCondition(element, fvGeometry, elemVolVars, elemFaceVars, scvf);
200 values[Indices::momentumYBalanceIdx] = couplingManager().couplingData().momentumCouplingCondition(element, fvGeometry, elemVolVars, elemFaceVars, scvf);
201 }
202 return values;
203 }
204
205 // \}
206
210 const CouplingManager& couplingManager() const
211 { return *couplingManager_; }
212
216 // \{
217
223 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
224 {
225 PrimaryVariables values(0.0);
226
227 values[Indices::pressureIdx] = pressure_;
228 values[Indices::velocityYIdx] = 4.0 * inletVelocity_ * globalPos[0] * (this->gridGeometry().bBoxMax()[0] - globalPos[0])
229 / (this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0])
230 / (this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0]);
231 return values;
232 }
233
238 Scalar permeability(const Element& element, const SubControlVolumeFace& scvf) const
239 {
240 return couplingManager().couplingData().darcyPermeability(element, scvf);
241 }
242
247 Scalar alphaBJ(const SubControlVolumeFace& scvf) const
248 {
249 return 1.0;
250 }
251
252 // \}
253
254private:
255 bool onLeftBoundary_(const GlobalPosition &globalPos) const
256 { return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_; }
257
258 bool onRightBoundary_(const GlobalPosition &globalPos) const
259 { return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_; }
260
261 bool onLowerBoundary_(const GlobalPosition &globalPos) const
262 { return globalPos[1] < this->gridGeometry().bBoxMin()[1] + eps_; }
263
264 bool onUpperBoundary_(const GlobalPosition &globalPos) const
265 { return globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_; }
266
267 Scalar eps_;
268 Scalar inletVelocity_;
269 Scalar pressure_;
270 Scalar temperature_;
271 std::string problemName_;
272 std::shared_ptr<CouplingManager> couplingManager_;
273};
274} // end namespace Dumux
275
276#endif // DUMUX_STOKES_SUBPROBLEM_HH
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
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
Definition: common/properties.hh:169
Navier-Stokes problem base class.
Definition: dumux/freeflow/navierstokes/problem.hh:63
Test problem for the 1pnc (Navier-) Stokes problem.
Definition: 1p_2p/problem_stokes.hh:68
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: 1p_2p/problem_stokes.hh:123
bool shouldWriteRestartFile() const
Definition: 1p_2p/problem_stokes.hh:117
PrimaryVariables dirichletAtPos(const GlobalPosition &pos) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: 1p_2p/problem_stokes.hh:170
Scalar alphaBJ(const SubControlVolumeFace &scvf) const
Returns the alpha value required as input parameter for the Beavers-Joseph-Saffman boundary condition...
Definition: 1p_2p/problem_stokes.hh:247
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_stokes.hh:147
const CouplingManager & couplingManager() const
Get the coupling manager.
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_stokes.hh:254
StokesSubProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager)
Definition: 1p_2p/problem_stokes.hh:95
NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
Returns the sources within the domain.
Definition: 1p_2p/problem_stokes.hh:131
NumEqVector neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a Neumann control volume.
Definition: 1p_2p/problem_stokes.hh:189
const std::string & name() const
The problem name.
Definition: 1p_2p/problem_stokes.hh:107
Scalar permeability(const Element &element, const SubControlVolumeFace &scvf) const
Returns the intrinsic permeability of required as input parameter for the Beavers-Joseph-Saffman boun...
Definition: 1p_2p/problem_stokes.hh:238
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: 1p2c_1p2c/diffusionlawcomparison/problem_stokes.hh:267
Definition: 1p_1p/problem_stokes.hh:44
std::tuple< NavierStokes, StaggeredFreeFlowModel > InheritsFrom
Definition: 1p_1p/problem_stokes.hh:44
Dune::YaspGrid< 2, Dune::EquidistantOffsetCoordinates< GetPropType< TypeTag, Properties::Scalar >, 2 > > type
Definition: 1p_1p/problem_stokes.hh:57
Defines a type tag and some properties for ree-flow models using the staggered scheme....
A single-phase, isothermal Navier-Stokes model.