3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 {
35template<class TypeTag>
36struct Model<TypeTag, TTag::PressureOneP> { using type = GetPropType<TypeTag, Properties::PressureModel>; };
37}
44template<class TypeTag>
45class DiffusionProblem1P: public OneModelProblem<TypeTag>
46{
47 using Implementation = GetPropType<TypeTag, Properties::Problem>;
49
51 using Grid = typename GridView::Grid;
53
55
56 // material properties
58
59 using Element = typename GridView::Traits::template Codim<0>::Entity;
60
61 enum
62 {
63 dim = Grid::dimension, dimWorld = Grid::dimensionworld
64 };
65
66 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
67 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
68
69public:
76 DiffusionProblem1P(TimeManager& timeManager, Grid& grid)
77 : ParentType(timeManager, grid), gravity_(0)
78 {
79 spatialParams_ = std::make_shared<SpatialParams>(asImp_());
80 gravity_ = 0;
81 if (getParam<bool>("Problem.EnableGravity"))
82 gravity_[dim - 1] = -9.81;
83 }
84
92 DiffusionProblem1P(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
107 : ParentType(grid, false), gravity_(0)
108 {
109 spatialParams_ = std::make_shared<SpatialParams>(asImp_());
110 gravity_ = 0;
111 if (getParam<bool>("Problem.EnableGravity"))
112 gravity_[dim - 1] = -9.81;
113 }
114
121 DiffusionProblem1P(Grid& grid, SpatialParams& spatialParams)
122 : ParentType(grid, false), gravity_(0)
123 {
124 spatialParams_ = Dune::stackobject_to_shared_ptr<SpatialParams>(spatialParams);
125 gravity_ = 0;
126 if (getParam<bool>("Problem.EnableGravity"))
127 gravity_[dim - 1] = -9.81;
128 }
129
133 // \{
134
136 void timeIntegration()
137 {
138 // end simulation -> no time dependent problem!
139 this->timeManager().setFinished();
140
141 return;
142 }
143
144 void serialize()
145 {
146 return;
147 }
148
149 void deserialize(double t)
150 {
151 return;
152 }
154
160 Scalar temperature(const Element& element) const
161 {
162 return asImp_().temperatureAtPos(element.geometry().center());
163 }
164
170 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
171 {
172 // Throw an exception (there is no initial condition)
173 DUNE_THROW(Dune::InvalidStateException,
174 "The problem does not provide "
175 "a temperatureAtPos() method.");
176 }
177
183 Scalar referencePressure(const Element& element) const
184 {
185 return asImp_().referencePressureAtPos(element.geometry().center());
186 }
187
193 Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
194 {
195 // Throw an exception (there is no initial condition)
196 DUNE_THROW(Dune::InvalidStateException,
197 "The problem does not provide "
198 "a referencePressureAtPos() method.");
199 }
200
207 const GravityVector &gravity() const
208 {
209 return gravity_;
210 }
211
215 SpatialParams &spatialParams()
216 {
217 return *spatialParams_;
218 }
219
223 const SpatialParams &spatialParams() const
224 {
225 return *spatialParams_;
226 }
227
228 // \}
229
230private:
232 Implementation &asImp_()
233 { return *static_cast<Implementation *>(this); }
234
236 const Implementation &asImp_() const
237 { return *static_cast<const Implementation *>(this); }
238
239 GravityVector gravity_;
240
241 // fluids and material properties
242 std::shared_ptr<SpatialParams> spatialParams_;
243};
244
245} // end namespace Dumux
246
247#endif
Base class for definition of an sequential diffusion (pressure) or transport problem.
Base class holding the variables for sequential models.
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
GetPropType< TypeTag, Properties::PressureModel > type
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:36
Base class for all single phase diffusion problems.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:46
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:207
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:170
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:215
Scalar referencePressure(const Element &element) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:183
Scalar temperature(const Element &element) const
Returns the temperature within the domain.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:160
DiffusionProblem1P(Grid &grid, SpatialParams &spatialParams)
The constructor.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:121
Scalar referencePressureAtPos(const GlobalPosition &globalPos) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:193
DiffusionProblem1P(TimeManager &timeManager, Grid &grid)
Constructs a DiffusionProblem1P object.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:76
const SpatialParams & spatialParams() const
Returns the spatial parameters object.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:223
DiffusionProblem1P(Grid &grid)
The constructor.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:106
DiffusionProblem1P(TimeManager &timeManager, Grid &grid, SpatialParams &spatialParams)
Constructs a DiffusionProblem1P object.
Definition: porousmediumflow/1p/sequential/diffusion/problem.hh:92
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
The type of the mode.
Definition: porousmediumflow/sequential/properties.hh:70
Specifies the properties for 1p pressure models.
Class including data of one grid cell.