27#ifndef OPM_H2_GAS_PVT_HPP
28#define OPM_H2_GAS_PVT_HPP
48template <
class Scalar>
54 static const bool extrapolate =
true;
62 H2GasPvt(
const std::vector<Scalar>& salinity,
63 Scalar T_ref = 288.71,
64 Scalar P_ref = 101325)
70 gasReferenceDensity_[i] =
H2::gasDensity(T_ref, P_ref, extrapolate);
89 void setVapPars(
const Scalar,
const Scalar)
102 gasReferenceDensity_[regionIdx] = rhoRefGas;
103 brineReferenceDensity_[regionIdx] = rhoRefBrine;
113 { enableVaporization_ = yesno; }
126 {
return gasReferenceDensity_.size(); }
132 template <
class Evaluation>
134 const Evaluation& temperature,
135 const Evaluation& pressure,
136 const Evaluation& rv,
137 const Evaluation& rvw)
const
142 Evaluation result = 0;
145 assert(rv == 0.0 || rvw == 0.0);
148 const Evaluation xBrine = convertRvwToXgW_(max(rvw, rv), regionIdx);
157 template <
class Evaluation>
159 const Evaluation& temperature,
160 const Evaluation& pressure,
162 const Evaluation& )
const
170 template <
class Evaluation>
172 const Evaluation& temperature,
173 const Evaluation& pressure)
const
181 template <
class Evaluation>
183 const Evaluation& temperature,
184 const Evaluation& pressure,
185 const Evaluation& rv,
186 const Evaluation& rvw)
const
189 if (!enableVaporization_)
190 return H2::gasDensity(temperature, pressure, extrapolate)/gasReferenceDensity_[regionIdx];
195 assert(rv == 0.0 || rvw == 0.0);
198 const Evaluation xBrine = convertRvwToXgW_(max(rvw, rv),regionIdx);
199 const auto& rhoH2 =
H2::gasDensity(temperature, pressure, extrapolate);
201 return 1.0 / ((xBrine / rhoH2O + (1.0 - xBrine) / rhoH2) * gasReferenceDensity_[regionIdx]);
207 template <
class Evaluation>
209 const Evaluation& temperature,
210 const Evaluation& pressure)
const
212 const Evaluation rvw = rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
221 template <
class Evaluation>
224 const Evaluation& )
const
230 template <
class Evaluation>
232 const Evaluation& temperature,
233 const Evaluation& pressure)
const
235 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
241 template <
class Evaluation = Scalar>
243 const Evaluation& temperature,
244 const Evaluation& pressure,
245 const Evaluation& saltConcentration)
const
247 const Evaluation salinity = salinityFromConcentration(temperature, pressure, saltConcentration);
248 return rvwSat_(regionIdx, temperature, pressure, salinity);
254 template <
class Evaluation>
256 const Evaluation& temperature,
257 const Evaluation& pressure,
259 const Evaluation& )
const
261 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
267 template <
class Evaluation>
269 const Evaluation& temperature,
270 const Evaluation& pressure)
const
272 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
275 template <
class Evaluation>
276 Evaluation diffusionCoefficient(
const Evaluation& temperature,
277 const Evaluation& pressure,
283 const Scalar gasReferenceDensity(
unsigned regionIdx)
const
284 {
return gasReferenceDensity_[regionIdx]; }
286 Scalar oilReferenceDensity(
unsigned regionIdx)
const
287 {
return brineReferenceDensity_[regionIdx]; }
289 Scalar waterReferenceDensity(
unsigned regionIdx)
const
290 {
return brineReferenceDensity_[regionIdx]; }
292 Scalar salinity(
unsigned regionIdx)
const
293 {
return salinity_[regionIdx]; }
296 std::vector<Scalar> gasReferenceDensity_;
297 std::vector<Scalar> brineReferenceDensity_;
298 std::vector<Scalar> salinity_;
299 bool enableVaporization_ =
true;
301 template <
class LhsEval>
302 LhsEval rvwSat_(
unsigned regionIdx,
303 const LhsEval& temperature,
304 const LhsEval& pressure,
305 const LhsEval& salinity)
const
308 if (!enableVaporization_)
313 LhsEval yH2O = pw_sat / pressure;
316 yH2O = max(0.0, min(1.0, yH2O));
317 return convertXgWToRvw(convertxgWToXgW(yH2O, salinity), regionIdx);
324 template <
class LhsEval>
325 LhsEval convertXgWToRvw(
const LhsEval& XgW,
unsigned regionIdx)
const
327 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
328 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
330 return XgW/(1.0 - XgW)*(rho_gRef/rho_wRef);
337 template <
class LhsEval>
338 LhsEval convertRvwToXgW_(
const LhsEval& Rvw,
unsigned regionIdx)
const
340 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
341 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
343 const LhsEval& rho_wG = Rvw*rho_wRef;
344 return rho_wG/(rho_gRef + rho_wG);
350 template <
class LhsEval>
351 LhsEval convertxgWToXgW(
const LhsEval& xgW,
const LhsEval& salinity)
const
356 return xgW*M_Brine / (xgW*(M_Brine - M_H2) + M_H2);
359 template <
class LhsEval>
360 const LhsEval salinityFromConcentration(
const LhsEval&T,
const LhsEval& P,
const LhsEval& saltConcentration)
const
A class for the brine fluid properties.
Binary coefficients for brine and H2.
Properties of pure molecular hydrogen .
A simple version of pure water with density from Hu et al.
Binary coefficients for brine and H2.
Definition Brine_H2.hpp:41
static Evaluation gasDiffCoeff(const Evaluation &temperature, const Evaluation &pressure)
Binary diffusion coefficent [m^2/s] for molecular water and H2 as an approximation for brine-H2 diffu...
Definition Brine_H2.hpp:186
A class for the brine fluid properties.
Definition BrineDynamic.hpp:46
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure, const Evaluation &salinity, bool extrapolate=false)
The density of the liquid component at a given pressure in and temperature in .
Definition BrineDynamic.hpp:261
static Scalar molarMass()
The molar mass in of the component.
Definition Component.hpp:91
Definition EclipseState.hpp:57
This class represents the Pressure-Volume-Temperature relations of the gas phase for H2.
Definition H2GasPvt.hpp:50
void initEnd()
Finish initializing the oil phase PVT properties.
Definition H2GasPvt.hpp:118
Evaluation saturatedWaterVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the water vaporization factor [m^3/m^3] of the water phase.
Definition H2GasPvt.hpp:231
Evaluation saturatedOilVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition H2GasPvt.hpp:268
void setEnableVaporizationWater(bool yesno)
Specify whether the PVT model should consider that the water component can vaporize in the gas phase.
Definition H2GasPvt.hpp:112
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the formation volume factor [-] of oil saturated gas at given pressure.
Definition H2GasPvt.hpp:208
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefBrine, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition H2GasPvt.hpp:97
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition H2GasPvt.hpp:125
Evaluation internalEnergy(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &rv, const Evaluation &rvw) const
Returns the specific enthalpy [J/kg] of gas given a set of parameters.
Definition H2GasPvt.hpp:133
Evaluation saturatedViscosity(unsigned, const Evaluation &temperature, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of oil saturated gas at given pressure.
Definition H2GasPvt.hpp:171
Evaluation saturatedWaterVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &saltConcentration) const
Returns the water vaporization factor [m^3/m^3] of water saturated gas.
Definition H2GasPvt.hpp:242
Evaluation saturationPressure(unsigned, const Evaluation &, const Evaluation &) const
Returns the saturation pressure of the gas phase [Pa] depending on its mass fraction of the oil compo...
Definition H2GasPvt.hpp:222
Evaluation saturatedOilVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the oil vaporization factor [m^3/m^3] of the oil phase.
Definition H2GasPvt.hpp:255
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &rv, const Evaluation &rvw) const
Returns the formation volume factor [-] of the fluid phase.
Definition H2GasPvt.hpp:182
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition H2GasPvt.hpp:158
Properties of pure molecular hydrogen .
Definition H2.hpp:58
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of H2 [J/kg].
Definition H2.hpp:215
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity of at a given pressure and temperature.
Definition H2.hpp:249
static constexpr Scalar molarMass()
The molar mass in of molecular hydrogen.
Definition H2.hpp:77
static Evaluation gasDensity(Evaluation temperature, Evaluation pressure, bool extrapolate=false)
The density of at a given pressure and temperature.
Definition H2.hpp:167
Definition Schedule.hpp:133
A simple version of pure water with density from Hu et al.
Definition SimpleHuDuanH2O.hpp:64
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam at a given pressure and temperature.
Definition SimpleHuDuanH2O.hpp:281
static Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition SimpleHuDuanH2O.hpp:138
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate)
The density of pure water at a given pressure and temperature .
Definition SimpleHuDuanH2O.hpp:309
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam .
Definition SimpleHuDuanH2O.hpp:223
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30