3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
dumux/porousmediumflow/2p2c/sequential/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_IMPETPROBLEM_2P2C_HH
25#define DUMUX_IMPETPROBLEM_2P2C_HH
26
30
31
32namespace Dumux {
41template<class TypeTag>
42class IMPETProblem2P2C : public IMPESProblem2P<TypeTag>
43{
45 using Implementation = typename GET_PROP_TYPE(TypeTag, Problem);
46 using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager);
47 using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
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 Element = typename GridView::Traits::template Codim<0>::Entity;
54
55 // material properties
56 using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
57
58 enum
59 {
60 adaptiveGrid = GET_PROP_VALUE(TypeTag, AdaptiveGrid)
61 };
62 enum {
63 dimWorld = Grid::dimensionworld
64 };
65
66 using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
67
68public:
75 IMPETProblem2P2C(TimeManager& timeManager, Grid& grid)
76 : IMPETProblem2P2C(timeManager, grid, grid.leafGridView())
77 {}
78
79 IMPETProblem2P2C(TimeManager &timeManager, Grid& grid, const GridView& gridView)
81 { }
92 IMPETProblem2P2C(TimeManager &timeManager, Grid& grid, SpatialParams &spatialParams)
94 { }
95
105 {
106 // if adaptivity is used, this method adapts the grid.
107 // if it is not used, this method does nothing.
108 if (this->adaptiveGrid)
109 {
110 this->gridAdapt().adaptGrid();
111
112 if(this->gridAdapt().wasAdapted())
113 asImp_().pressureModel().updateMaterialLaws(false);
114 }
115 }
127 {
129 asImp_().pressureModel().updateMaterialLaws(true);
130 }
134 // \{
135
144 Scalar initSat(const Element& element) const
145 {
146 return asImp_().initSatAtPos(element.geometry().center());
147 }
148
155 Scalar initSatAtPos(const GlobalPosition& globalPos) const
156 {
157 DUNE_THROW(Dune::NotImplemented, "please specify initial saturation in the problem"
158 " using an initSatAtPos() method!");
159 return NAN;
160 }
161
170 Scalar initConcentration(const Element& element) const
171 {
172 return asImp_().initConcentrationAtPos(element.geometry().center());
173 }
174
181 Scalar initConcentrationAtPos(const GlobalPosition& globalPos) const
182 {
183 DUNE_THROW(Dune::NotImplemented, "please specify initial Concentration in the problem"
184 " using an initConcentrationAtPos() method!");
185 }
186 // \}
187
188private:
190 Implementation &asImp_()
191 { return *static_cast<Implementation *>(this); }
192
194 const Implementation &asImp_() const
195 { return *static_cast<const Implementation *>(this); }
196
197protected:
199 void setZero(typename GET_PROP_TYPE(TypeTag, PrimaryVariables) &values, const int equation = -1) const
200 {
201 if (equation == Indices::pressureEqIdx)
202 {
203 values[Indices::pressureEqIdx] = 0.;
204 }
205 else if(equation == Indices::contiNEqIdx)
206 values[Indices::contiNEqIdx] =0.;
207 else if(equation == Indices::contiWEqIdx)
208 values[Indices::contiWEqIdx] =0.;
209 else if (equation == -1)
210 {
211 // set everything to zero
212 for (unsigned int i = 0; i < values.size(); i++)
213 values[i] = 0.;
214 }
215 else
216 DUNE_THROW(Dune::InvalidStateException, "vector of primary variables can not be set properly");
217 }
218};
219
220} // end namespace Dumux
221
222#endif
#define GET_PROP_VALUE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:282
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
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 AdaptiveGrid
Defines if the grid is h-adaptive.
Definition: gridadaptproperties.hh:49
Base class for all 2-phase problems which use an IMPES algorithm.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:41
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:173
Base class for all compositional 2-phase problems which use an impet algorithm.
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:43
Scalar initSat(const Element &element) const
Saturation initial condition (dimensionless)
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:144
void postTimeStep()
Called by the time manager after everything which can be done about the current time step is finished...
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:126
IMPETProblem2P2C(TimeManager &timeManager, Grid &grid, const GridView &gridView)
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:79
void preTimeStep()
Called by TimeManager just before the time integration.
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:104
IMPETProblem2P2C(TimeManager &timeManager, Grid &grid)
The standard constructor.
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:75
void setZero(typename GET_PROP_TYPE(TypeTag, PrimaryVariables) &values, const int equation=-1) const
Sets entries of the primary variable vector to zero.
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:199
Scalar initConcentration(const Element &element) const
Concentration initial condition (dimensionless)
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:170
IMPETProblem2P2C(TimeManager &timeManager, Grid &grid, SpatialParams &spatialParams)
The constructor for given spatialParams.
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:92
Scalar initConcentrationAtPos(const GlobalPosition &globalPos) const
Concentration initial condition (dimensionless)
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:181
Scalar initSatAtPos(const GlobalPosition &globalPos) const
Saturation initial condition (dimensionless) at given position.
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:155
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
GridAdaptModel & gridAdapt()
Returns adaptivity model used for the problem.
Definition: impetproblem.hh:602
TimeManager & timeManager()
Returns TimeManager object used by the simulation.
Definition: impetproblem.hh:663
void postTimeStep()
Called by TimeManager whenever a solution for a timestep has been computed and the simulation time ha...
Definition: impetproblem.hh:416
Grid & grid()
Returns the current grid which used by the problem.
Definition: impetproblem.hh:581
Defines the properties required for the sequential 2p2c models.
Base class for all 2-phase problems which use an IMPES algorithm.