00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00028 #ifndef OPM_CO2_HPP
00029 #define OPM_CO2_HPP
00030
00031 #include <opm/common/Exceptions.hpp>
00032 #include <opm/common/ErrorMacros.hpp>
00033 #include <opm/material/Constants.hpp>
00034 #include <opm/material/IdealGas.hpp>
00035 #include <opm/material/components/Component.hpp>
00036 #include <opm/material/common/MathToolbox.hpp>
00037
00038 #include <cmath>
00039 #include <iostream>
00040
00041 namespace Opm {
00042
00053 template <class Scalar, class CO2Tables>
00054 class CO2 : public Component<Scalar, CO2<Scalar, CO2Tables> >
00055 {
00056 static const Scalar R;
00057 static bool warningPrinted;
00058
00059 public:
00063 static const char* name()
00064 { return "CO2"; }
00065
00069 static Scalar molarMass()
00070 { return 44e-3; }
00071
00075 static Scalar criticalTemperature()
00076 { return 273.15 + 30.95; }
00077
00081 static Scalar criticalPressure()
00082 { return 73.8e5; }
00083
00087 static Scalar tripleTemperature()
00088 { return 273.15 - 56.35; }
00089
00093 static Scalar triplePressure()
00094 { return 5.11e5; }
00095
00099 static Scalar minTabulatedPressure()
00100 { return CO2Tables::tabulatedEnthalpy.minPress(); }
00101
00105 static Scalar maxTabulatedPressure()
00106 { return CO2Tables::tabulatedEnthalpy.maxPress(); }
00107
00111 static Scalar minTabulatedTemperature()
00112 { return CO2Tables::tabulatedEnthalpy.minTemp(); }
00113
00117 static Scalar maxTabulatedTemperature()
00118 { return CO2Tables::tabulatedEnthalpy.maxTemp(); }
00119
00132 template <class Evaluation>
00133 static Evaluation vaporPressure(const Evaluation& T)
00134 {
00135 static const Scalar a[4] =
00136 { -7.0602087, 1.9391218, -1.6463597, -3.2995634 };
00137 static const Scalar t[4] =
00138 { 1.0, 1.5, 2.0, 4.0 };
00139
00140
00141 Evaluation exponent = 0;
00142 Evaluation Tred = T/criticalTemperature();
00143 for (int i = 0; i < 5; ++i)
00144 exponent += a[i]*Opm::pow(1 - Tred, t[i]);
00145 exponent *= 1.0/Tred;
00146
00147 return Opm::exp(exponent)*criticalPressure();
00148 }
00149
00150
00154 static bool gasIsCompressible()
00155 { return true; }
00156
00160 static bool gasIsIdeal()
00161 { return false; }
00162
00166 template <class Evaluation>
00167 static Evaluation gasEnthalpy(const Evaluation& temperature,
00168 const Evaluation& pressure)
00169 {
00170 return CO2Tables::tabulatedEnthalpy.eval(temperature, pressure);
00171 }
00172
00176 template <class Evaluation>
00177 static Evaluation gasInternalEnergy(const Evaluation& temperature,
00178 const Evaluation& pressure)
00179 {
00180 const Evaluation& h = gasEnthalpy(temperature, pressure);
00181 const Evaluation& rho = gasDensity(temperature, pressure);
00182
00183 return h - (pressure / rho);
00184 }
00185
00189 template <class Evaluation>
00190 static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
00191 {
00192 return CO2Tables::tabulatedDensity.eval(temperature, pressure);
00193 }
00194
00201 template <class Evaluation>
00202 static Evaluation gasViscosity(Evaluation temperature, const Evaluation& pressure)
00203 {
00204 const Scalar a0 = 0.235156;
00205 const Scalar a1 = -0.491266;
00206 const Scalar a2 = 5.211155e-2;
00207 const Scalar a3 = 5.347906e-2;
00208 const Scalar a4 = -1.537102e-2;
00209
00210 const Scalar d11 = 0.4071119e-2;
00211 const Scalar d21 = 0.7198037e-4;
00212 const Scalar d64 = 0.2411697e-16;
00213 const Scalar d81 = 0.2971072e-22;
00214 const Scalar d82 = -0.1627888e-22;
00215
00216 const Scalar ESP = 251.196;
00217
00218 if(temperature < 275.)
00219 temperature = 275.0;
00220 Evaluation TStar = temperature/ESP;
00221
00222
00223 const Evaluation& logTStar = Opm::log(TStar);
00224 Evaluation SigmaStar = Opm::exp(a0 + logTStar*(a1 + logTStar*(a2 + logTStar*(a3 + logTStar*a4))));
00225
00226 Evaluation mu0 = 1.00697*Opm::sqrt(temperature) / SigmaStar;
00227
00228 const Evaluation& rho = gasDensity(temperature, pressure);
00229
00230
00231 Evaluation dmu =
00232 d11*rho
00233 + d21*rho*rho
00234 + d64*Opm::pow(rho, 6.0)/(TStar*TStar*TStar)
00235 + d81*Opm::pow(rho, 8.0)
00236 + d82*Opm::pow(rho, 8.0)/TStar;
00237
00238 return (mu0 + dmu)/1.0e6;
00239 }
00240
00251 template <class Evaluation>
00252 static Evaluation gasHeatCapacity(const Evaluation& temperature, const Evaluation& pressure)
00253 {
00254 Scalar eps = 1e-6;
00255
00256
00257
00258
00259 const Evaluation& h1 = gasEnthalpy(temperature - eps, pressure);
00260 const Evaluation& h2 = gasEnthalpy(temperature + eps, pressure);
00261
00262 return (h2 - h1) / (2*eps) ;
00263 }
00264 };
00265
00266 template <class Scalar, class CO2Tables>
00267 bool CO2<Scalar, CO2Tables>::warningPrinted = false;
00268
00269 template <class Scalar, class CO2Tables>
00270 const Scalar CO2<Scalar, CO2Tables>::R = Constants<Scalar>::R;
00271
00272 }
00273
00274 #endif