3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/2p/sequential/diffusion/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_DIFFUSIONPROBLEM_2P_HH
25#define DUMUX_DIFFUSIONPROBLEM_2P_HH
26
28#include "properties.hh"
29
30namespace Dumux {
31
38template<class TypeTag>
39class DiffusionProblem2P: public OneModelProblem<TypeTag>
40{
41 using Implementation = GetPropType<TypeTag, Properties::Problem>;
43
45 using Grid = typename GridView::Grid;
47
50
51 // material properties
53
54 using Element = typename GridView::Traits::template Codim<0>::Entity;
55
56 enum
57 {
58 dim = Grid::dimension, dimWorld = Grid::dimensionworld
59 };
60
61 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
62 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
63
64 // private!! copy constructor
66 {}
67
68public:
75 DiffusionProblem2P(TimeManager& timeManager, Grid& grid)
76 : ParentType(timeManager, grid), gravity_(0)
77 {
78 spatialParams_ = std::make_shared<SpatialParams>(asImp_());
79 gravity_ = 0;
80 if (getParam<bool>("Problem.EnableGravity"))
81 gravity_[dim - 1] = -9.81;
82
83 pressModel_ = std::make_shared<PressureModel>(asImp_());
84 }
92 DiffusionProblem2P(TimeManager& timeManager, Grid& grid, SpatialParams& spatialParams)
93 : ParentType(timeManager, grid), gravity_(0)
94 {
95 spatialParams_ = Dune::stackobject_to_shared_ptr<SpatialParams>(spatialParams);
96 gravity_ = 0;
97 if (getParam<bool>("Problem.EnableGravity"))
98 gravity_[dim - 1] = -9.81;
99
100 pressModel_ = std::make_shared<PressureModel>(asImp_());
101 }
102
109 : ParentType(grid, false), gravity_(0)
110 {
111 spatialParams_ = std::make_shared<SpatialParams>(asImp_());
112 gravity_ = 0;
113 if (getParam<bool>("Problem.EnableGravity"))
114 gravity_[dim - 1] = -9.81;
115
116 pressModel_ = std::make_shared<PressureModel>(asImp_());
117 }
124 DiffusionProblem2P(Grid& grid, SpatialParams& spatialParams)
125 : ParentType(grid, false), gravity_(0)
126 {
127 spatialParams_ = Dune::stackobject_to_shared_ptr<SpatialParams>(spatialParams);
128 gravity_ = 0;
129 if (getParam<bool>("Problem.EnableGravity"))
130 gravity_[dim - 1] = -9.81;
131
132 pressModel_ = std::make_shared<PressureModel>(asImp_());
133 }
134
138 // \{
139
146 {
147 //end simulation -> no time dependent problem!
148 this->timeManager().setFinished();
149
150 return;
151 }
152
158 Scalar temperature(const Element& element) const
159 {
160 return this->asImp_().temperatureAtPos(element.geometry().center());
161 }
162
168 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
169 {
170 // Throw an exception (there is no initial condition)
171 DUNE_THROW(Dune::InvalidStateException,
172 "The problem does not provide "
173 "a temperatureAtPos() method.");
174 }
175
181 Scalar referencePressure(const Element& element) const
182 {
183 return this->asImp_().referencePressureAtPos(element.geometry().center());
184 }
185
191 Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
192 {
193 // Throw an exception (there is no initial condition)
194 DUNE_THROW(Dune::InvalidStateException,
195 "The problem does not provide "
196 "a referencePressureAtPos() method.");
197 }
198
205 const GravityVector &gravity() const
206 {
207 return gravity_;
208 }
209
213 SpatialParams &spatialParams()
214 {
215 return *spatialParams_;
216 }
217
221 const SpatialParams &spatialParams() const
222 {
223 return *spatialParams_;
224 }
225
229 PressureModel &pressureModel()
230 { return *pressModel_; }
231
233 const PressureModel &pressureModel() const
234 { return *pressModel_; }
235
236 // \}
237
238private:
240 Implementation &asImp_()
241 { return *static_cast<Implementation *>(this); }
242
244 const Implementation &asImp_() const
245 { return *static_cast<const Implementation *>(this); }
246
247 GravityVector gravity_;
248
249 // fluids and material properties
250 std::shared_ptr<SpatialParams> spatialParams_;
251 bool newSpatialParams_;
252 std::shared_ptr<PressureModel> pressModel_;
253};
254
255} // end namespace Dumux
256
257#endif
Base class for definition of an sequential diffusion (pressure) or transport problem.
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
Base class for stationary solution of a two-phase diffusion/pressure equation.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:40
void timeIntegration()
Time integration function called by the time manager.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:145
DiffusionProblem2P(Grid &grid)
Constructs a DiffusionProblem2P object.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:108
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:205
PressureModel & pressureModel()
Returns the pressure model used for the problem.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:229
Scalar referencePressure(const Element &element) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:181
const PressureModel & pressureModel() const
Returns the pressure model used for the problem. // TODO doc me!
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:233
DiffusionProblem2P(TimeManager &timeManager, Grid &grid)
Constructs a DiffusionProblem2P object.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:75
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:168
DiffusionProblem2P(Grid &grid, SpatialParams &spatialParams)
Constructs a DiffusionProblem2P object.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:124
Scalar referencePressureAtPos(const GlobalPosition &globalPos) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:191
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:213
DiffusionProblem2P(TimeManager &timeManager, Grid &grid, SpatialParams &spatialParams)
Constructs a DiffusionProblem2P object.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:92
Scalar temperature(const Element &element) const
Returns the temperature within the domain.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:158
const SpatialParams & spatialParams() const
Returns the spatial parameters object.
Definition: porousmediumflow/2p/sequential/diffusion/problem.hh:221
Base class for definition of an sequential diffusion (pressure) or transport problem.
Definition: onemodelproblem.hh:46
TimeManager & timeManager()
Returns TimeManager object used by the simulation.
Definition: onemodelproblem.hh:551
Base file for properties related to sequential models.