3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Loading...
Searching...
No Matches
test/porousmediumflow/1p/implicit/incompressible/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 *****************************************************************************/
24
25#ifndef DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH
26#define DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH
27
28#if HAVE_UG
29#include <dune/grid/uggrid.hh>
30#endif
31#include <dune/grid/yaspgrid.hh>
32
33#include <dumux/common/quad.hh>
37
41
44
45#include "spatialparams.hh"
46
47#ifndef GRIDTYPE // default to yasp grid if not provided by CMake
48#define GRIDTYPE Dune::YaspGrid<2>
49#endif
50
51namespace Dumux {
52// forward declarations
53template<class TypeTag> class OnePTestProblem;
54
55namespace Properties {
56// Create new type tags
57namespace TTag {
58struct OnePIncompressible { using InheritsFrom = std::tuple<OneP>; };
59struct OnePIncompressibleTpfa { using InheritsFrom = std::tuple<OnePIncompressible, CCTpfaModel>; };
60struct OnePIncompressibleMpfa { using InheritsFrom = std::tuple<OnePIncompressible, CCMpfaModel>; };
61struct OnePIncompressibleBox { using InheritsFrom = std::tuple<OnePIncompressible, BoxModel>; };
62} // end namespace TTag
63
64// Set the grid type
65template<class TypeTag>
66struct Grid<TypeTag, TTag::OnePIncompressible> { using type = GRIDTYPE; };
67
68// Set the problem type
69template<class TypeTag>
70struct Problem<TypeTag, TTag::OnePIncompressible> { using type = OnePTestProblem<TypeTag>; };
71
72// set the spatial params
73template<class TypeTag>
74struct SpatialParams<TypeTag, TTag::OnePIncompressible>
75{
79};
80
81// use the incompressible local residual (provides analytic jacobian)
82template<class TypeTag>
83struct LocalResidual<TypeTag, TTag::OnePIncompressible> { using type = OnePIncompressibleLocalResidual<TypeTag>; };
84
85// the fluid system
86template<class TypeTag>
87struct FluidSystem<TypeTag, TTag::OnePIncompressible>
88{
91};
92
93// Enable caching
94template<class TypeTag>
95struct EnableGridVolumeVariablesCache<TypeTag, TTag::OnePIncompressible> { static constexpr bool value = false; };
96template<class TypeTag>
97struct EnableGridFluxVariablesCache<TypeTag, TTag::OnePIncompressible> { static constexpr bool value = false; };
98template<class TypeTag>
99struct EnableGridGeometryCache<TypeTag, TTag::OnePIncompressible> { static constexpr bool value = false; };
100
101// define a TypeTag for a quad precision test
102#if HAVE_QUAD
103namespace TTag {
104struct OnePIncompressibleTpfaQuad { using InheritsFrom = std::tuple<OnePIncompressibleTpfa>; };
105} // end namespace TTag
106template<class TypeTag>
107struct Scalar<TypeTag, TTag::OnePIncompressibleTpfaQuad> { using type = Quad; };
108#endif
109} // end namespace Properties
110
115template<class TypeTag>
116class OnePTestProblem : public PorousMediumFlowProblem<TypeTag>
117{
118 using ParentType = PorousMediumFlowProblem<TypeTag>;
120 using Element = typename GridView::template Codim<0>::Entity;
126 static constexpr int dimWorld = GridView::dimensionworld;
127 using GlobalPosition = Dune::FieldVector<Scalar,dimWorld>;
128
129public:
130 OnePTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
131 : ParentType(gridGeometry), velocity_(0.0)
132 {
133 extrusionFactor_ = getParam<Scalar>("Problem.ExtrusionFactor");
134 Scalar permeability = getParam<Scalar>("SpatialParams.Permeability");
135 dp_dy_ = -1.0e+5;
136
137 const bool checkIsConstantVelocity = getParam<bool>("Problem.CheckIsConstantVelocity", false);
138 if(checkIsConstantVelocity)
139 {
140 velocity_[dimWorld-1] = -permeability * dp_dy_;
141 velocity_[dimWorld-1] /= FluidSystem::viscosity(temperature(), 1.0e5);
142 }
143 }
144
151 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
152 {
153 BoundaryTypes values;
154
155 Scalar eps = 1.0e-6;
156 if (globalPos[dimWorld-1] < eps || globalPos[dimWorld-1] > this->gridGeometry().bBoxMax()[dimWorld-1] - eps)
157 values.setAllDirichlet();
158 else
159 values.setAllNeumann();
160
161 return values;
162 }
163
171 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
172 {
173 PrimaryVariables values(0);
174 values[0] = 1.0e+5 + dp_dy_*(globalPos[dimWorld-1] - this->gridGeometry().bBoxMax()[dimWorld-1]);
175
176 return values;
177 }
178
186 Scalar temperature() const
187 {
188 return 283.15; // 10°C
189 }
190
197 Scalar extrusionFactorAtPos(const GlobalPosition &globalPos) const
198 {
199 return extrusionFactor_;
200 }
201
208 const GlobalPosition velocity() const
209 {
210 return velocity_;
211 }
212
213private:
214 Scalar extrusionFactor_;
215 Scalar dp_dy_;
216 GlobalPosition velocity_;
217};
218
219} // end namespace Dumux
220
221#endif
This file provides the infrastructure to use quad-precision floating point values in the numerical mo...
Defines a type tag and some properties for models using the box scheme.
Properties for all models using cell-centered finite volume scheme with mpfa.
Properties for all models using cell-centered finite volume scheme with TPFA.
A much simpler (and thus potentially less buggy) version of pure water.
A liquid phase consisting of a single component.
T getParam(Args &&... args)
A free function to get a parameter from the parameter tree singleton.
Definition parameters.hh:428
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
Type tag for numeric models.
Definition grid.hh:35
const GridGeometry & gridGeometry() const
Definition common/fvproblem.hh:588
UndefinedProperty type
Definition common/properties.hh:53
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:91
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 spatial parameters object.
Definition common/properties.hh:221
The type of the fluid system to use.
Definition common/properties.hh:223
A liquid phase consisting of a single component.
Definition 1pliquid.hh:46
Element-wise calculation of the residual and its derivatives for a single-phase, incompressible,...
Definition 1p/incompressiblelocalresidual.hh:41
Base class for all fully implicit porous media problems.
Definition dumux/porousmediumflow/problem.hh:39
PorousMediumFlowProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< SpatialParams > spatialParams, const std::string &paramGroup="")
Constructor, passing the spatial parameters.
Definition dumux/porousmediumflow/problem.hh:67
Multidomain test problem for the incompressible one-phase model.
Definition test/multidomain/boundary/darcydarcy/1p_1p/problem.hh:45
const GlobalPosition velocity() const
Returns the velocity.
Definition test/porousmediumflow/1p/implicit/incompressible/problem.hh:208
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition test/porousmediumflow/1p/implicit/incompressible/problem.hh:171
OnePTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition test/porousmediumflow/1p/implicit/incompressible/problem.hh:130
Scalar extrusionFactorAtPos(const GlobalPosition &globalPos) const
Returns how much the domain is extruded at a given position.
Definition test/porousmediumflow/1p/implicit/incompressible/problem.hh:197
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/porousmediumflow/1p/implicit/incompressible/problem.hh:151
Scalar temperature() const
Returns the temperature for an isothermal problem.
Definition test/multidomain/boundary/darcydarcy/1p_1p/problem.hh:157
The spatial parameters class for the test problem using the incompressible 1p model.
Definition multidomain/boundary/darcydarcy/1p_1p/spatialparams.hh:62
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:52
std::tuple< OneP > InheritsFrom
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:52
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:53
std::tuple< OnePIncompressible, CCTpfaModel > InheritsFrom
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:53
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:54
std::tuple< OnePIncompressible, CCMpfaModel > InheritsFrom
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:54
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:55
std::tuple< OnePIncompressible, BoxModel > InheritsFrom
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:55
Dune::YaspGrid< 2 > type
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:60
OnePTestProblem< TypeTag > type
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:64
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:71
OnePTestSpatialParams< GridGeometry, Scalar > type
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:72
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:70
OnePIncompressibleLocalResidual< TypeTag > type
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:77
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:83
FluidSystems::OnePLiquid< Scalar, Components::Constant< 0, Scalar > > type
Definition test/porousmediumflow/1p/implicit/convergence/problem.hh:84
static constexpr bool value
Definition test/porousmediumflow/1p/implicit/incompressible/problem.hh:95
static constexpr bool value
Definition test/porousmediumflow/1p/implicit/incompressible/problem.hh:97
static constexpr bool value
Definition test/porousmediumflow/1p/implicit/incompressible/problem.hh:99
A single-phase, isothermal flow model using the fully implicit scheme.
Base class for all porous media problems.
#define GRIDTYPE
Definition test/porousmediumflow/1p/implicit/incompressible/problem.hh:48
Element-wise calculation of the residual and its derivatives for a single-phase, incompressible,...
The spatial params the incompressible test.