27#ifndef OPM_H2_GAS_PVT_HPP
28#define OPM_H2_GAS_PVT_HPP
48template <
class Scalar>
54 static const bool extrapolate =
true;
60 explicit H2GasPvt() =
default;
62 explicit H2GasPvt(
const std::vector<Scalar>& salinity,
63 Scalar T_ref = 288.71,
64 Scalar P_ref = 101325);
75 void setVapPars(
const Scalar,
const Scalar)
94 { enableVaporization_ = yesno; }
107 {
return gasReferenceDensity_.size(); }
109 Scalar hVap(
unsigned )
const
116 template <
class Evaluation>
118 const Evaluation& temperature,
119 const Evaluation& pressure,
121 const Evaluation& )
const
143 template <
class Evaluation>
145 const Evaluation& temperature,
146 const Evaluation& pressure,
148 const Evaluation& )
const
156 template <
class Evaluation>
158 const Evaluation& temperature,
159 const Evaluation& pressure)
const
167 template <
class Evaluation>
169 const Evaluation& temperature,
170 const Evaluation& pressure,
171 const Evaluation& rv,
172 const Evaluation& rvw)
const
175 if (!enableVaporization_) {
177 gasReferenceDensity_[regionIdx];
181 const auto& rhoH2 =
H2::gasDensity(temperature, pressure, extrapolate);
188 return rhoH2 / (gasReferenceDensity_[regionIdx] +
189 max(rvw,rv) * brineReferenceDensity_[regionIdx]);
195 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
196 std::pair<LhsEval, LhsEval>
199 const LhsEval& T = decay<LhsEval>(fluidState.temperature(FluidState::gasPhaseIdx));
200 const LhsEval& p = decay<LhsEval>(fluidState.pressure(FluidState::gasPhaseIdx));
201 const LhsEval& Rv = decay<LhsEval>(fluidState.Rv());
202 const LhsEval& Rvw = decay<LhsEval>(fluidState.Rvw());
204 this->
viscosity(regionIdx, T, p, Rv, Rvw) };
210 template <
class Evaluation>
212 const Evaluation& temperature,
213 const Evaluation& pressure)
const
215 const Evaluation rvw = rvwSat_(regionIdx, temperature, pressure,
216 Evaluation(salinity_[regionIdx]));
218 Evaluation(0.0), rvw);
228 template <
class Evaluation>
231 const Evaluation& )
const
237 template <
class Evaluation>
239 const Evaluation& temperature,
240 const Evaluation& pressure)
const
242 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
248 template <
class Evaluation = Scalar>
250 const Evaluation& temperature,
251 const Evaluation& pressure,
252 const Evaluation& saltConcentration)
const
254 const Evaluation salinity = salinityFromConcentration(temperature, pressure,
256 return rvwSat_(regionIdx, temperature, pressure, salinity);
262 template <
class Evaluation>
264 const Evaluation& temperature,
265 const Evaluation& pressure,
267 const Evaluation& )
const
269 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
275 template <
class Evaluation>
277 const Evaluation& temperature,
278 const Evaluation& pressure)
const
280 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
283 template <
class Evaluation>
284 Evaluation diffusionCoefficient(
const Evaluation& temperature,
285 const Evaluation& pressure,
291 Scalar gasReferenceDensity(
unsigned regionIdx)
const
292 {
return gasReferenceDensity_[regionIdx]; }
294 Scalar oilReferenceDensity(
unsigned regionIdx)
const
295 {
return brineReferenceDensity_[regionIdx]; }
297 Scalar waterReferenceDensity(
unsigned regionIdx)
const
298 {
return brineReferenceDensity_[regionIdx]; }
300 Scalar
salinity(
unsigned regionIdx)
const
301 {
return salinity_[regionIdx]; }
304 template <
class LhsEval>
305 LhsEval rvwSat_(
unsigned regionIdx,
306 const LhsEval& temperature,
307 const LhsEval& pressure,
308 const LhsEval& salinity)
const
311 if (!enableVaporization_) {
317 LhsEval yH2O = pw_sat / pressure;
320 yH2O = max(0.0, min(1.0, yH2O));
321 return convertXgWToRvw(convertxgWToXgW(yH2O, salinity), regionIdx);
328 template <
class LhsEval>
329 LhsEval convertXgWToRvw(
const LhsEval& XgW,
unsigned regionIdx)
const
331 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
332 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
334 return XgW / (1.0 - XgW) * (rho_gRef / rho_wRef);
341 template <
class LhsEval>
342 LhsEval convertRvwToXgW_(
const LhsEval& Rvw,
unsigned regionIdx)
const
344 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
345 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
347 const LhsEval& rho_wG = Rvw * rho_wRef;
348 return rho_wG / (rho_gRef + rho_wG);
354 template <
class LhsEval>
355 LhsEval convertxgWToXgW(
const LhsEval& xgW,
const LhsEval& salinity)
const
360 return xgW * M_Brine / (xgW * (M_Brine - M_H2) + M_H2);
363 template <
class LhsEval>
364 const LhsEval salinityFromConcentration(
const LhsEval&T,
const LhsEval& P,
365 const LhsEval& saltConcentration)
const
370 std::vector<Scalar> gasReferenceDensity_{};
371 std::vector<Scalar> brineReferenceDensity_{};
372 std::vector<Scalar> salinity_{};
373 bool enableVaporization_ =
true;
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:187
A class for the brine fluid properties.
Definition BrineDynamic.hpp:49
static Scalar molarMass()
Definition Component.hpp:93
Definition EclipseState.hpp:62
void initEnd()
Finish initializing the oil phase PVT properties.
Definition H2GasPvt.hpp:99
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:238
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:117
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:276
void setEnableVaporizationWater(bool yesno)
Specify whether the PVT model should consider that the water component can vaporize in the gas phase.
Definition H2GasPvt.hpp:93
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:211
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefBrine, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition H2GasPvt.cpp:93
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition H2GasPvt.hpp:106
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:157
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:249
std::pair< LhsEval, LhsEval > inverseFormationVolumeFactorAndViscosity(const FluidState &fluidState, unsigned regionIdx)
Returns the formation volume factor [-] and viscosity [Pa s] of the fluid phase.
Definition H2GasPvt.hpp:197
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:229
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:263
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:168
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:144
Properties of pure molecular hydrogen .
Definition H2.hpp:90
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of H2 [J/kg].
Definition H2.hpp:249
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:285
static constexpr Scalar molarMass()
The molar mass in of molecular hydrogen.
Definition H2.hpp:109
static Evaluation gasDensity(Evaluation temperature, Evaluation pressure, bool extrapolate=false)
The density of at a given pressure and temperature.
Definition H2.hpp:200
Definition Schedule.hpp:101
A simple version of pure water with density from Hu et al.
Definition SimpleHuDuanH2O.hpp:66
static OPM_HOST_DEVICE Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate)
The density of pure water at a given pressure and temperature .
Definition SimpleHuDuanH2O.hpp:316
static OPM_HOST_DEVICE Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition SimpleHuDuanH2O.hpp:143
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Scalar Brine< Scalar, H2O >::salinity
Default value for the salinity of the brine (dimensionless).
Definition Brine.hpp:391