3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
dumux/porousmediumflow/2p/sequential/impes/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#ifndef DUMUX_IMPESPROBLEM_2P_HH
25#define DUMUX_IMPESPROBLEM_2P_HH
26
29#include "properties.hh"
30#include "propertiesadaptive.hh"
31
32namespace Dumux {
39template<class TypeTag>
40class IMPESProblem2P : public IMPETProblem<TypeTag>
41{
42 using Implementation = typename GET_PROP_TYPE(TypeTag, Problem);
44
45 using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager);
46
47 using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
48 using Grid = typename GridView::Grid;
49 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
50
51 // material properties
52 using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
53
54
55 enum {
56 dim = Grid::dimension,
57 dimWorld = Grid::dimensionworld
58 };
59
60 using Element = typename GridView::Traits::template Codim<0>::Entity;
61
62 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
63 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
64
65 //Copy constructor
67 {}
68
69public:
76 IMPESProblem2P(TimeManager& timeManager, Grid& grid)
77 : IMPESProblem2P(timeManager, grid, grid.leafGridView())
78 {}
79
80 IMPESProblem2P(TimeManager& timeManager, Grid& grid, const GridView& gridView)
81 : ParentType(timeManager, grid, gridView), gravity_(0)
82 {
83 spatialParams_ = std::make_shared<SpatialParams>(asImp_());
84
85 gravity_ = 0;
86 if (getParam<bool>("Problem.EnableGravity"))
87 gravity_[dim - 1] = - 9.81;
88 }
96 IMPESProblem2P(TimeManager& timeManager, Grid& grid, SpatialParams& spatialParams)
98 gravity_(0)
99 {
100 spatialParams_ = Dune::stackobject_to_shared_ptr<SpatialParams>(spatialParams);
101 gravity_ = 0;
102 if (getParam<bool>("Problem.EnableGravity"))
103 gravity_[dim - 1] = - 9.81;
104 }
105
109 // \{
110
117 Scalar temperature(const Element& element) const
118 {
119 return asImp_().temperatureAtPos(element.geometry().center());
120 }
121
128 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
129 {
130 // Throw an exception (there is no initial condition)
131 DUNE_THROW(Dune::InvalidStateException,
132 "The problem does not provide "
133 "a temperatureAtPos() method.");
134 }
135
142 Scalar referencePressure(const Element& element) const
143 {
144 return asImp_().referencePressureAtPos(element.geometry().center());
145 }
146
153 Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
154 {
155 // Throw an exception (there is no initial condition)
156 DUNE_THROW(Dune::InvalidStateException,
157 "The problem does not provide "
158 "a referencePressureAtPos() method.");
159 }
160
167 const GravityVector &gravity() const
168 { return gravity_; }
169
173 SpatialParams &spatialParams()
174 { return *spatialParams_; }
175
179 const SpatialParams &spatialParams() const
180 { return *spatialParams_; }
181
182 // \}
183
184private:
186 Implementation &asImp_()
187 { return *static_cast<Implementation *>(this); }
188
190 const Implementation &asImp_() const
191 { return *static_cast<const Implementation *>(this); }
192
193 GravityVector gravity_;
194
195 // fluids and material properties
196 std::shared_ptr<SpatialParams> spatialParams_;
197};
198
199} // end namespace Dumux
200
201#endif
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
Properties for adaptive implementations of the sequential IMPES algorithms.
IMPET scheme.
Base class for defining an instance of the diffusion problem.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Base class for all 2-phase problems which use an IMPES algorithm.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:41
Scalar temperature(const Element &element) const
Returns the temperature within the domain.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:117
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:128
IMPESProblem2P(TimeManager &timeManager, Grid &grid, const GridView &gridView)
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:80
const SpatialParams & spatialParams() const
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:179
Scalar referencePressure(const Element &element) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:142
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:167
Scalar referencePressureAtPos(const GlobalPosition &globalPos) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:153
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:173
IMPESProblem2P(TimeManager &timeManager, Grid &grid)
Constructs an IMPESProblem2P object.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:76
IMPESProblem2P(TimeManager &timeManager, Grid &grid, SpatialParams &spatialParams)
Constructs an IMPESProblem2P object.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:96
base class for problems using a sequential implicit-explicit strategy
Definition: impetproblem.hh:46
const GridView & gridView() const
The GridView which used by the problem.
Definition: impetproblem.hh:573
TimeManager & timeManager()
Returns TimeManager object used by the simulation.
Definition: impetproblem.hh:663
Grid & grid()
Returns the current grid which used by the problem.
Definition: impetproblem.hh:581
Base file for properties related to sequential models.