27 #ifndef OPM_H2_GAS_PVT_HPP 28 #define OPM_H2_GAS_PVT_HPP 47 template <
class Scalar>
53 static const bool extrapolate =
true;
61 explicit H2GasPvt(
const std::vector<Scalar>& salinity,
62 Scalar T_ref = 288.71,
63 Scalar P_ref = 101325);
72 void setVapPars(
const Scalar,
const Scalar)
91 { enableVaporization_ = yesno; }
104 {
return gasReferenceDensity_.size(); }
106 Scalar hVap(
unsigned )
const 113 template <
class Evaluation>
115 const Evaluation& temperature,
116 const Evaluation& pressure,
118 const Evaluation& )
const 140 template <
class Evaluation>
142 const Evaluation& temperature,
143 const Evaluation& pressure,
145 const Evaluation& )
const 153 template <
class Evaluation>
155 const Evaluation& temperature,
156 const Evaluation& pressure)
const 164 template <
class Evaluation>
166 const Evaluation& temperature,
167 const Evaluation& pressure,
168 const Evaluation& rv,
169 const Evaluation& rvw)
const 172 if (!enableVaporization_) {
174 gasReferenceDensity_[regionIdx];
178 const auto& rhoH2 =
H2::gasDensity(temperature, pressure, extrapolate);
185 return rhoH2 / (gasReferenceDensity_[regionIdx] +
186 max(rvw,rv) * brineReferenceDensity_[regionIdx]);
192 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::ValueType>
193 std::pair<LhsEval, LhsEval>
196 const LhsEval& T = decay<LhsEval>(fluidState.temperature(FluidState::gasPhaseIdx));
197 const LhsEval& p = decay<LhsEval>(fluidState.pressure(FluidState::gasPhaseIdx));
198 const LhsEval& Rv = decay<LhsEval>(fluidState.Rv());
199 const LhsEval& Rvw = decay<LhsEval>(fluidState.Rvw());
201 this->
viscosity(regionIdx, T, p, Rv, Rvw) };
207 template <
class Evaluation>
209 const Evaluation& temperature,
210 const Evaluation& pressure)
const 212 const Evaluation rvw = rvwSat_(regionIdx, temperature, pressure,
213 Evaluation(salinity_[regionIdx]));
215 Evaluation(0.0), rvw);
225 template <
class Evaluation>
228 const Evaluation& )
const 234 template <
class Evaluation>
236 const Evaluation& temperature,
237 const Evaluation& pressure)
const 239 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
245 template <
class Evaluation = Scalar>
247 const Evaluation& temperature,
248 const Evaluation& pressure,
249 const Evaluation& saltConcentration)
const 251 const Evaluation salinity = salinityFromConcentration(temperature, pressure,
253 return rvwSat_(regionIdx, temperature, pressure, salinity);
259 template <
class Evaluation>
261 const Evaluation& temperature,
262 const Evaluation& pressure,
264 const Evaluation& )
const 266 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
272 template <
class Evaluation>
274 const Evaluation& temperature,
275 const Evaluation& pressure)
const 277 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
280 template <
class Evaluation>
281 Evaluation diffusionCoefficient(
const Evaluation& temperature,
282 const Evaluation& pressure,
288 Scalar gasReferenceDensity(
unsigned regionIdx)
const 289 {
return gasReferenceDensity_[regionIdx]; }
291 Scalar oilReferenceDensity(
unsigned regionIdx)
const 292 {
return brineReferenceDensity_[regionIdx]; }
294 Scalar waterReferenceDensity(
unsigned regionIdx)
const 295 {
return brineReferenceDensity_[regionIdx]; }
297 Scalar salinity(
unsigned regionIdx)
const 298 {
return salinity_[regionIdx]; }
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_) {
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,
362 const LhsEval& saltConcentration)
const 367 std::vector<Scalar> gasReferenceDensity_{};
368 std::vector<Scalar> brineReferenceDensity_{};
369 std::vector<Scalar> salinity_{};
370 bool enableVaporization_ =
true;
Properties of pure molecular hydrogen .
A class for the brine fluid properties.
Definition: BrineDynamic.hpp:48
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:260
void initFromState(const EclipseState &eclState, const Schedule &)
Initialize the parameters for H2 gas using an ECL deck.
Definition: H2GasPvt.cpp:51
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:235
static OPM_HOST_DEVICE Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition: SimpleHuDuanH2O.hpp:143
static constexpr Scalar molarMass()
The molar mass in of molecular hydrogen.
Definition: H2.hpp:109
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:194
Definition: Schedule.hpp:102
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:165
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
This class represents the Pressure-Volume-Temperature relations of the gas phase for H2...
Definition: H2GasPvt.hpp:48
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
void setEnableVaporizationWater(bool yesno)
Specify whether the PVT model should consider that the water component can vaporize in the gas phase...
Definition: H2GasPvt.hpp:90
void initEnd()
Finish initializing the oil phase PVT properties.
Definition: H2GasPvt.hpp:96
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
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefBrine, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: H2GasPvt.cpp:91
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: H2GasPvt.hpp:103
Definition: EclipseState.hpp:66
Binary coefficients for brine and H2.
Definition: Brine_H2.hpp:41
A simple version of pure water with density from Hu et al.
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
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:246
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:226
A simple version of pure water with density from Hu et al.
Definition: SimpleHuDuanH2O.hpp:65
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:141
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:114
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:154
A class for the brine fluid properties.
Binary coefficients for brine and H2.
static Evaluation gasDensity(Evaluation temperature, Evaluation pressure, bool extrapolate=false)
The density of at a given pressure and temperature.
Definition: H2.hpp:200
static Scalar molarMass()
The molar mass in of the component.
Definition: Component.hpp:93
Properties of pure molecular hydrogen .
Definition: H2.hpp:89
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:273
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of H2 [J/kg].
Definition: H2.hpp:249