27#ifndef OPM_CO2_GAS_PVT_HPP
28#define OPM_CO2_GAS_PVT_HPP
31#include <opm/common/TimingMacros.hpp>
38#include <opm/input/eclipse/EclipseState/Co2StoreConfig.hpp>
53template <
class Scalar>
59 static constexpr bool extrapolate =
true;
67 explicit Co2GasPvt(
const std::vector<Scalar>& salinity,
68 int activityModel = 3,
69 int thermalMixingModel = 1,
70 Scalar T_ref = 288.71,
71 Scalar P_ref = 101325);
82 void setVapPars(
const Scalar,
const Scalar)
101 { enableVaporization_ = yesno; }
124 {
return gasReferenceDensity_.size(); }
126 Scalar hVap(
unsigned )
const
132 template <
class Evaluation>
134 const Evaluation& temperature,
135 const Evaluation& pressure,
136 const Evaluation& rv,
137 const Evaluation& rvw)
const
140 if (gastype_ == Co2StoreConfig::GasMixingType::NONE) {
145 assert(gastype_ == Co2StoreConfig::GasMixingType::IDEAL);
147 Evaluation result = 0;
150 assert(rv == 0.0 || rvw == 0.0);
151 const Evaluation xBrine = convertRvwToXgW_(max(rvw,rv),regionIdx);
161 template <
class Evaluation>
163 const Evaluation& temperature,
164 const Evaluation& pressure,
166 const Evaluation& )
const
172 template <
class Evaluation>
174 const Evaluation& temperature,
175 const Evaluation& pressure)
const
185 template <
class Evaluation>
187 const Evaluation& temperature,
188 const Evaluation& pressure,
189 const Evaluation& rv,
190 const Evaluation& rvw)
const
192 OPM_TIMEFUNCTION_LOCAL();
193 if (!enableVaporization_) {
195 gasReferenceDensity_[regionIdx];
199 const auto& rhoCo2 =
CO2::gasDensity(temperature, pressure, extrapolate);
206 return rhoCo2 / (gasReferenceDensity_[regionIdx] +
207 max(rvw,rv) * brineReferenceDensity_[regionIdx]);
213 template <
class Evaluation>
215 const Evaluation& temperature,
216 const Evaluation& pressure)
const
218 OPM_TIMEFUNCTION_LOCAL();
219 const Evaluation rvw = rvwSat_(regionIdx, temperature, pressure,
220 Evaluation(salinity_[regionIdx]));
222 pressure, Evaluation(0.0), rvw);
232 template <
class Evaluation>
235 const Evaluation& )
const
241 template <
class Evaluation>
243 const Evaluation& temperature,
244 const Evaluation& pressure)
const
245 {
return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx])); }
250 template <
class Evaluation = Scalar>
252 const Evaluation& temperature,
253 const Evaluation& pressure,
254 const Evaluation& saltConcentration)
const
256 OPM_TIMEFUNCTION_LOCAL();
257 const Evaluation salinity = salinityFromConcentration(temperature, pressure,
259 return rvwSat_(regionIdx, temperature, pressure, salinity);
265 template <
class Evaluation>
267 const Evaluation& temperature,
268 const Evaluation& pressure,
270 const Evaluation& )
const
271 {
return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx])); }
276 template <
class Evaluation>
278 const Evaluation& temperature,
279 const Evaluation& pressure)
const
280 {
return rvwSat_(regionIdx, temperature, pressure, Evaluation(salinity_[regionIdx])); }
282 template <
class Evaluation>
283 Evaluation diffusionCoefficient(
const Evaluation& temperature,
284 const Evaluation& pressure,
290 Scalar gasReferenceDensity(
unsigned regionIdx)
const
291 {
return gasReferenceDensity_[regionIdx]; }
293 Scalar oilReferenceDensity(
unsigned regionIdx)
const
294 {
return brineReferenceDensity_[regionIdx]; }
296 Scalar waterReferenceDensity(
unsigned regionIdx)
const
297 {
return brineReferenceDensity_[regionIdx]; }
299 Scalar salinity(
unsigned regionIdx)
const
300 {
return salinity_[regionIdx]; }
302 void setEzrokhiDenCoeff(
const std::vector<EzrokhiTable>& denaqa);
305 template <
class LhsEval>
306 LhsEval ezrokhiExponent_(
const LhsEval& temperature,
307 const std::vector<Scalar>& ezrokhiCoeff)
const
309 const LhsEval& tempC = temperature - 273.15;
310 return ezrokhiCoeff[0] + tempC * (ezrokhiCoeff[1] + ezrokhiCoeff[2] * tempC);
313 template <
class LhsEval>
314 LhsEval rvwSat_(
unsigned regionIdx,
315 const LhsEval& temperature,
316 const LhsEval& pressure,
317 const LhsEval& salinity)
const
319 OPM_TIMEFUNCTION_LOCAL();
320 if (!enableVaporization_) {
338 xgH2O = max(0.0, min(1.0, xgH2O));
340 return convertXgWToRvw(convertxgWToXgW(xgH2O, salinity), regionIdx);
347 template <
class LhsEval>
348 LhsEval convertXgWToRvw(
const LhsEval& XgW,
unsigned regionIdx)
const
350 OPM_TIMEFUNCTION_LOCAL();
351 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
352 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
354 return XgW / (1.0 - XgW) * (rho_gRef / rho_wRef);
361 template <
class LhsEval>
362 LhsEval convertRvwToXgW_(
const LhsEval& Rvw,
unsigned regionIdx)
const
364 OPM_TIMEFUNCTION_LOCAL();
365 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
366 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
368 const LhsEval& rho_wG = Rvw * rho_wRef;
369 return rho_wG / (rho_gRef + rho_wG);
374 template <
class LhsEval>
375 LhsEval convertxgWToXgW(
const LhsEval& xgW,
const LhsEval& salinity)
const
377 OPM_TIMEFUNCTION_LOCAL();
381 return xgW * M_Brine / (xgW * (M_Brine - M_CO2) + M_CO2);
384 template <
class LhsEval>
385 const LhsEval salinityFromConcentration(
const LhsEval&T,
const LhsEval& P,
386 const LhsEval& saltConcentration)
const
389 std::vector<Scalar> brineReferenceDensity_{};
390 std::vector<Scalar> gasReferenceDensity_{};
391 std::vector<Scalar> salinity_{};
392 std::vector<Scalar> ezrokhiDenNaClCoeff_{};
393 bool enableEzrokhiDensity_ =
false;
394 bool enableVaporization_ =
true;
395 int activityModel_{};
396 Co2StoreConfig::GasMixingType gastype_{};
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:45
static void calculateMoleFractions(const Evaluation &temperature, const Evaluation &pg, const Evaluation &salinity, const int knownPhaseIdx, Evaluation &xlCO2, Evaluation &ygH2O, const int &activityModel, 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:100
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:59
A class for the brine fluid properties.
Definition BrineDynamic.hpp:48
A class for the CO2 fluid properties.
Definition CO2.hpp:54
static Evaluation gasViscosity(Evaluation temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity [Pa s] of CO2.
Definition CO2.hpp:208
static Scalar molarMass()
The mass in [kg] of one mole of CO2.
Definition CO2.hpp:71
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of CO2 [J/kg].
Definition CO2.hpp:180
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:194
This class represents the Pressure-Volume-Temperature relations of the gas phase for CO2.
Definition Co2GasPvt.hpp:55
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:133
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:214
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:266
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:173
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:242
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefBrine, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition Co2GasPvt.cpp: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 Co2GasPvt.hpp:277
void initEnd()
Finish initializing the co2 phase PVT properties.
Definition Co2GasPvt.hpp:116
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:251
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:233
void setEnableVaporizationWater(bool yesno)
Specify whether the PVT model should consider that the water component can vaporize in the gas phase.
Definition Co2GasPvt.hpp:100
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition Co2GasPvt.hpp:123
void setThermalMixingModel(int thermalMixingModel)
Set thermal mixing model for co2 in brine.
Definition Co2GasPvt.cpp:141
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:162
void setActivityModelSalt(int activityModel)
Set activity coefficient model for salt in solubility model.
Definition Co2GasPvt.cpp:128
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:186
static Scalar molarMass()
The molar mass in of the component.
Definition Component.hpp:93
Definition EclipseState.hpp:63
Definition Schedule.hpp:89
A simple version of pure water with density from Hu et al.
Definition SimpleHuDuanH2O.hpp:65
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
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam .
Definition SimpleHuDuanH2O.hpp:224
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30