31#include <opm/common/TimingMacros.hpp>
32#include <opm/common/ErrorMacros.hpp>
33#include <opm/common/utility/gpuDecorators.hpp>
39#include <opm/material/components/CO2Tables.hpp>
56template <
class Scalar,
class ParamsT = Opm::CO2Tables<
double, std::vector<
double>>>
60 using Params = ParamsT;
62 static constexpr const Scalar brineSalinity = 1.000000000000000e-01;
67 OPM_HOST_DEVICE
static std::string_view
name()
80 {
return 273.15 + 30.95; }
92 {
return 273.15 - 56.35; }
136 template <
class Evaluation>
139 static constexpr Scalar a[4] =
140 { -7.0602087, 1.9391218, -1.6463597, -3.2995634 };
141 static constexpr Scalar t[4] =
142 { 1.0, 1.5, 2.0, 4.0 };
145 Evaluation exponent = 0;
147 for (
int i = 0; i < 4; ++i)
148 exponent += a[i]*pow(1 - Tred, t[i]);
149 exponent *= 1.0/Tred;
170 template <
class Evaluation>
171 OPM_HOST_DEVICE
static Evaluation
gasEnthalpy(
const Params& params,
172 const Evaluation& temperature,
173 const Evaluation& pressure,
174 bool extrapolate =
false)
176 return params.tabulatedEnthalpy.eval(temperature, pressure, extrapolate);
183 template <
class Evaluation>
184 OPM_HOST_DEVICE
static Evaluation
gasEnthalpy([[maybe_unused]]
const Evaluation& temperature,
185 [[maybe_unused]]
const Evaluation& pressure,
186 [[maybe_unused]]
bool extrapolate =
false)
188 OPM_THROW(std::runtime_error,
"This function should not be called");
194 template <
class Evaluation>
196 const Evaluation& temperature,
197 const Evaluation& pressure,
198 bool extrapolate =
false)
200 const Evaluation h =
gasEnthalpy(params, temperature, pressure, extrapolate);
201 const Evaluation rho =
gasDensity(params, temperature, pressure, extrapolate);
203 return h - (pressure / rho);
210 template <
class Evaluation>
211 OPM_HOST_DEVICE
static Evaluation
gasInternalEnergy([[maybe_unused]]
const Evaluation& temperature,
212 [[maybe_unused]]
const Evaluation& pressure,
213 [[maybe_unused]]
bool extrapolate =
false)
215 OPM_THROW(std::runtime_error,
"This function should not be called");
221 template <
class Evaluation>
222 OPM_HOST_DEVICE
static Evaluation
gasDensity(
const Params& params,
223 const Evaluation& temperature,
224 const Evaluation& pressure,
225 bool extrapolate =
false)
227 return params.tabulatedDensity.eval(temperature, pressure, extrapolate);
234 template <
class Evaluation>
235 OPM_HOST_DEVICE
static Evaluation
gasDensity([[maybe_unused]]
const Evaluation& temperature,
236 [[maybe_unused]]
const Evaluation& pressure,
237 [[maybe_unused]]
bool extrapolate =
false)
239 OPM_THROW(std::runtime_error,
"This function should not be called");
248 template <
class Evaluation>
250 Evaluation temperature,
251 const Evaluation& pressure,
252 bool extrapolate =
false)
254 OPM_TIMEFUNCTION_LOCAL();
255 constexpr Scalar a0 = 0.235156;
256 constexpr Scalar a1 = -0.491266;
257 constexpr Scalar a2 = 5.211155e-2;
258 constexpr Scalar a3 = 5.347906e-2;
259 constexpr Scalar a4 = -1.537102e-2;
261 constexpr Scalar d11 = 0.4071119e-2;
262 constexpr Scalar d21 = 0.7198037e-4;
263 constexpr Scalar d64 = 0.2411697e-16;
264 constexpr Scalar d81 = 0.2971072e-22;
265 constexpr Scalar d82 = -0.1627888e-22;
267 constexpr Scalar ESP = 251.196;
269 if(temperature < 275.)
271 Evaluation TStar = temperature/ESP;
274 const Evaluation logTStar = log(TStar);
275 Evaluation SigmaStar = exp(a0 + logTStar*(a1 + logTStar*(a2 + logTStar*(a3 + logTStar*a4))));
277 Evaluation mu0 = 1.00697*sqrt(temperature) / SigmaStar;
279 const Evaluation rho =
gasDensity(params, temperature, pressure, extrapolate);
285 + d64*pow(rho, 6.0)/(TStar*TStar*TStar)
287 + d82*pow(rho, 8.0)/TStar;
289 return (mu0 + dmu)/1.0e6;
297 template <
class Evaluation>
298 OPM_HOST_DEVICE
static Evaluation
gasViscosity([[maybe_unused]] Evaluation temperature,
299 [[maybe_unused]]
const Evaluation& pressure,
300 [[maybe_unused]]
bool extrapolate =
false)
302 OPM_THROW(std::runtime_error,
"This function should not be called");
315 template <
class Evaluation>
316 OPM_HOST_DEVICE
static Evaluation
gasHeatCapacity(
const Params& params,
const Evaluation& temperature,
const Evaluation& pressure)
318 OPM_TIMEFUNCTION_LOCAL();
319 constexpr Scalar eps = 1e-6;
324 const Evaluation h1 =
gasEnthalpy(params, temperature - eps, pressure);
325 const Evaluation h2 =
gasEnthalpy(params, temperature + eps, pressure);
327 return (h2 - h1) / (2*eps) ;
335 template <
class Evaluation>
336 OPM_HOST_DEVICE
static Evaluation
gasHeatCapacity([[maybe_unused]]
const Evaluation& temperature, [[maybe_unused]]
const Evaluation& pressure)
338 OPM_THROW(std::runtime_error,
"This function should not be called");
Abstract base class of a pure chemical species.
Relations valid for an ideal gas.
A class for the CO2 fluid properties.
Definition CO2.hpp:58
static OPM_HOST_DEVICE std::string_view name()
A human readable name for the CO2.
Definition CO2.hpp:67
static OPM_HOST_DEVICE Scalar tripleTemperature()
Returns the temperature [K]at CO2's triple point.
Definition CO2.hpp:91
static OPM_HOST_DEVICE 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:235
static OPM_HOST_DEVICE Evaluation gasDensity(const Params ¶ms, 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:222
static OPM_HOST_DEVICE Scalar criticalPressure()
Returns the critical pressure [Pa] of CO2.
Definition CO2.hpp:85
static OPM_HOST_DEVICE Scalar molarMass()
The mass in [kg] of one mole of CO2.
Definition CO2.hpp:73
static OPM_HOST_DEVICE bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition CO2.hpp:164
static OPM_HOST_DEVICE Evaluation gasHeatCapacity(const Params ¶ms, const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of the component [J/kg] as a liquid.
Definition CO2.hpp:316
static OPM_HOST_DEVICE Scalar criticalTemperature()
Returns the critical temperature [K] of CO2.
Definition CO2.hpp:79
static OPM_HOST_DEVICE Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of the component [J/kg] as a liquid.
Definition CO2.hpp:336
static OPM_HOST_DEVICE Evaluation vaporPressure(const Evaluation &T)
Returns the pressure [Pa] at CO2's triple point.
Definition CO2.hpp:137
static OPM_HOST_DEVICE Evaluation gasInternalEnergy(const Params ¶ms, const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of CO2 [J/kg].
Definition CO2.hpp:195
static OPM_HOST_DEVICE Evaluation gasViscosity(Evaluation temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity [Pa s] of CO2.
Definition CO2.hpp:298
static OPM_HOST_DEVICE bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition CO2.hpp:158
static OPM_HOST_DEVICE Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific enthalpy of gaseous CO2 [J/kg].
Definition CO2.hpp:184
static OPM_HOST_DEVICE Scalar triplePressure()
Returns the pressure [Pa] at CO2's triple point.
Definition CO2.hpp:97
static OPM_HOST_DEVICE Evaluation gasEnthalpy(const Params ¶ms, const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific enthalpy of gaseous CO2 [J/kg].
Definition CO2.hpp:171
static OPM_HOST_DEVICE Evaluation gasViscosity(const Params ¶ms, Evaluation temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity [Pa s] of CO2.
Definition CO2.hpp:249
static OPM_HOST_DEVICE Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Specific internal energy of CO2 [J/kg].
Definition CO2.hpp:211
Abstract base class of a pure chemical species.
Definition Component.hpp:44
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30