3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/freeflow/navierstokes/closedsystem/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 *****************************************************************************/
25#ifndef DUMUX_CLOSEDSYSTEM_TEST_PROBLEM_HH
26#define DUMUX_CLOSEDSYSTEM_TEST_PROBLEM_HH
27
28#include <dune/grid/yaspgrid.hh>
29
32
36
37namespace Dumux {
38template <class TypeTag>
39class ClosedSystemTestProblem;
40
41namespace Properties {
42// Create new type tags
43namespace TTag {
44struct ClosedSystemTest { using InheritsFrom = std::tuple<NavierStokes, StaggeredFreeFlowModel>; };
45} // end namespace TTag
46
47// the fluid system
48template<class TypeTag>
49struct FluidSystem<TypeTag, TTag::ClosedSystemTest>
50{
53};
54
55// Set the grid type
56template<class TypeTag>
57struct Grid<TypeTag, TTag::ClosedSystemTest> { using type = Dune::YaspGrid<2>; };
58
59// Set the problem property
60template<class TypeTag>
61struct Problem<TypeTag, TTag::ClosedSystemTest> { using type = Dumux::ClosedSystemTestProblem<TypeTag> ; };
62
63template<class TypeTag>
64struct EnableGridGeometryCache<TypeTag, TTag::ClosedSystemTest> { static constexpr bool value = true; };
65
66template<class TypeTag>
67struct EnableGridFluxVariablesCache<TypeTag, TTag::ClosedSystemTest> { static constexpr bool value = true; };
68template<class TypeTag>
69struct EnableGridVolumeVariablesCache<TypeTag, TTag::ClosedSystemTest> { static constexpr bool value = true; };
70} // end namespace Properties
71
81template <class TypeTag>
83{
84 using ParentType = NavierStokesProblem<TypeTag>;
85
88 using FVElementGeometry = typename GridGeometry::LocalView;
89 using SubControlVolume = typename GridGeometry::SubControlVolume;
94
96 using Element = typename GridGeometry::GridView::template Codim<0>::Entity;
97 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
98
99public:
100 ClosedSystemTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
101 : ParentType(gridGeometry), eps_(1e-6)
102 {
103 lidVelocity_ = getParam<Scalar>("Problem.LidVelocity");
104 }
105
109 // \{
110
111
113 {
114 return false;
115 }
116
122 Scalar temperature() const
123 { return 273.15 + 10; } // 10C
124
130 NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
131 {
132 return NumEqVector(0.0);
133 }
134 // \}
138 // \{
139
146 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
147 {
148 BoundaryTypes values;
149
150 // set Dirichlet values for the velocity everywhere
151 values.setDirichlet(Indices::velocityXIdx);
152 values.setDirichlet(Indices::velocityYIdx);
153
154 return values;
155 }
156
165 bool isDirichletCell(const Element& element,
166 const FVElementGeometry& fvGeometry,
167 const SubControlVolume& scv,
168 int pvIdx) const
169 {
170 auto isLowerLeftCell = [&](const SubControlVolume& scv)
171 { return scv.dofIndex() == 0; };
172
173 // set a fixed pressure in one cell
174 return (isLowerLeftCell(scv) && pvIdx == Indices::pressureIdx);
175 }
176
182 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
183 {
184 PrimaryVariables values;
185 values[Indices::pressureIdx] = 1.1e+5;
186 values[Indices::velocityXIdx] = 0.0;
187 values[Indices::velocityYIdx] = 0.0;
188
189 if(globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_)
190 values[Indices::velocityXIdx] = lidVelocity_;
191
192 return values;
193 }
194
200 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
201 {
202 PrimaryVariables values;
203 values[Indices::pressureIdx] = 1.0e+5;
204 values[Indices::velocityXIdx] = 0.0;
205 values[Indices::velocityYIdx] = 0.0;
206
207 return values;
208 }
209
210 // \}
211
212private:
213
214 Scalar eps_;
215 Scalar lidVelocity_;
216};
217} // end namespace Dumux
218
219#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
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
A liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
Test problem for the one-phase (Navier-) Stokes model.
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:83
NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
Returns the sources within the domain.
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:130
bool isDirichletCell(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolume &scv, int pvIdx) const
Returns whether a fixed Dirichlet value shall be used at a given cell.
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:165
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/closedsystem/problem.hh:146
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:200
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Returns Dirichlet boundary values at a given position.
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:182
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:122
ClosedSystemTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:100
bool shouldWriteRestartFile() const
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:112
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:44
std::tuple< NavierStokes, StaggeredFreeFlowModel > InheritsFrom
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:44
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:51
Dune::YaspGrid< 2 > type
Definition: test/freeflow/navierstokes/closedsystem/problem.hh:57
Defines a type tag and some properties for ree-flow models using the staggered scheme....
A single-phase, isothermal Navier-Stokes model.