3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
pseudo1p2c.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_PSEUDO1P2C_FLUID_STATE_HH
25#define DUMUX_PSEUDO1P2C_FLUID_STATE_HH
26
27#include <cassert>
28
29namespace Dumux {
30
42template <class ScalarType, class FluidSystem>
44{
45
46public:
47 static constexpr int numPhases = FluidSystem::numPhases;
48 static constexpr int numComponents = FluidSystem::numComponents;
49
51 using Scalar = ScalarType;
52
53 enum {
54 phase0Idx = FluidSystem::phase0Idx,
55 phase1Idx = FluidSystem::phase1Idx,
56
57 comp0Idx = FluidSystem::comp0Idx,
58 comp1Idx = FluidSystem::comp1Idx
59 };
60
71 Scalar saturation(int phaseIdx) const
72 { return phaseIdx == presentPhaseIdx_ ? 1.0 : 0.0; }
73
75 int presentPhaseIdx() const
76 { return presentPhaseIdx_; }
77
87 Scalar partialPressure(int compIdx) const
88 { return partialPressure(phase1Idx, compIdx); }
89
94 Scalar partialPressure(int phaseIdx, int compIdx) const
95 {
96 assert(FluidSystem::isGas(phaseIdx));
97 return pressure(phaseIdx)*moleFraction(phaseIdx, compIdx);
98 }
99
103 Scalar pressure(int phaseIdx) const
104 { return pressure_[phaseIdx]; }
105
109 Scalar density(int phaseIdx) const
110 { return phaseIdx == presentPhaseIdx_ ? density_ : 0.0; }
111
115 Scalar molarDensity(int phaseIdx) const
116 { return phaseIdx == presentPhaseIdx_ ? molarDensity_ : 0.0; }
117
121 Scalar massFraction(int phaseIdx, int compIdx) const
122 {
123 if (phaseIdx != presentPhaseIdx_)
124 return phaseIdx == compIdx ? 1.0 : 0.0;
125
126 return compIdx == phase0Idx ? massFractionWater_ : 1.0 - massFractionWater_;
127 }
128
139 Scalar moleFraction(int phaseIdx, int compIdx) const
140 {
141 if (phaseIdx != presentPhaseIdx_)
142 return phaseIdx == compIdx ? 1.0 : 0.0;
143
144 return compIdx == phase0Idx ? moleFractionWater_ : 1.0 - moleFractionWater_;
145 }
146
150 Scalar viscosity(int phaseIdx) const
151 {
152 assert(phaseIdx == presentPhaseIdx_);
153 return viscosity_;
154 }
155
164 Scalar averageMolarMass(int phaseIdx) const
165 { return averageMolarMass_; }
166
170 Scalar enthalpy(int phaseIdx) const
171 { return phaseIdx == presentPhaseIdx_ ? enthalpy_ : 0.0; }
172
180 Scalar internalEnergy(int phaseIdx) const
181 { return phaseIdx == presentPhaseIdx_ ? enthalpy_ - pressure(phaseIdx)/density(phaseIdx) : 0.0; }
182
189 Scalar temperature(int phaseIdx) const
190 { return temperature_; }
192
203 void setViscosity(int phaseIdx, Scalar value)
204 {
205 assert(phaseIdx == presentPhaseIdx_);
206 viscosity_ = value;
207 }
208
216 void setMassFraction(int phaseIdx, int compIdx, Scalar value)
217 { massFractionWater_ = compIdx == comp0Idx ? value : 1.0 - value; }
218
226 void setMoleFraction(int phaseIdx, int compIdx, Scalar value)
227 { moleFractionWater_ = compIdx == comp0Idx ? value : 1.0 - value; }
228
235 void setDensity(int phaseIdx, Scalar value)
236 {
237 assert(phaseIdx == presentPhaseIdx_);
238 density_ = value;
239 }
240
247 void setMolarDensity(int phaseIdx, Scalar value)
248 {
249 assert(phaseIdx == presentPhaseIdx_);
250 molarDensity_ = value;
251 }
252
257 void setPresentPhaseIdx(int phaseIdx)
258 { presentPhaseIdx_ = phaseIdx; }
259
266 { temperature_ = value; }
267
276 void setAverageMolarMass(int phaseIdx, Scalar value)
277 { averageMolarMass_ = value; }
278
282 void setPressure(int phaseIdx, Scalar value)
283 { pressure_[phaseIdx] = value; }
284
291 void setEnthalpy(int phaseIdx, Scalar value)
292 {
293 assert(phaseIdx == presentPhaseIdx_);
294 enthalpy_ = value;
295 }
297
298protected:
310};
311
312} // end namespace Dumux
313
314#endif
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Container for compositional variables in a 1p2c situation.
Definition: pseudo1p2c.hh:44
Scalar temperature_
Definition: pseudo1p2c.hh:308
ScalarType Scalar
export the scalar type
Definition: pseudo1p2c.hh:51
Scalar averageMolarMass_
Definition: pseudo1p2c.hh:301
void setAverageMolarMass(int phaseIdx, Scalar value)
Set the average molar mass of a fluid phase [kg/mol].
Definition: pseudo1p2c.hh:276
Scalar enthalpy_
Definition: pseudo1p2c.hh:307
void setMassFraction(int phaseIdx, int compIdx, Scalar value)
Sets the mass fraction of a component in a phase.
Definition: pseudo1p2c.hh:216
Scalar partialPressure(int compIdx) const
Return the partial pressure of a component in the gas phase.
Definition: pseudo1p2c.hh:87
Scalar massFractionWater_
Definition: pseudo1p2c.hh:302
void setPresentPhaseIdx(int phaseIdx)
Sets the phase Index that is present in this fluidState.
Definition: pseudo1p2c.hh:257
Scalar internalEnergy(int phaseIdx) const
The specific internal energy of a fluid phase in .
Definition: pseudo1p2c.hh:180
@ phase1Idx
Definition: pseudo1p2c.hh:55
@ phase0Idx
Definition: pseudo1p2c.hh:54
@ comp0Idx
Definition: pseudo1p2c.hh:57
@ comp1Idx
Definition: pseudo1p2c.hh:58
Scalar density_
Definition: pseudo1p2c.hh:304
Scalar moleFractionWater_
Definition: pseudo1p2c.hh:303
void setPressure(int phaseIdx, Scalar value)
Sets the phase pressure .
Definition: pseudo1p2c.hh:282
Scalar massConcentration_[numComponents]
Definition: pseudo1p2c.hh:300
Scalar viscosity(int phaseIdx) const
The dynamic viscosity of fluid phase in .
Definition: pseudo1p2c.hh:150
Scalar density(int phaseIdx) const
Set the density of a phase .
Definition: pseudo1p2c.hh:109
int presentPhaseIdx() const
Returns the index of the phase that is present in that cell.
Definition: pseudo1p2c.hh:75
Scalar viscosity_
Definition: pseudo1p2c.hh:306
Scalar pressure_[numPhases]
Definition: pseudo1p2c.hh:299
int presentPhaseIdx_
Definition: pseudo1p2c.hh:309
static constexpr int numComponents
Definition: pseudo1p2c.hh:48
Scalar molarDensity(int phaseIdx) const
The molar density of the fluid phase in .
Definition: pseudo1p2c.hh:115
Scalar pressure(int phaseIdx) const
The pressure of a fluid phase in .
Definition: pseudo1p2c.hh:103
Scalar moleFraction(int phaseIdx, int compIdx) const
Returns the molar fraction of the component in fluid phase in .
Definition: pseudo1p2c.hh:139
Scalar partialPressure(int phaseIdx, int compIdx) const
The partial pressure of a component in a phase .
Definition: pseudo1p2c.hh:94
void setDensity(int phaseIdx, Scalar value)
Sets the density of a phase .
Definition: pseudo1p2c.hh:235
Scalar enthalpy(int phaseIdx) const
The specific enthalpy of a fluid phase in .
Definition: pseudo1p2c.hh:170
void setViscosity(int phaseIdx, Scalar value)
Sets the viscosity of a phase .
Definition: pseudo1p2c.hh:203
void setEnthalpy(int phaseIdx, Scalar value)
Sets phase enthalpy.
Definition: pseudo1p2c.hh:291
void setMolarDensity(int phaseIdx, Scalar value)
Set the molar density of a phase .
Definition: pseudo1p2c.hh:247
void setTemperature(Scalar value)
Sets the temperature.
Definition: pseudo1p2c.hh:265
Scalar temperature(int phaseIdx) const
Returns the temperature of the fluids .
Definition: pseudo1p2c.hh:189
Scalar massFraction(int phaseIdx, int compIdx) const
Returns the mass fraction of component in fluid phase in .
Definition: pseudo1p2c.hh:121
void setMoleFraction(int phaseIdx, int compIdx, Scalar value)
Sets the molar fraction of a component in a fluid phase.
Definition: pseudo1p2c.hh:226
Scalar averageMolarMass(int phaseIdx) const
The average molar mass of phase in .
Definition: pseudo1p2c.hh:164
Scalar saturation(int phaseIdx) const
Returns the saturation of a fluid phase in .
Definition: pseudo1p2c.hh:71
Scalar molarDensity_
Definition: pseudo1p2c.hh:305
static constexpr int numPhases
Definition: pseudo1p2c.hh:47