27#ifndef OPM_CO2_GAS_PVT_HPP
28#define OPM_CO2_GAS_PVT_HPP
51template <
class Scalar>
57 static constexpr bool extrapolate =
true;
65 Co2GasPvt(
const std::vector<Scalar>& salinity,
66 Scalar T_ref = 288.71,
67 Scalar P_ref = 101325)
70 int num_regions = salinity_.size();
71 setNumRegions(num_regions);
73 for (
int i = 0; i < num_regions; ++i) {
101 gasReferenceDensity_[regionIdx] = rhoRefGas;
102 brineReferenceDensity_[regionIdx] = rhoRefBrine;;
112 { enableVaporization_ = yesno; }
126 {
return gasReferenceDensity_.size(); }
131 template <
class Evaluation>
133 const Evaluation& temperature,
134 const Evaluation& pressure,
135 const Evaluation& rv,
136 const Evaluation& rvw)
const
139 Evaluation result = 0;
143 assert(rv == 0.0 || rvw == 0.0);
144 const Evaluation xBrine = convertRvwToXgW_(max(rvw,rv),regionIdx);
153 template <
class Evaluation>
155 const Evaluation& temperature,
156 const Evaluation& pressure,
158 const Evaluation& )
const
164 template <
class Evaluation>
166 const Evaluation& temperature,
167 const Evaluation& pressure)
const
176 template <
class Evaluation>
178 const Evaluation& temperature,
179 const Evaluation& pressure,
180 const Evaluation& rv,
181 const Evaluation& rvw)
const
184 if (!enableVaporization_)
185 return CO2::gasDensity(temperature, pressure, extrapolate)/gasReferenceDensity_[regionIdx];
190 assert(rv == 0.0 || rvw == 0.0);
191 const Evaluation xBrine = convertRvwToXgW_(max(rvw,rv),regionIdx);
192 const auto& rhoCo2 =
CO2::gasDensity(temperature, pressure, extrapolate);
194 return 1.0 / ( ( xBrine/rhoH2O + (1.0 - xBrine)/rhoCo2) * gasReferenceDensity_[regionIdx]);
200 template <
class Evaluation>
202 const Evaluation& temperature,
203 const Evaluation& pressure)
const
205 const Evaluation rvw = rvwSat_(regionIdx, temperature, pressure);
215 template <
class Evaluation>
218 const Evaluation& )
const
224 template <
class Evaluation>
226 const Evaluation& temperature,
227 const Evaluation& pressure)
const
228 {
return rvwSat_(regionIdx, temperature, pressure); }
233 template <
class Evaluation = Scalar>
235 const Evaluation& temperature,
236 const Evaluation& pressure,
237 const Evaluation& )
const
238 {
return rvwSat_(regionIdx, temperature, pressure); }
243 template <
class Evaluation>
245 const Evaluation& temperature,
246 const Evaluation& pressure,
248 const Evaluation& )
const
249 {
return rvwSat_(regionIdx, temperature, pressure); }
254 template <
class Evaluation>
256 const Evaluation& temperature,
257 const Evaluation& pressure)
const
258 {
return rvwSat_(regionIdx, temperature, pressure); }
260 template <
class Evaluation>
261 Evaluation diffusionCoefficient(
const Evaluation& temperature,
262 const Evaluation& pressure,
268 Scalar gasReferenceDensity(
unsigned regionIdx)
const
269 {
return gasReferenceDensity_[regionIdx]; }
271 Scalar oilReferenceDensity(
unsigned regionIdx)
const
272 {
return brineReferenceDensity_[regionIdx]; }
274 Scalar waterReferenceDensity(
unsigned regionIdx)
const
275 {
return brineReferenceDensity_[regionIdx]; }
277 Scalar salinity(
unsigned regionIdx)
const
278 {
return salinity_[regionIdx]; }
282 template <
class LhsEval>
283 LhsEval rvwSat_(
unsigned regionIdx,
284 const LhsEval& temperature,
285 const LhsEval& pressure)
const
287 if (!enableVaporization_)
296 salinity_[regionIdx],
303 xgH2O = max(0.0, min(1.0, xgH2O));
305 return convertXgWToRvw(convertxgWToXgW(xgH2O), regionIdx);
312 template <
class LhsEval>
313 LhsEval convertXgWToRvw(
const LhsEval& XgW,
unsigned regionIdx)
const
315 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
316 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
318 return XgW/(1.0 - XgW)*(rho_gRef/rho_wRef);
325 template <
class LhsEval>
326 LhsEval convertRvwToXgW_(
const LhsEval& Rvw,
unsigned regionIdx)
const
328 Scalar rho_wRef = brineReferenceDensity_[regionIdx];
329 Scalar rho_gRef = gasReferenceDensity_[regionIdx];
331 const LhsEval& rho_wG = Rvw*rho_wRef;
332 return rho_wG/(rho_gRef + rho_wG);
337 template <
class LhsEval>
338 LhsEval convertxgWToXgW(
const LhsEval& xgW)
const
343 return xgW*M_Brine / (xgW*(M_Brine - M_CO2) + M_CO2);
346 std::vector<Scalar> brineReferenceDensity_;
347 std::vector<Scalar> gasReferenceDensity_;
348 std::vector<Scalar> salinity_;
349 bool enableVaporization_ =
true;
A class for the brine fluid properties.
Binary coefficients for brine and CO2.
A class for the CO2 fluid properties.
Binary coefficients for brine and CO2.
Definition: Brine_CO2.hpp:42
static void calculateMoleFractions(const Evaluation &temperature, const Evaluation &pg, Scalar 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
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
A class for the brine fluid properties.
Definition: Brine.hpp:46
static Scalar molarMass()
The molar mass in of the component.
Definition: Brine.hpp:80
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The density of the liquid component at a given pressure in and temperature in .
Definition: Brine.hpp:262
static Scalar salinity
The mass fraction of salt assumed to be in the brine.
Definition: Brine.hpp:49
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:53
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:132
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:201
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:244
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:165
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:225
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefBrine, Scalar rhoRefGas, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition: Co2GasPvt.hpp:96
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:255
void initEnd()
Finish initializing the co2 phase PVT properties.
Definition: Co2GasPvt.hpp:117
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:216
Evaluation saturatedWaterVaporizationFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &) const
Returns the water vaporization factor [m^3/m^3] of water phase.
Definition: Co2GasPvt.hpp:234
void setEnableVaporizationWater(bool yesno)
Specify whether the PVT model should consider that the water component can vaporize in the gas phase.
Definition: Co2GasPvt.hpp:111
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: Co2GasPvt.hpp:125
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:154
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:177
Definition: EclipseState.hpp:55
Definition: Schedule.hpp:130
A simple version of pure water with density from Hu et al.
Definition: SimpleHuDuanH2O.hpp:63
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam at a given pressure and temperature.
Definition: SimpleHuDuanH2O.hpp:274
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam .
Definition: SimpleHuDuanH2O.hpp:217
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30