3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
dumux/porousmediumflow/1p/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 *****************************************************************************/
25#ifndef DUMUX_DIFFUSIONPROBLEM_1P_HH
26#define DUMUX_DIFFUSIONPROBLEM_1P_HH
27
32
33namespace Dumux {
34namespace Properties {
35SET_TYPE_PROP(PressureOneP, Model, typename GET_PROP_TYPE(TypeTag, PressureModel));
36}
43template<class TypeTag>
44class DiffusionProblem1P: public OneModelProblem<TypeTag>
45{
46 using Implementation = typename GET_PROP_TYPE(TypeTag, Problem);
48
49 using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
50 using Grid = typename GridView::Grid;
51 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
52
53 using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager);
54
55 // material properties
56 using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
57
58 using Element = typename GridView::Traits::template Codim<0>::Entity;
59
60 enum
61 {
62 dim = Grid::dimension, dimWorld = Grid::dimensionworld
63 };
64
65 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
66 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
67
68public:
75 DiffusionProblem1P(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
91 DiffusionProblem1P(TimeManager& timeManager, Grid& grid, SpatialParams &spatialParams)
92 : ParentType(timeManager, grid), gravity_(0)
93 {
94 spatialParams_ = Dune::stackobject_to_shared_ptr<SpatialParams>(spatialParams);
95 gravity_ = 0;
96 if (getParam<bool>("Problem.EnableGravity"))
97 gravity_[dim - 1] = -9.81;
98 }
99
106 : ParentType(grid, false), gravity_(0)
107 {
108 spatialParams_ = std::make_shared<SpatialParams>(asImp_());
109 gravity_ = 0;
110 if (getParam<bool>("Problem.EnableGravity"))
111 gravity_[dim - 1] = -9.81;
112 }
113
120 DiffusionProblem1P(Grid& grid, SpatialParams& spatialParams)
121 : ParentType(grid, false), gravity_(0)
122 {
123 spatialParams_ = Dune::stackobject_to_shared_ptr<SpatialParams>(spatialParams);
124 gravity_ = 0;
125 if (getParam<bool>("Problem.EnableGravity"))
126 gravity_[dim - 1] = -9.81;
127 }
128
132 // \{
133
135 void timeIntegration()
136 {
137 // end simulation -> no time dependent problem!
138 this->timeManager().setFinished();
139
140 return;
141 }
142
143 void serialize()
144 {
145 return;
146 }
147
148 void deserialize(double t)
149 {
150 return;
151 }
153
159 Scalar temperature(const Element& element) const
160 {
161 return asImp_().temperatureAtPos(element.geometry().center());
162 }
163
169 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
170 {
171 // Throw an exception (there is no initial condition)
172 DUNE_THROW(Dune::InvalidStateException,
173 "The problem does not provide "
174 "a temperatureAtPos() method.");
175 }
176
182 Scalar referencePressure(const Element& element) const
183 {
184 return asImp_().referencePressureAtPos(element.geometry().center());
185 }
186
192 Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
193 {
194 // Throw an exception (there is no initial condition)
195 DUNE_THROW(Dune::InvalidStateException,
196 "The problem does not provide "
197 "a referencePressureAtPos() method.");
198 }
199
206 const GravityVector &gravity() const
207 {
208 return gravity_;
209 }
210
214 SpatialParams &spatialParams()
215 {
216 return *spatialParams_;
217 }
218
222 const SpatialParams &spatialParams() const
223 {
224 return *spatialParams_;
225 }
226
227 // \}
228
229private:
231 Implementation &asImp_()
232 { return *static_cast<Implementation *>(this); }
233
235 const Implementation &asImp_() const
236 { return *static_cast<const Implementation *>(this); }
237
238 GravityVector gravity_;
239
240 // fluids and material properties
241 std::shared_ptr<SpatialParams> spatialParams_;
242};
243
244} // end namespace Dumux
245
246#endif
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
Base class for definition of an sequential diffusion (pressure) or transport problem.
Base class holding the variables for sequential models.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag Model
The type of the mode.
Definition: porousmediumflow/sequential/properties.hh:62
SET_TYPE_PROP(FVPressureOneP, Velocity, FVVelocity1P< TypeTag >)
Set velocity reconstruction implementation standard cell centered finite volume schemes as default.
Property tag PressureModel
The type of the discretization of a pressure model.
Definition: porousmediumflow/sequential/properties.hh:65
Base class for all single phase diffusion problems.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:45
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:206
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:169
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:214
Scalar referencePressure(const Element &element) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:182
Scalar temperature(const Element &element) const
Returns the temperature within the domain.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:159
DiffusionProblem1P(Grid &grid, SpatialParams &spatialParams)
The constructor.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:120
Scalar referencePressureAtPos(const GlobalPosition &globalPos) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:192
DiffusionProblem1P(TimeManager &timeManager, Grid &grid)
Constructs a DiffusionProblem1P object.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:75
const SpatialParams & spatialParams() const
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:222
DiffusionProblem1P(Grid &grid)
The constructor.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:105
DiffusionProblem1P(TimeManager &timeManager, Grid &grid, SpatialParams &spatialParams)
Constructs a DiffusionProblem1P object.
Definition: dumux/porousmediumflow/1p/sequential/diffusion/problem.hh:91
Base class for definition of an sequential diffusion (pressure) or transport problem.
Definition: onemodelproblem.hh:46
void timeIntegration()
Called by TimeManager in order to do a time integration on the model.
Definition: onemodelproblem.hh:345
TimeManager & timeManager()
Returns TimeManager object used by the simulation.
Definition: onemodelproblem.hh:551
void serialize()
This method writes the complete state of the problem to the harddisk.
Definition: onemodelproblem.hh:600
Specifies the properties for 1p pressure models.
Class including data of one grid cell.