27#ifndef OPM_CO2_GAS_PVT_HPP
28#define OPM_CO2_GAS_PVT_HPP
31#include <opm/common/ErrorMacros.hpp>
52template <
class Scalar>
58 static constexpr bool extrapolate =
true;
66 Co2GasPvt(
const std::vector<Scalar>& salinity,
67 Scalar T_ref = 288.71,
68 Scalar P_ref = 101325)
72 if (T_ref != Scalar(288.71) || P_ref != Scalar(1.01325e5)) {
73 OPM_THROW(std::runtime_error,
74 "BrineCo2Pvt class can only be used with default reference state (T, P) = (288.71 K, 1.01325e5 Pa)!");
76 int num_regions = salinity_.size();
77 setNumRegions(num_regions);
78 for (
int i = 0; i < num_regions; ++i) {
97 void setVapPars(
const Scalar,
const Scalar)
109 gasReferenceDensity_[regionIdx] = rhoRefGas;
110 brineReferenceDensity_[regionIdx] = rhoRefBrine;;
120 { enableVaporization_ = yesno; }
134 {
return gasReferenceDensity_.size(); }
139 template <
class Evaluation>
141 const Evaluation& temperature,
142 const Evaluation& pressure,
143 const Evaluation& rv,
144 const Evaluation& rvw)
const
148 Evaluation result = 0;
152 assert(rv == 0.0 || rvw == 0.0);
153 const Evaluation xBrine = convertRvwToXgW_(max(rvw,rv),regionIdx);
162 template <
class Evaluation>
164 const Evaluation& temperature,
165 const Evaluation& pressure,
167 const Evaluation& )
const
173 template <
class Evaluation>
175 const Evaluation& temperature,
176 const Evaluation& pressure)
const
186 template <
class Evaluation>
188 const Evaluation& temperature,
189 const Evaluation& pressure,
190 const Evaluation& rv,
191 const Evaluation& rvw)
const
193 OPM_TIMEFUNCTION_LOCAL();
194 if (!enableVaporization_)
195 return CO2::gasDensity(temperature, pressure, extrapolate)/gasReferenceDensity_[regionIdx];
200 assert(rv == 0.0 || rvw == 0.0);
201 const Evaluation xBrine = convertRvwToXgW_(max(rvw,rv),regionIdx);
202 const auto& rhoCo2 =
CO2::gasDensity(temperature, pressure, extrapolate);
204 return 1.0 / ( ( xBrine/rhoH2O + (1.0 - xBrine)/rhoCo2) * gasReferenceDensity_[regionIdx]);
210 template <
class Evaluation>
212 const Evaluation& temperature,
213 const Evaluation& pressure)
const
215 OPM_TIMEFUNCTION_LOCAL();
216 const Evaluation rvw = rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx]));
226 template <
class Evaluation>
229 const Evaluation& )
const
235 template <
class Evaluation>
237 const Evaluation& temperature,
238 const Evaluation& pressure)
const
239 {
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 OPM_TIMEFUNCTION_LOCAL();
251 const Evaluation salinity = salinityFromConcentration(temperature, pressure, saltConcentration);
252 return rvwSat_(regionIdx, temperature, pressure, salinity);
258 template <
class Evaluation>
260 const Evaluation& temperature,
261 const Evaluation& pressure,
263 const Evaluation& )
const
264 {
return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx])); }
269 template <
class Evaluation>
271 const Evaluation& temperature,
272 const Evaluation& pressure)
const
273 {
return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx])); }
275 template <
class Evaluation>
276 Evaluation diffusionCoefficient(
const Evaluation& temperature,
277 const Evaluation& pressure,
283 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]; }
297 template <
class LhsEval>
298 LhsEval rvwSat_(
unsigned regionIdx,
299 const LhsEval& temperature,
300 const LhsEval& pressure,
301 const LhsEval& salinity)
const
303 OPM_TIMEFUNCTION_LOCAL();
304 if (!enableVaporization_)
320 xgH2O = max(0.0, min(1.0, xgH2O));
322 return convertXgWToRvw(convertxgWToXgW(xgH2O, salinity), regionIdx);
329 template <
class LhsEval>
330 LhsEval convertXgWToRvw(
const LhsEval& XgW,
unsigned regionIdx)
const
332 OPM_TIMEFUNCTION_LOCAL();
333 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
334 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
336 return XgW/(1.0 - XgW)*(rho_gRef/rho_wRef);
343 template <
class LhsEval>
344 LhsEval convertRvwToXgW_(
const LhsEval& Rvw,
unsigned regionIdx)
const
346 OPM_TIMEFUNCTION_LOCAL();
347 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
348 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
350 const LhsEval& rho_wG = Rvw*rho_wRef;
351 return rho_wG/(rho_gRef + rho_wG);
356 template <
class LhsEval>
357 LhsEval convertxgWToXgW(
const LhsEval& xgW,
const LhsEval& salinity)
const
359 OPM_TIMEFUNCTION_LOCAL();
363 return xgW*M_Brine / (xgW*(M_Brine - M_CO2) + M_CO2);
366 template <
class LhsEval>
367 const LhsEval salinityFromConcentration(
const LhsEval&T,
const LhsEval& P,
const LhsEval& saltConcentration)
const
370 std::vector<Scalar> brineReferenceDensity_;
371 std::vector<Scalar> gasReferenceDensity_;
372 std::vector<Scalar> salinity_;
373 bool enableVaporization_ =
true;
A class for the brine fluid properties.
Binary coefficients for brine and CO2.
A class for the CO2 fluid properties.
A central place for various physical constants occuring in some equations.
A simple version of pure water with density from Hu et al.
Binary coefficients for brine and CO2.
Definition Brine_CO2.hpp:42
static Evaluation gasDiffCoeff(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Binary diffusion coefficent [m^2/s] of water in the CO2 phase.
Definition Brine_CO2.hpp:56
static void calculateMoleFractions(const Evaluation &temperature, const Evaluation &pg, const Evaluation &salinity, const int knownPhaseIdx, Evaluation &xlCO2, Evaluation &ygH2O, bool extrapolate=false)
Returns the mol (!) fraction of CO2 in the liquid phase and the mol_ (!) fraction of H2O in the gas p...
Definition Brine_CO2.hpp:97
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
A class for the CO2 fluid properties.
Definition CO2.hpp:53
static Evaluation gasViscosity(Evaluation temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity [Pa s] of CO2.
Definition CO2.hpp:207
static Scalar molarMass()
The mass in [kg] of one mole of CO2.
Definition CO2.hpp:70
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of CO2 [J/kg].
Definition CO2.hpp:179
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The density of CO2 at a given pressure and temperature [kg/m^3].
Definition CO2.hpp:193
This class represents the Pressure-Volume-Temperature relations of the gas phase for CO2.
Definition Co2GasPvt.hpp:54
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 Co2GasPvt.hpp:140
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the formation volume factor [-] of water saturated gas at given pressure.
Definition Co2GasPvt.hpp:211
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 Co2GasPvt.hpp:259
Evaluation saturatedViscosity(unsigned, const Evaluation &temperature, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of fluid phase at saturated conditions.
Definition Co2GasPvt.hpp:174
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 Co2GasPvt.hpp:236
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefBrine, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition Co2GasPvt.hpp:104
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 Co2GasPvt.hpp:270
void initEnd()
Finish initializing the co2 phase PVT properties.
Definition Co2GasPvt.hpp:125
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 phase.
Definition Co2GasPvt.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 brine com...
Definition Co2GasPvt.hpp:227
void setEnableVaporizationWater(bool yesno)
Specify whether the PVT model should consider that the water component can vaporize in the gas phase.
Definition Co2GasPvt.hpp:119
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition Co2GasPvt.hpp:133
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 Co2GasPvt.hpp:163
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 Co2GasPvt.hpp:187
static Scalar molarMass()
The molar mass in of the component.
Definition Component.hpp:91
Definition EclipseState.hpp:57
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 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