27 #ifndef OPM_H2_GAS_PVT_HPP 28 #define OPM_H2_GAS_PVT_HPP 46 template <
class Scalar>
52 static const bool extrapolate =
true;
60 explicit H2GasPvt(
const std::vector<Scalar>& salinity,
61 Scalar T_ref = 288.71,
62 Scalar P_ref = 101325);
71 void setVapPars(
const Scalar,
const Scalar)
90 { enableVaporization_ = yesno; }
103 {
return gasReferenceDensity_.size(); }
105 Scalar hVap(
unsigned )
const 112 template <
class Evaluation>
114 const Evaluation& temperature,
115 const Evaluation& pressure,
117 const Evaluation& )
const 139 template <
class Evaluation>
141 const Evaluation& temperature,
142 const Evaluation& pressure,
144 const Evaluation& )
const 152 template <
class Evaluation>
154 const Evaluation& temperature,
155 const Evaluation& pressure)
const 163 template <
class Evaluation>
165 const Evaluation& temperature,
166 const Evaluation& pressure,
167 const Evaluation& rv,
168 const Evaluation& rvw)
const 171 if (!enableVaporization_) {
173 gasReferenceDensity_[regionIdx];
177 const auto& rhoH2 =
H2::gasDensity(temperature, pressure, extrapolate);
184 return rhoH2 / (gasReferenceDensity_[regionIdx] +
185 max(rvw,rv) * brineReferenceDensity_[regionIdx]);
191 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::ValueType>
192 std::pair<LhsEval, LhsEval>
195 const LhsEval& T = decay<LhsEval>(fluidState.temperature(FluidState::gasPhaseIdx));
196 const LhsEval& p = decay<LhsEval>(fluidState.pressure(FluidState::gasPhaseIdx));
197 const LhsEval& Rv = decay<LhsEval>(fluidState.Rv());
198 const LhsEval& Rvw = decay<LhsEval>(fluidState.Rvw());
200 this->
viscosity(regionIdx, T, p, Rv, Rvw) };
206 template <
class Evaluation>
208 const Evaluation& temperature,
209 const Evaluation& pressure)
const 211 const Evaluation rvw = rvwSat_(regionIdx, temperature, pressure,
212 Evaluation(salinity_[regionIdx]));
214 Evaluation(0.0), rvw);
224 template <
class Evaluation>
227 const Evaluation& )
const 233 template <
class Evaluation>
235 const Evaluation& temperature,
236 const Evaluation& pressure)
const 238 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
244 template <
class Evaluation = Scalar>
246 const Evaluation& temperature,
247 const Evaluation& pressure,
248 const Evaluation& saltConcentration)
const 250 const Evaluation salinity = salinityFromConcentration(temperature, pressure,
252 return rvwSat_(regionIdx, temperature, pressure, salinity);
258 template <
class Evaluation>
260 const Evaluation& temperature,
261 const Evaluation& pressure,
263 const Evaluation& )
const 265 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
271 template <
class Evaluation>
273 const Evaluation& temperature,
274 const Evaluation& pressure)
const 276 return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
279 template <
class Evaluation>
280 Evaluation diffusionCoefficient(
const Evaluation& temperature,
281 const Evaluation& pressure,
287 Scalar gasReferenceDensity(
unsigned regionIdx)
const 288 {
return gasReferenceDensity_[regionIdx]; }
290 Scalar oilReferenceDensity(
unsigned regionIdx)
const 291 {
return brineReferenceDensity_[regionIdx]; }
293 Scalar waterReferenceDensity(
unsigned regionIdx)
const 294 {
return brineReferenceDensity_[regionIdx]; }
296 Scalar salinity(
unsigned regionIdx)
const 297 {
return salinity_[regionIdx]; }
300 template <
class LhsEval>
301 LhsEval rvwSat_(
unsigned regionIdx,
302 const LhsEval& temperature,
303 const LhsEval& pressure,
304 const LhsEval& salinity)
const 307 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,
361 const LhsEval& saltConcentration)
const 366 std::vector<Scalar> gasReferenceDensity_{};
367 std::vector<Scalar> brineReferenceDensity_{};
368 std::vector<Scalar> salinity_{};
369 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:259
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:234
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:193
Definition: Schedule.hpp:100
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:164
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:207
This class represents the Pressure-Volume-Temperature relations of the gas phase for H2...
Definition: H2GasPvt.hpp:47
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:89
void initEnd()
Finish initializing the oil phase PVT properties.
Definition: H2GasPvt.hpp:95
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:102
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:245
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:225
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:140
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:113
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:153
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:272
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of H2 [J/kg].
Definition: H2.hpp:249