3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
dumux/porousmediumflow/2p/sequential/transport/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_TRANSPORTPROBLEM_2P_HH
25#define DUMUX_TRANSPORTPROBLEM_2P_HH
26
27#include "properties.hh"
30
31namespace Dumux {
32namespace Properties {
33// Set the model properties
34template<class TypeTag>
35struct Model<TypeTag, TTag::TransportTwoP>
36{
37 using type = typename GET_PROP_TYPE(TypeTag, TransportModel);
38};
39//this Property should be set by the pressure model, only for a pure transport it is set here for the transportproblem!
41} // end namespace Properties
42
49template<class TypeTag>
50class TransportProblem2P : public OneModelProblem<TypeTag>
51{
52 using Implementation = typename GET_PROP_TYPE(TypeTag, Problem);
54
55 using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
56 using Grid = typename GridView::Grid;
57 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
58
59 using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager);
60
61 // material properties
62 using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
63
64 using SolutionTypes = typename GET_PROP(TypeTag, SolutionTypes);
65 using Solution = typename SolutionTypes::ScalarSolution;
66
67 using Element = typename GridView::Traits::template Codim<0>::Entity;
68
69 using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
70
71 enum {
72 dim = Grid::dimension,
73 dimWorld = Grid::dimensionworld
74 };
75 enum
76 {
77 transportEqIdx = Indices::transportEqIdx
78 };
79
80 using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
81
82 // private!! copy constructor
84 {}
85
86public:
87
94 TransportProblem2P(TimeManager& timeManager, Grid& grid)
95 : ParentType(timeManager, grid),
96 gravity_(0)
97 {
98 cFLFactor_ = getParam<Scalar>("Impet.CFLFactor");
99
100 spatialParams_ = std::make_shared<SpatialParams>(asImp_());
101
102 gravity_ = 0;
103 if (getParam<bool>("Problem.EnableGravity"))
104 gravity_[dim - 1] = - 9.81;
105 }
106
114 TransportProblem2P(TimeManager& timeManager, Grid& grid, SpatialParams& spatialParams)
115 : ParentType(timeManager, grid),
116 gravity_(0)
117 {
118 cFLFactor_ = getParam<Scalar>("Impet.CFLFactor");
119
120 spatialParams_ = Dune::stackobject_to_shared_ptr<SpatialParams>(spatialParams);
121
122 gravity_ = 0;
123 if (getParam<bool>("Problem.EnableGravity"))
124 gravity_[dim - 1] = - 9.81;
125 }
126
130 // \{
131
138 Scalar temperature(const Element& element) const
139 {
140 return this->asImp_().temperatureAtPos(element.geometry().center());
141 }
142
149 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
150 {
151 // Throw an exception (there is no initial condition)
152 DUNE_THROW(Dune::InvalidStateException,
153 "The problem does not provide "
154 "a temperatureAtPos() method.");
155 }
156
163 Scalar referencePressure(const Element& element) const
164 {
165 return this->asImp_().referencePressureAtPos(element.geometry().center());
166 }
167
174 Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
175 {
176 // Throw an exception (there is no initial condition)
177 DUNE_THROW(Dune::InvalidStateException,
178 "The problem does not provide "
179 "a referencePressureAtPos() method.");
180 }
181
188 const GlobalPosition &gravity() const
189 { return gravity_; }
190
194 SpatialParams &spatialParams()
195 { return *spatialParams_; }
196
200 const SpatialParams &spatialParams() const
201 { return *spatialParams_; }
202
203
211 {
212 // allocate temporary vectors for the updates
213 Solution updateVector;
214
215 Scalar t = this->timeManager().time();
216 Scalar dt = 1e100;
217
218 // obtain the first update and the time step size
219 this->model().update(t, dt, updateVector);
220
221 //make sure t_old + dt is not larger than tend
222 using std::min;
223 dt = min(dt*cFLFactor_, this->timeManager().episodeMaxTimeStepSize());
224 this->timeManager().setTimeStepSize(dt);
225
226 // explicit Euler: Sat <- Sat + dt*N(Sat)
227 this->model().updateTransportedQuantity(updateVector);
228 }
229
230 // \}
231
232private:
234 Implementation &asImp_()
235 { return *static_cast<Implementation *>(this); }
236
238 const Implementation &asImp_() const
239 { return *static_cast<const Implementation *>(this); }
240
241 GlobalPosition gravity_;
242
243 // material properties
244 std::shared_ptr<SpatialParams> spatialParams_;
245
246 Scalar cFLFactor_;
247};
248
249} // end namespace Dumux
250
251#endif
Base class for definition of an sequential diffusion (pressure) or transport problem.
Default implementation of velocity class.
#define GET_PROP(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:281
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
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 Velocity
The type velocity reconstruction.
Definition: porousmediumflow/sequential/properties.hh:67
Property tag TransportModel
The type of the discretization of a transport model.
Definition: porousmediumflow/sequential/properties.hh:66
typename GET_PROP_TYPE(TypeTag, TransportModel) type
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:37
Base class for a sequential two-phase transport problem.
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:51
TransportProblem2P(TimeManager &timeManager, Grid &grid)
The constructor.
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:94
void timeIntegration()
Time integration of the model.
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:210
Scalar temperature(const Element &element) const
Returns the temperature within the domain.
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:138
const SpatialParams & spatialParams() const
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:200
Scalar referencePressureAtPos(const GlobalPosition &globalPos) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:174
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:194
TransportProblem2P(TimeManager &timeManager, Grid &grid, SpatialParams &spatialParams)
The constructor.
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:114
const GlobalPosition & gravity() const
Returns the acceleration due to gravity.
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:188
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:149
Scalar referencePressure(const Element &element) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: dumux/porousmediumflow/2p/sequential/transport/problem.hh:163
Default implementation of a velocity class.
Definition: velocitydefault.hh:42
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
Model & model()
Returns numerical model used for the problem.
Definition: onemodelproblem.hh:575
Base file for properties related to sequential models.