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,
137 const Evaluation& )
const
159 template <
class Evaluation>
161 const Evaluation& temperature,
162 const Evaluation& pressure,
164 const Evaluation& )
const
172 template <
class Evaluation>
174 const Evaluation& temperature,
175 const Evaluation& pressure)
const
183 template <
class Evaluation>
185 const Evaluation& temperature,
186 const Evaluation& pressure,
187 const Evaluation& rv,
188 const Evaluation& rvw)
const
191 if (!enableVaporization_)
192 return H2::gasDensity(temperature, pressure, extrapolate)/gasReferenceDensity_[regionIdx];
195 const auto& rhoH2 =
H2::gasDensity(temperature, pressure, extrapolate);
202 return rhoH2/(gasReferenceDensity_[regionIdx] + max(rvw,rv)*brineReferenceDensity_[regionIdx]);
208 template <
class Evaluation>
210 const Evaluation& temperature,
211 const Evaluation& pressure)
const
213 const Evaluation rvw = rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
222 template <
class Evaluation>
225 const Evaluation& )
const
231 template <
class Evaluation>
233 const Evaluation& temperature,
234 const Evaluation& pressure)
const
236 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
242 template <
class Evaluation = Scalar>
244 const Evaluation& temperature,
245 const Evaluation& pressure,
246 const Evaluation& saltConcentration)
const
248 const Evaluation salinity = salinityFromConcentration(temperature, pressure, saltConcentration);
249 return rvwSat_(regionIdx, temperature, pressure, salinity);
255 template <
class Evaluation>
257 const Evaluation& temperature,
258 const Evaluation& pressure,
260 const Evaluation& )
const
262 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
268 template <
class Evaluation>
270 const Evaluation& temperature,
271 const Evaluation& pressure)
const
273 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
276 template <
class Evaluation>
277 Evaluation diffusionCoefficient(
const Evaluation& temperature,
278 const Evaluation& pressure,
284 const Scalar gasReferenceDensity(
unsigned regionIdx)
const
285 {
return gasReferenceDensity_[regionIdx]; }
287 Scalar oilReferenceDensity(
unsigned regionIdx)
const
288 {
return brineReferenceDensity_[regionIdx]; }
290 Scalar waterReferenceDensity(
unsigned regionIdx)
const
291 {
return brineReferenceDensity_[regionIdx]; }
293 Scalar salinity(
unsigned regionIdx)
const
294 {
return salinity_[regionIdx]; }
297 std::vector<Scalar> gasReferenceDensity_;
298 std::vector<Scalar> brineReferenceDensity_;
299 std::vector<Scalar> salinity_;
300 bool enableVaporization_ =
true;
302 template <
class LhsEval>
303 LhsEval rvwSat_(
unsigned regionIdx,
304 const LhsEval& temperature,
305 const LhsEval& pressure,
306 const LhsEval& salinity)
const
309 if (!enableVaporization_)
314 LhsEval yH2O = pw_sat / pressure;
317 yH2O = max(0.0, min(1.0, yH2O));
318 return convertXgWToRvw(convertxgWToXgW(yH2O, salinity), regionIdx);
325 template <
class LhsEval>
326 LhsEval convertXgWToRvw(
const LhsEval& XgW,
unsigned regionIdx)
const
328 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
329 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
331 return XgW/(1.0 - XgW)*(rho_gRef/rho_wRef);
338 template <
class LhsEval>
339 LhsEval convertRvwToXgW_(
const LhsEval& Rvw,
unsigned regionIdx)
const
341 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
342 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
344 const LhsEval& rho_wG = Rvw*rho_wRef;
345 return rho_wG/(rho_gRef + rho_wG);
351 template <
class LhsEval>
352 LhsEval convertxgWToXgW(
const LhsEval& xgW,
const LhsEval& salinity)
const
357 return xgW*M_Brine / (xgW*(M_Brine - M_H2) + M_H2);
360 template <
class LhsEval>
361 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:48
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:263
static Scalar molarMass()
The molar mass in of the component.
Definition Component.hpp:93
Definition EclipseState.hpp:63
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:232
Evaluation internalEnergy(unsigned, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the specific enthalpy [J/kg] of gas given a set of parameters.
Definition H2GasPvt.hpp:133
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:269
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:209
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 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:173
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:243
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:223
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:256
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:184
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:160
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:88
A simple version of pure water with density from Hu et al.
Definition SimpleHuDuanH2O.hpp:65
static Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition SimpleHuDuanH2O.hpp:139
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:310
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30