3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
2p/sequential/fluxdata.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_FLUXDATA2P_HH
25#define DUMUX_FLUXDATA2P_HH
26
27#include "properties.hh"
28
29namespace Dumux {
39template<class TypeTag>
41{
42private:
45
46 enum
47 {
48 dim = GridView::dimension
49 };
50
52
53 enum
54 {
55 wPhaseIdx = Indices::wPhaseIdx, nPhaseIdx = Indices::nPhaseIdx
56 };
57
58 enum
59 {
60 numPhases = getPropValue<TypeTag, Properties::NumPhases>()
61 };
62
63 using DimVector = Dune::FieldVector<Scalar, dim>;
64 using VelocityVector = Dune::FieldVector<DimVector, 2*dim>;
65
66 VelocityVector velocity_[numPhases];
67 Scalar upwindPotential_[2 * dim][numPhases];
68 bool velocityMarker_[2 * dim];
69
70public:
71
74 {
75 for (int fIdx = 0; fIdx < 2*dim; fIdx++)
76 {
77 for (int phaseIdx = 0; phaseIdx < numPhases; phaseIdx++)
78 {
79 velocity_[phaseIdx][fIdx] = DimVector(0.0);
80
81 upwindPotential_[fIdx][phaseIdx] = 0.0;
82 }
83 velocityMarker_[fIdx] = false;
84 }
85 }
86
88 // functions returning the vectors of the primary variables
90
97 const DimVector& velocity(int phaseIdx, int indexInInside)
98 {
99 return velocity_[phaseIdx][indexInInside];
100 }
101
108 const DimVector& velocity(int phaseIdx, int indexInInside) const
109 {
110 return velocity_[phaseIdx][indexInInside];
111 }
112
120 void setVelocity(int phaseIdx, int indexInInside, const DimVector& velocity)
121 {
122 velocity_[phaseIdx][indexInInside] = velocity;
123 }
124
132 void addVelocity(int phaseIdx, int indexInInside, const DimVector& velocity)
133 {
134 velocity_[phaseIdx][indexInInside] += velocity;
135 }
136
139 {
140 for (int i = 0; i < 2 * dim; i++)
141 {
142 for (int j = 0; j < numPhases; j++)
143 {
144 velocity_[j][i] = 0.;
145 upwindPotential_[i][j] = 0.;
146 }
147 velocityMarker_[i] = false;
148 }
149 }
150
156 DimVector velocityTotal(int indexInInside)
157 {
158 return velocity_[wPhaseIdx][indexInInside]
159 + velocity_[nPhaseIdx][indexInInside];
160 }
161
167 DimVector velocityTotal(int indexInInside) const
168 {
169 return velocity_[wPhaseIdx][indexInInside]
170 + velocity_[nPhaseIdx][indexInInside];
171 }
172
179 void setVelocityMarker(int indexInInside)
180 {
181 velocityMarker_[indexInInside] = true;
182 }
183
190 bool haveVelocity(int indexInInside)
191 {
192 return velocityMarker_[indexInInside];
193 }
194
197 {
198 for (int i = 0; i < 2*dim; i++)
199 velocityMarker_[i] = false;
200 }
201
209 bool isUpwindCell(int phaseIdx, int indexInInside)
210 {
211 return (upwindPotential_[indexInInside][phaseIdx] > 0.);
212 }
213
221 bool isUpwindCell(int phaseIdx, int indexInInside) const
222 {
223 return (upwindPotential_[indexInInside][phaseIdx] > 0.);
224 }
225
232 Scalar upwindPotential(int phaseIdx, int indexInInside)
233 {
234 return upwindPotential_[indexInInside][phaseIdx];
235 }
236
243 Scalar upwindPotential(int phaseIdx, int indexInInside) const
244 {
245 return upwindPotential_[indexInInside][phaseIdx];
246 }
247
255 void setUpwindPotential(int phaseIdx, int indexInInside, Scalar pot)
256 {
257 upwindPotential_[indexInInside][phaseIdx] = pot;
258 }
259
267 void addUpwindPotential(int phaseIdx, int indexInInside, Scalar pot)
268 {
269 upwindPotential_[indexInInside][phaseIdx] += pot;
270 }
271};
272} // end namespace Dumux
273#endif
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
Class storing data assigned to a cell-cell interfaces, so-called flux-data.
Definition: 2p/sequential/fluxdata.hh:41
bool haveVelocity(int indexInInside)
Check the velocity marker Returns true if a velocity marker was set, otherwise false
Definition: 2p/sequential/fluxdata.hh:190
bool isUpwindCell(int phaseIdx, int indexInInside) const
Checks for upwind direction Returns true if the cell is the upwind cell, otherwise false
Definition: 2p/sequential/fluxdata.hh:221
void setVelocity(int phaseIdx, int indexInInside, const DimVector &velocity)
Sets the phase velocity vector at a cell-cell interface.
Definition: 2p/sequential/fluxdata.hh:120
const DimVector & velocity(int phaseIdx, int indexInInside) const
Returns the phase velocity vector at a cell-cell interface.
Definition: 2p/sequential/fluxdata.hh:108
void setUpwindPotential(int phaseIdx, int indexInInside, Scalar pot)
Sets the phase upwind potential at a cell-cell interface.
Definition: 2p/sequential/fluxdata.hh:255
void addVelocity(int phaseIdx, int indexInInside, const DimVector &velocity)
Adds a phase velocity vector to the one previously stored.
Definition: 2p/sequential/fluxdata.hh:132
Scalar upwindPotential(int phaseIdx, int indexInInside) const
Returns the phase upwind potential at a cell-cell interface.
Definition: 2p/sequential/fluxdata.hh:243
void resetVelocity()
Resets velocities and potentials.
Definition: 2p/sequential/fluxdata.hh:138
const DimVector & velocity(int phaseIdx, int indexInInside)
Returns the phase velocity vector at a cell-cell interface.
Definition: 2p/sequential/fluxdata.hh:97
DimVector velocityTotal(int indexInInside)
Returns the total velocity vector at a cell-cell interface.
Definition: 2p/sequential/fluxdata.hh:156
bool isUpwindCell(int phaseIdx, int indexInInside)
Checks for upwind direction Returns true if the cell is the upwind cell, otherwise false
Definition: 2p/sequential/fluxdata.hh:209
void setVelocityMarker(int indexInInside)
Sets the velocity marker at a cell-cell interface This marker can be used to check if a velocity has ...
Definition: 2p/sequential/fluxdata.hh:179
FluxData2P()
Constructs a FluxData2P object.
Definition: 2p/sequential/fluxdata.hh:73
void resetVelocityMarker()
Resets the velocity marker.
Definition: 2p/sequential/fluxdata.hh:196
DimVector velocityTotal(int indexInInside) const
Returns the total velocity vector at a cell-cell interface.
Definition: 2p/sequential/fluxdata.hh:167
Scalar upwindPotential(int phaseIdx, int indexInInside)
Returns the phase upwind potential at a cell-cell interface.
Definition: 2p/sequential/fluxdata.hh:232
void addUpwindPotential(int phaseIdx, int indexInInside, Scalar pot)
Adds a phase upwind potential to the one previously stored.
Definition: 2p/sequential/fluxdata.hh:267
Base file for properties related to sequential models.