3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/freeflow/navierstokes/channel/3d/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 *****************************************************************************/
28#ifndef DUMUX_3D_CHANNEL_PROBLEM_HH
29#define DUMUX_3D_CHANNEL_PROBLEM_HH
30
31#include <dune/grid/yaspgrid.hh>
32
35
39#include <dune/common/float_cmp.hh>
40
41#ifndef DIM_3D
42#define DIM_3D 0
43#endif
44
45namespace Dumux {
46
47template <class TypeTag>
48class ThreeDChannelTestProblem;
49
50namespace Properties {
51// Create new type tags
52namespace TTag {
53struct ThreeDChannelTest { using InheritsFrom = std::tuple<NavierStokes, StaggeredFreeFlowModel>; };
54} // end namespace TTag
55
56// the fluid system
57template<class TypeTag>
58struct FluidSystem<TypeTag, TTag::ThreeDChannelTest>
59{
62};
63
64// Set the grid type
65#if DIM_3D
66template<class TypeTag>
67struct Grid<TypeTag, TTag::ThreeDChannelTest> { using type = Dune::YaspGrid<3>; };
68#else
69template<class TypeTag>
70struct Grid<TypeTag, TTag::ThreeDChannelTest> { using type = Dune::YaspGrid<2>; };
71#endif
72
73// Set the problem property
74template<class TypeTag>
75struct Problem<TypeTag, TTag::ThreeDChannelTest> { using type = ThreeDChannelTestProblem<TypeTag> ; };
76
77template<class TypeTag>
78struct EnableGridGeometryCache<TypeTag, TTag::ThreeDChannelTest> { static constexpr bool value = true; };
79template<class TypeTag>
80struct EnableGridFluxVariablesCache<TypeTag, TTag::ThreeDChannelTest> { static constexpr bool value = true; };
81template<class TypeTag>
82struct EnableGridVolumeVariablesCache<TypeTag, TTag::ThreeDChannelTest> { static constexpr bool value = true; };
83} // end namespace Properties
84
96template <class TypeTag>
98{
99 using ParentType = NavierStokesProblem<TypeTag>;
100
103
106 using Element = typename GridView::template Codim<0>::Entity;
107
109 using FVElementGeometry = typename GridGeometry::LocalView;
110 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
111 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
112
113 static constexpr int dim = GridView::dimension;
114 static constexpr int dimWorld = GridView::dimensionworld;
115 using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
116
117 using CellCenterPrimaryVariables = GetPropType<TypeTag, Properties::CellCenterPrimaryVariables>;
119
122
123 static constexpr bool enablePseudoThreeDWallFriction = !DIM_3D;
124
125public:
126 ThreeDChannelTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
127 : ParentType(gridGeometry), eps_(1e-6)
128 {
129 deltaP_ = getParam<Scalar>("Problem.DeltaP");
130 height_ = getParam<Scalar>("Problem.Height");
131 rho_ = getParam<Scalar>("Component.LiquidDensity");
132 nu_ = getParam<Scalar>("Component.LiquidKinematicViscosity");
133
134 if(dim == 3 && !Dune::FloatCmp::eq(height_, this->gridGeometry().bBoxMax()[2]))
135 DUNE_THROW(Dune::InvalidStateException, "z-dimension must equal height");
136
137 if(enablePseudoThreeDWallFriction)
138 extrusionFactor_ = 2.0/3.0 * height_;
139 else
140 extrusionFactor_ = 1.0;
141 }
142
146 // \{
147
153 Scalar temperature() const
154 { return 273.15 + 10; } // 10C
155
156
161 using ParentType::source;
162 template<class ElementVolumeVariables, class ElementFaceVariables>
163 NumEqVector source(const Element &element,
164 const FVElementGeometry& fvGeometry,
165 const ElementVolumeVariables& elemVolVars,
166 const ElementFaceVariables& elemFaceVars,
167 const SubControlVolumeFace &scvf) const
168 {
169 auto source = NumEqVector(0.0);
170
171#if !DIM_3D
172 static const Scalar height = getParam<Scalar>("Problem.Height");
173 static const Scalar factor = getParam<Scalar>("Problem.PseudoWallFractionFactor", 8.0);
174 source[scvf.directionIndex()] = this->pseudo3DWallFriction(scvf, elemVolVars, elemFaceVars, height, factor);
175#endif
176
177 return source;
178 }
179
180 Scalar extrusionFactorAtPos(const GlobalPosition& pos) const
181 { return extrusionFactor_; }
182
183
184 // \}
188 // \{
189
196 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
197 {
198 BoundaryTypes values;
199
200 // set a fixed pressure at the inlet and outlet
201 if (isOutlet_(globalPos) || isInlet_(globalPos))
202 values.setDirichlet(Indices::pressureIdx);
203 else
204 {
205 values.setDirichlet(Indices::velocityXIdx);
206 values.setDirichlet(Indices::velocityYIdx);
207 if(dim == 3)
208 values.setDirichlet(Indices::velocityZIdx);
209 }
210
211 return values;
212 }
213
219 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
220 {
221 PrimaryVariables values(0.0);
222
223 if(isInlet_(globalPos))
224 values[Indices::pressureIdx] = 1e5 + deltaP_;
225
226 if(isOutlet_(globalPos))
227 values[Indices::pressureIdx] = 1e5;
228
229 return values;
230 }
231
232 // \}
233
239 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
240 {
241 PrimaryVariables values(0.0);
242 return values;
243 }
244
246 Scalar analyticalFlux() const
247 {
248 const Scalar h = height_;
249 const Scalar w = this->gridGeometry().bBoxMax()[1];
250 const Scalar L = this->gridGeometry().bBoxMax()[0];
251
252 const Scalar mu = nu_*rho_;
253
254 return h*h*h * w * deltaP_ / (12*mu*L) * (1.0 - 0.630 * h/w);
255 }
256
257private:
258
259 bool isInlet_(const GlobalPosition& globalPos) const
260 {
261 return globalPos[0] < eps_;
262 }
263
264 bool isOutlet_(const GlobalPosition& globalPos) const
265 {
266 return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_;
267 }
268
269 Scalar eps_;
270 Scalar deltaP_;
271 Scalar extrusionFactor_;
272 Scalar height_;
273 Scalar rho_;
274 Scalar nu_;
275};
276} // end namespace Dumux
277
278#endif
Setting constant fluid properties via the input file.
A liquid phase consisting of a single component.
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
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
Definition: common/properties.hh:169
If disabled, the volume variables are not stored (reduces memory, but is slower)
Definition: common/properties.hh:178
specifies if data on flux vars should be saved (faster, but more memory consuming)
Definition: common/properties.hh:188
The type of the fluid system to use.
Definition: common/properties.hh:223
Navier-Stokes problem base class.
Definition: dumux/freeflow/navierstokes/problem.hh:63
Scalar pseudo3DWallFriction(const Scalar velocity, const Scalar viscosity, const Scalar height, const Scalar factor=8.0) const
An additional drag term can be included as source term for the momentum balance to mimic 3D flow beha...
Definition: dumux/freeflow/navierstokes/problem.hh:167
A liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
Test problem for the one-phase (Navier-) Stokes model in a 3D or pseudo 3D channel.
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:98
Scalar analyticalFlux() const
Returns the analytical solution for the flux through the rectangular channel.
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:246
Scalar extrusionFactorAtPos(const GlobalPosition &pos) const
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:180
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary cont...
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:196
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:219
ThreeDChannelTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:126
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:239
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolumeFace &scvf) const
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:163
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:153
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:53
std::tuple< NavierStokes, StaggeredFreeFlowModel > InheritsFrom
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:53
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:60
Dune::YaspGrid< 2 > type
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:70
Defines a type tag and some properties for ree-flow models using the staggered scheme....
A single-phase, isothermal Navier-Stokes model.
#define DIM_3D
Definition: test/freeflow/navierstokes/channel/3d/problem.hh:42