Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HighPressureGasTransport.cpp
Go to the documentation of this file.
1 /**
2  * @file HighPressureGasTransport.cpp
3  * Implementation file for class HighPressureGasTransport
4  *
5  * Transport parameters are calculated using corresponding states models:
6  * Binary diffusion coefficients use the generalized chart described by
7  * Takahashi, et al. and viscosity calcualtions use the Lucas method.
8  * All methods are described in Reid, Prausnitz, and Polling, "The Properties
9  * of Gases and Liquids, 4th ed., 1987 (viscosity in Ch. 9, Thermal
10  * conductivity in Ch. 10, and Diffusion coefficients in Ch. 11).
11  *
12  **/
15 #include "cantera/base/utilities.h"
21 
22 using namespace std;
23 
24 namespace Cantera
25 {
26 
27 
28 //////////////////// class HighPressureGasTransport methods //////////////
29 
30 HighPressureGasTransport::HighPressureGasTransport(thermo_t* thermo)
31 : MultiTransport(thermo)
32 {
33 }
34 
36 {
37  // Method of Ely and Hanley:
38  update_T();
39 
40  doublereal Lprime_m = 0.0;
41 
42  const doublereal c1 = 1./16.04;
43 
44  size_t nsp = m_thermo->nSpecies();
45  vector_fp molefracs(nsp);
46  m_thermo->getMoleFractions(&molefracs[0]);
47  vector_fp cp_0_R(nsp);
48  m_thermo->getCp_R_ref(&cp_0_R[0]);
49 
50  std::vector<doublereal> L_i(nsp);
51  std::vector<doublereal> f_i(nsp);
52  std::vector<doublereal> h_i(nsp);
53  std::vector<doublereal> V_k(nsp);
54 
55  m_thermo -> getPartialMolarVolumes(&V_k[0]);
56 
57  doublereal L_i_min = BigNumber;
58 
59  for (size_t i = 0; i < m_nsp; i++) {
60  doublereal Tc_i = Tcrit_i(i);
61  doublereal Vc_i = Vcrit_i(i);
62  doublereal T_r = m_thermo->temperature()/Tc_i;
63  doublereal V_r = V_k[i]/Vc_i;
64  doublereal T_p = std::min(T_r,2.0);
65  doublereal V_p = std::max(0.5,std::min(V_r,2.0));
66 
67  // Calculate variables for density-independent component:
68  doublereal theta_p = 1.0 + (m_w_ac[i] - 0.011)*(0.56553
69  - 0.86276*log(T_p) - 0.69852/T_p);
70  doublereal phi_p = (1.0 + (m_w_ac[i] - 0.011)*(0.38560
71  - 1.1617*log(T_p)))*0.288/Zcrit_i(i);
72  doublereal f_fac = Tc_i*theta_p/190.4;
73  doublereal h_fac = 1000*Vc_i*phi_p/99.2;
74  doublereal T_0 = m_temp/f_fac;
75  doublereal mu_0 = 1e-7*(2.90774e6/T_0 - 3.31287e6*pow(T_0,-2./3.)
76  + 1.60810e6*pow(T_0,-1./3.) - 4.33190e5 + 7.06248e4*pow(T_0,1./3.)
77  - 7.11662e3*pow(T_0,2./3.) + 4.32517e2*T_0 - 1.44591e1*pow(T_0,4./3.)
78  + 2.03712e-1*pow(T_0,5./3.));
79  doublereal H = sqrt(f_fac*16.04/m_mw[i])*pow(h_fac,-2./3.);
80  doublereal mu_i = mu_0*H*m_mw[i]*c1;
81  L_i[i] = mu_i*1.32*GasConstant*(cp_0_R[i] - 2.5)/m_mw[i];
82  L_i_min = min(L_i_min,L_i[i]);
83  // Calculate variables for density-dependent component:
84  doublereal theta_s = 1 + (m_w_ac[i] - 0.011)*(0.09057 - 0.86276*log(T_p)
85  + (0.31664 - 0.46568/T_p)*(V_p - 0.5));
86  doublereal phi_s = (1 + (m_w_ac[i] - 0.011)*(0.39490*(V_p - 1.02355)
87  - 0.93281*(V_p - 0.75464)*log(T_p)))*0.288/Zcrit_i(i);
88  f_i[i] = Tc_i*theta_s/190.4;
89  h_i[i] = 1000*Vc_i*phi_s/99.2;
90  }
91 
92  doublereal h_m = 0;
93  doublereal f_m = 0;
94  doublereal mw_m = 0;
95  for (size_t i = 0; i < m_nsp; i++) {
96  for (size_t j = 0; j < m_nsp; j++) {
97  // Density-independent component:
98  doublereal L_ij = 2*L_i[i]*L_i[j]/(L_i[i] + L_i[j] + Tiny);
99  Lprime_m += molefracs[i]*molefracs[j]*L_ij;
100  // Additional variables for density-dependent component:
101  doublereal f_ij = sqrt(f_i[i]*f_i[j]);
102  doublereal h_ij = 0.125*pow(pow(h_i[i],1./3.) + pow(h_i[j],1./3.),3.);
103  doublereal mw_ij_inv = (m_mw[i] + m_mw[j])/(2*m_mw[i]*m_mw[j]);
104  f_m += molefracs[i]*molefracs[j]*f_ij*h_ij;
105  h_m += molefracs[i]*molefracs[j]*h_ij;
106  mw_m += molefracs[i]*molefracs[j]*sqrt(mw_ij_inv*f_ij)*pow(h_ij,-4./3.);
107  }
108  }
109 
110  f_m = f_m/h_m;
111  mw_m = pow(mw_m,-2.)*f_m*pow(h_m,-8./3.);
112 
113  doublereal rho_0 = 16.04*h_m/(1000*m_thermo->molarVolume());
114  doublereal T_0 = m_temp/f_m;
115  doublereal mu_0 = 1e-7*(2.90774e6/T_0 - 3.31287e6*pow(T_0,-2./3.)
116  + 1.60810e6*pow(T_0,-1./3.) - 4.33190e5 + 7.06248e4
117  *pow(T_0,1./3.) - 7.11662e3*pow(T_0,2./3.) + 4.32517e2*T_0
118  - 1.44591e1*pow(T_0,4./3.) + 2.03712e-1*pow(T_0,5./3.));
119  doublereal L_1m = 1944*mu_0;
120  doublereal L_2m = (-2.5276e-4 + 3.3433e-4*pow(1.12 - log(T_0/1.680e2),2))*rho_0;
121  doublereal L_3m = exp(-7.19771 + 85.67822/T_0)*(exp((12.47183
122  - 984.6252*pow(T_0,-1.5))*pow(rho_0,0.1) + (rho_0/0.1617 - 1)
123  *sqrt(rho_0)*(0.3594685 + 69.79841/T_0 - 872.8833*pow(T_0,-2))) - 1.)*1e-3;
124  doublereal H_m = sqrt(f_m*16.04/mw_m)*pow(h_m,-2./3.);
125  doublereal Lstar_m = H_m*(L_1m + L_2m + L_3m);
126 
127  return Lprime_m + Lstar_m;
128 
129 }
130 
132 {
133  // Method for MultiTransport class:
134  // solveLMatrixEquation();
135  // const doublereal c = 1.6/GasConstant;
136  // for (size_t k = 0; k < m_nsp; k++) {
137  // dt[k] = c * m_mw[k] * m_molefracs[k] * m_a[k];
138  // }
139  throw CanteraError("HighPressureGasTransport::getThermalDiffCoeffs",
140  "Not yet implemented.");
141 }
142 
143 void HighPressureGasTransport::getBinaryDiffCoeffs(const size_t ld, doublereal* const d)
144 {
145  doublereal P_corr_ij, Tr_ij, Pr_ij;
146  std::vector<double> PcP(5);
147 
148  size_t nsp = m_thermo->nSpecies();
149  vector_fp molefracs(nsp);
150  m_thermo->getMoleFractions(&molefracs[0]);
151 
152  update_T();
153  // Evaluate the binary diffusion coefficients from the polynomial fits.
154  // This should perhaps be preceded by a check to see whether any of T, P, or
155  // C have changed.
156  //if (!m_bindiff_ok) {
157  updateDiff_T();
158  //}
159  if (ld < nsp) {
160  throw CanteraError("HighPressureTransport::getBinaryDiffCoeffs()", "ld is too small");
161  }
162  doublereal rp = 1.0/m_thermo->pressure();
163  for (size_t i = 0; i < nsp; i++)
164  {
165  for (size_t j = 0; j < nsp; j++) {
166  // Add an offset to avoid a condition where x_i and x_j both equal
167  // zero (this would lead to Pr_ij = Inf):
168  doublereal x_i = std::max(Tiny, molefracs[i]);
169  doublereal x_j = std::max(Tiny, molefracs[j]);
170 
171  // Weight mole fractions of i and j so that X_i + X_j = 1.0:
172  x_i = x_i/(x_i + x_j);
173  x_j = x_j/(x_i + x_j);
174 
175  //Calculate Tr and Pr based on mole-fraction-weighted crit constants:
176  Tr_ij = m_temp/(x_i*Tcrit_i(i) + x_j*Tcrit_i(j));
177  Pr_ij = m_thermo->pressure()/(x_i*Pcrit_i(i) + x_j*Pcrit_i(j));
178 
179  if (Pr_ij < 0.1) {
180  // If pressure is low enough, no correction is needed:
181  P_corr_ij = 1;
182  }else {
183  // Otherwise, calculate the parameters for Takahashi correlation
184  // by interpolating on Pr_ij:
185  P_corr_ij = setPcorr(Pr_ij, Tr_ij);
186 
187  // If the reduced temperature is too low, the correction factor
188  // P_corr_ij will be < 0:
189  if (P_corr_ij<0) {
190  P_corr_ij = Tiny;
191  }
192  }
193 
194  // Multiply the standard low-pressure binary diffusion coefficient
195  // (m_bdiff) by the Takahashi correction factor P_corr_ij:
196  d[ld*j + i] = P_corr_ij*rp * m_bdiff(i,j);
197  }
198  }
199 }
200 
201 void HighPressureGasTransport::getMultiDiffCoeffs(const size_t ld, doublereal* const d)
202 {
203  // Not currently implemented. m_Lmatrix inversion returns NaN. Needs to be
204  // fixed. --SCD - 2-28-2014
205  throw CanteraError("HighPressureTransport:getMultiDiffCoeffs()",
206  "Routine not yet implemented");
207  // Calculate the multi-component Stefan-Maxwell diffusion coefficients,
208  // based on the Takahashi-correlation-corrected binary diffusion coefficients.
209 
210  // update the mole fractions
211  update_C();
212 
213  // update the binary diffusion coefficients
214  update_T();
215  updateThermal_T();
216 
217  // Correct the binary diffusion coefficients for high-pressure effects; this
218  // is basically the same routine used in 'getBinaryDiffCoeffs,' above:
219  doublereal P_corr_ij, Tr_ij, Pr_ij;
220 
221  size_t nsp = m_thermo->nSpecies();
222  vector_fp molefracs(nsp);
223  m_thermo->getMoleFractions(&molefracs[0]);
224 
225  update_T();
226  // Evaluate the binary diffusion coefficients from the polynomial fits -
227  // this should perhaps be preceded by a check for changes in T, P, or C.
228  //if (!m_bindiff_ok) {
229  updateDiff_T();
230  //}
231  if (ld < m_nsp) {
232  throw CanteraError("HighPressureTransport::getMultiDiffCoeffs()",
233  "ld is too small");
234  }
235  for (size_t i = 0; i < m_nsp; i++)
236  {
237  for (size_t j = 0; j < m_nsp; j++) {
238  // Add an offset to avoid a condition where x_i and x_j both equal
239  // zero (this would lead to Pr_ij = Inf):
240  doublereal x_i = std::max(Tiny, molefracs[i]);
241  doublereal x_j = std::max(Tiny, molefracs[j]);
242 
243  x_i = x_i/(x_i+x_j);
244  x_j = x_j/(x_i+x_j);
245  Tr_ij = m_temp/(x_i*Tcrit_i(i) + x_j*Tcrit_i(j));
246  Pr_ij = m_thermo->pressure()/(x_i*Pcrit_i(i) + x_j*Pcrit_i(j));
247 
248  if (Pr_ij < 0.1) {
249  P_corr_ij = 1;
250  }else {
251  P_corr_ij = setPcorr(Pr_ij, Tr_ij);
252  if (P_corr_ij<0) {
253  P_corr_ij = Tiny;
254  }
255  }
256 
257  m_bdiff(i,j) *= P_corr_ij;
258  }
259  }
260  m_bindiff_ok = false; // m_bdiff is overwritten by the above routine.
261 
262  // Having corrected m_bdiff for pressure and concentration effects, the
263  // routine now procedes the same as in the low-pressure case:
264 
265  // evaluate L0000 if the temperature or concentrations have
266  // changed since it was last evaluated.
267  if (!m_l0000_ok) {
268  eval_L0000(DATA_PTR(molefracs));
269  }
270 
271  // invert L00,00
272  int ierr = invert(m_Lmatrix, m_nsp);
273  if (ierr != 0) {
274  throw CanteraError("HighPressureGasTransport::getMultiDiffCoeffs",
275  string(" invert returned ierr = ")+int2str(ierr));
276  }
277  m_l0000_ok = false; // matrix is overwritten by inverse
278  m_lmatrix_soln_ok = false;
279 
280  doublereal pres = m_thermo->pressure();
281  doublereal prefactor = 16.0 * m_temp
282  *m_thermo->meanMolecularWeight()/(25.0*pres);
283  doublereal c;
284 
285  for (size_t i = 0; i < m_nsp; i++) {
286  for (size_t j = 0; j < m_nsp; j++) {
287  c = prefactor/m_mw[j];
288  d[ld*j + i] = c*molefracs[i]*(m_Lmatrix(i,j) - m_Lmatrix(i,i));
289  }
290  }
291 }
292 
294 {
295  // Calculate the high-pressure mixture viscosity, based on the Lucas method.
296 
297  double Tc_mix = 0.;
298  double Pc_mix_n = 0.;
299  double Pc_mix_d = 0.;
300  double MW_mix = m_thermo->meanMolecularWeight();
301  doublereal x_H, Tc, Zc, Tr, Afac, Z1m, Z2m;
302  double MW_H = m_mw[0];
303  double MW_L = m_mw[0];
304  doublereal FP_mix_o = 0;
305  doublereal FQ_mix_o = 0;
306  doublereal tKelvin = m_thermo->temperature();
307  double Pvp_mix = m_thermo->satPressure(tKelvin);
308 
309  size_t nsp = m_thermo->nSpecies();
310  vector_fp molefracs(nsp);
311  m_thermo->getMoleFractions(&molefracs[0]);
312 
313  x_H = molefracs[0];
314  for (size_t i = 0; i < m_nsp; i++) {
315  // Calculate pure-species critical constants and add their contribution
316  // to the mole-fraction-weighted mixture averages:
317  Tc = Tcrit_i(i);
318  Tr = tKelvin/Tc;
319  Zc = Zcrit_i(i);
320  Tc_mix += Tc*molefracs[i];
321  Pc_mix_n += molefracs[i]*Zc; //numerator
322  Pc_mix_d += molefracs[i]*Vcrit_i(i); //denominator
323 
324  // Need to calculate ratio of heaviest to lightest species:
325  if (m_mw[i] > MW_H) {
326  MW_H = m_mw[i];
327  x_H = molefracs[i];
328  } else if (m_mw[i] < MW_L) {
329  MW_L = m_mw[i]; }
330 
331  // Calculate reduced dipole moment for polar correction term:
332  doublereal mu_ri = 52.46*100000*m_dipole(i,i)*m_dipole(i,i)
333  *Pcrit_i(i)/(Tc*Tc);
334  if (mu_ri < 0.022) {
335  FP_mix_o += molefracs[i];
336  } else if (mu_ri < 0.075) {
337  FP_mix_o += molefracs[i]*(1. + 30.55*pow(0.292 - Zc, 1.72));
338  } else { FP_mix_o += molefracs[i]*(1. + 30.55*pow(0.292 - Zc, 1.72)
339  *fabs(0.96 + 0.1*(Tr - 0.7)));
340  }
341 
342  // Calculate contribution to quantum correction term.
343  // SCD Note: This assumes the species of interest (He, H2, and D2) have
344  // been named in this specific way. They are perhaps the most obvious
345  // names, butit would of course be preferred to have a more general
346  // approach, here.
347  std::vector<std::string> spnames = m_thermo->speciesNames();
348  if (spnames[i] == "He") {
349  FQ_mix_o += molefracs[i]*FQ_i(1.38,Tr,m_mw[i]);
350  } else if (spnames[i] == "H2") {
351  FQ_mix_o += molefracs[i]*(FQ_i(0.76,Tr,m_mw[i]));
352  } else if (spnames[i] == "D2") {
353  FQ_mix_o += molefracs[i]*(FQ_i(0.52,Tr,m_mw[i]));
354  } else {
355  FQ_mix_o += molefracs[i];
356  }
357  }
358 
359  double Tr_mix = tKelvin/Tc_mix;
360  double Pc_mix = GasConstant*Tc_mix*Pc_mix_n/Pc_mix_d;
361  double Pr_mix = m_thermo->pressure()/Pc_mix;
362  double ratio = MW_H/MW_L;
363 
364  double ksi = pow(GasConstant*Tc_mix*3.6277*pow(10.0,53.0)/(pow(MW_mix,3)
365  *pow(Pc_mix,4)),1.0/6.0);
366 
367  if (ratio > 9 && x_H > 0.05 && x_H < 0.7) {
368  Afac = 1 - 0.01*pow(ratio,0.87);
369  } else {
370  Afac = 1;
371  }
372  FQ_mix_o *= Afac;
373 
374  // Calculate Z1m
375  Z1m = (0.807*pow(Tr_mix,0.618) - 0.357*exp(-0.449*Tr_mix)
376  + 0.340*exp(-4.058*Tr_mix)+0.018)*FP_mix_o*FQ_mix_o;
377 
378  // Calculate Z2m:
379  if (Tr_mix <= 1.0){
380  if (Pr_mix < Pvp_mix/Pc_mix) {
381  doublereal alpha = 3.262 + 14.98*pow(Pr_mix,5.508);
382  doublereal beta = 1.390 + 5.746*Pr_mix;
383  Z2m = 0.600 + 0.760*pow(Pr_mix,alpha) + (0.6990*pow(Pr_mix,beta) -
384  0.60)*(1- Tr_mix);
385  } else {
386  throw CanteraError("HighPressureGasTransport::viscosity",
387  "State is outside the limits of the Lucas model, Tr <= 1");
388  }
389  } else if ((Tr_mix > 1.0) && (Tr_mix < 40.0)) {
390  if ((Pr_mix > 0.0) && (Pr_mix <= 100.0)) {
391  doublereal a_fac = 0.001245*exp(5.1726*pow(Tr_mix,-0.3286))/Tr_mix;
392  doublereal b_fac = a_fac*(1.6553*Tr_mix - 1.2723);
393  doublereal c_fac = 0.4489*exp(3.0578*pow(Tr_mix,-37.7332))/Tr_mix;
394  doublereal d_fac = 1.7368*exp(2.2310*pow(Tr_mix,-7.6351))/Tr_mix;
395  doublereal f_fac = 0.9425*exp(-0.1853*pow(Tr_mix,0.4489));
396 
397  Z2m = Z1m*(1 + a_fac*pow(Pr_mix,1.3088)/(b_fac*pow(Pr_mix,f_fac)
398  + pow(1+c_fac*pow(Pr_mix,d_fac),-1)));
399  } else {
400  throw CanteraError("HighPressureGasTransport::viscosity",
401  "State is outside the limits of the Lucas model, 1.0 < Tr < 40");
402  }
403  } else {
404  throw CanteraError("HighPressureGasTransport::viscosity",
405  "State is outside the limits of the Lucas model, Tr > 40");
406  }
407 
408  // Calculate Y:
409  doublereal Y = Z2m/Z1m;
410 
411  // Return the viscosity:
412  return Z2m*(1 + (FP_mix_o - 1)*pow(Y,-3))*(1 + (FQ_mix_o - 1)
413  *(1/Y - 0.007*pow(log(Y),4)))/(ksi*FP_mix_o*FQ_mix_o);
414 }
415 
416 // Pure species critical properties - Tc, Pc, Vc, Zc:
417 doublereal HighPressureGasTransport::Tcrit_i(size_t i)
418 {
419  size_t nsp = m_thermo->nSpecies();
420  // Store current molefracs and set temp molefrac of species i to 1.0:
421  vector_fp molefracs = store(i,nsp);
422 
423  double tc = m_thermo->critTemperature();
424  // Restore actual molefracs:
425  m_thermo->setMoleFractions(&molefracs[0]);
426  return tc;
427 }
428 
429 doublereal HighPressureGasTransport::Pcrit_i(size_t i)
430 {
431  size_t nsp = m_thermo->nSpecies();
432  // Store current molefracs and set temp molefrac of species i to 1.0:
433  vector_fp molefracs = store(i,nsp);
434 
435  double pc = m_thermo->critPressure();
436  // Restore actual molefracs:
437  m_thermo->setMoleFractions(&molefracs[0]);
438  return pc;
439 }
440 
441 doublereal HighPressureGasTransport::Vcrit_i(size_t i)
442 {
443  size_t nsp = m_thermo->nSpecies();
444  // Store current molefracs and set temp molefrac of species i to 1.0:
445  vector_fp molefracs = store(i,nsp);
446 
447  double vc = m_thermo->critVolume();
448  // Restore actual molefracs:
449  m_thermo->setMoleFractions(&molefracs[0]);
450  return vc;
451 }
452 
453 doublereal HighPressureGasTransport::Zcrit_i(size_t i)
454 {
455  size_t nsp = m_thermo->nSpecies();
456  // Store current molefracs and set temp molefrac of species i to 1.0:
457  vector_fp molefracs = store(i,nsp);
458 
459  double zc = m_thermo->critCompressibility();
460  // Restore actual molefracs:
461  m_thermo->setMoleFractions(&molefracs[0]);
462 
463  return zc;
464 }
465 
466 vector_fp HighPressureGasTransport::store(size_t i, size_t nsp)
467 {
468  vector_fp molefracs(nsp);
469  m_thermo->getMoleFractions(&molefracs[0]);
470 
471  vector_fp mf_temp(nsp);
472  for (size_t j = 0; j < nsp; j++) {
473  if (j == i) {
474  mf_temp[j] = 1;
475  } else {mf_temp[j] = 0;}
476  }
477  m_thermo->setMoleFractions(&mf_temp[0]);
478 
479  return molefracs;
480 }
481 
482 // Calculates quantum correction term for a species based on Tr and MW, used in
483 // viscosity calculation:
484 doublereal HighPressureGasTransport::FQ_i(doublereal Q, doublereal Tr, doublereal MW)
485 {
486  return 1.22*pow(Q,0.15)*(1 + 0.00385*pow(pow(Tr - 12.,2.),1./MW)
487  *fabs(Tr-12)/(Tr-12));
488 }
489 
490 // Set value of parameter values for Takahashi correlation, by interpolating
491 // table of constants vs. Pr:
492 doublereal HighPressureGasTransport::setPcorr(doublereal Pr, doublereal Tr)
493 {
494  const static double Pr_lookup[17] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0,
495  1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0, 4.0, 5.0};
496  const static double DP_Rt_lookup[17] = {1.01, 1.01, 1.01, 1.01, 1.01, 1.01,
497  1.01, 1.02, 1.02, 1.02, 1.02, 1.03, 1.03, 1.04, 1.05, 1.06, 1.07};
498  const static double A_ij_lookup[17] = {0.038042, 0.067433, 0.098317,
499  0.137610, 0.175081, 0.216376, 0.314051, 0.385736, 0.514553, 0.599184,
500  0.557725, 0.593007, 0.696001, 0.790770, 0.502100, 0.837452, 0.890390};
501  const static double B_ij_lookup[17] = {1.52267, 2.16794, 2.42910, 2.77605,
502  2.98256, 3.11384, 3.50264, 3.07773, 3.54744, 3.61216, 3.41882, 3.18415,
503  3.37660, 3.27984, 3.39031, 3.23513, 3.13001};
504  const static double C_ij_lookup[17] = {0., 0., 0., 0., 0., 0., 0., 0.141211,
505  0.278407, 0.372683, 0.504894, 0.678469, 0.665702, 0., 0.602907, 0., 0.};
506  const static double E_ij_lookup[17] = {1., 1., 1., 1., 1., 1., 1., 13.45454,
507  14., 10.00900, 8.57519, 10.37483, 11.21674, 1., 6.19043, 1., 1.};
508 
509  // Interpolate Pr vs. those used in Takahashi table:
510  int Pr_i = 0;
511  double frac = 0.;
512 
513  if (Pr < 0.1) {
514  frac = (Pr - Pr_lookup[0])/(Pr_lookup[1] - Pr_lookup[0]);
515  } else {
516  for (int j = 1; j < 17; j++) {
517  if (Pr_lookup[j] > Pr) {
518  frac = (Pr - Pr_lookup[j-1])/(Pr_lookup[j] - Pr_lookup[j-1]);
519  break;
520  }
521  Pr_i++;
522  }
523  }
524  // If Pr is greater than the greatest value used by Takahashi (5.0), use the
525  // final table value. Should eventually add in an extrapolation:
526  if (Pr_i == 17) {
527  frac = 1.0;
528  }
529 
530  doublereal P_corr_1 = DP_Rt_lookup[Pr_i]*(1.0 - A_ij_lookup[Pr_i]
531  *pow(Tr,-B_ij_lookup[Pr_i]))*(1-C_ij_lookup[Pr_i]
532  *pow(Tr,-E_ij_lookup[Pr_i]));
533  doublereal P_corr_2 = DP_Rt_lookup[Pr_i+1]*(1.0 - A_ij_lookup[Pr_i+1]
534  *pow(Tr,-B_ij_lookup[Pr_i+1]))*(1-C_ij_lookup[Pr_i+1]
535  *pow(Tr,-E_ij_lookup[Pr_i+1]));
536 
537  return P_corr_1*(1.0-frac) + P_corr_2*frac;
538 
539 }
540 
541 }
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
Definition: stringUtils.cpp:39
int invert(DenseMatrix &A, size_t nn)
invert A. A is overwritten with A^-1.
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients (kg/m/s)
DenseMatrix m_dipole
The effective dipole moment for (i,j) collisions.
Definition: GasTransport.h:465
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
Interface for class MultiTransport.
bool m_bindiff_ok
Update boolean for the binary diffusivities at unit pressure.
Definition: GasTransport.h:252
thermo_t * m_thermo
pointer to the object representing the phase
void update_T()
Update basic temperature-dependent quantities if the temperature has changed.
virtual doublereal critTemperature() const
Critical temperature (K).
Definition: ThermoPhase.h:1227
DenseMatrix m_bdiff
Matrix of binary diffusion coefficients at the reference pressure and the current temperature Size is...
Definition: GasTransport.h:339
virtual doublereal satPressure(doublereal t)
Return the saturation pressure given the temperature.
Definition: ThermoPhase.h:1273
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
Definition: Phase.cpp:556
doublereal m_temp
Current value of the temperature at which the properties in this object are calculated (Kelvin)...
Definition: GasTransport.h:301
Header file defining class TransportFactory (see TransportFactory)
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:97
ThermoPhase object for the ideal gas equation of state - workhorse for Cantera (see Thermodynamic Pro...
virtual void updateDiff_T()
Update the binary diffusion coefficients.
doublereal molarVolume() const
Molar volume (m^3/kmol).
Definition: Phase.cpp:673
const doublereal BigNumber
largest number to compare to inf.
Definition: ct_defs.h:128
void eval_L0000(const doublereal *const x)
Evaluate the L0000 matrices.
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal *const d)
virtual doublereal critVolume() const
Critical volume (m3/kmol).
Definition: ThermoPhase.h:1237
virtual doublereal critCompressibility() const
Critical compressibility (unitless).
Definition: ThermoPhase.h:1242
virtual double thermalConductivity()
Returns the mixture thermal conductivity in W/m/K.
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:99
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions to the specified values There is no restriction on the sum of the mole fractio...
Definition: Phase.cpp:331
void updateThermal_T()
Update the temperature-dependent terms needed to compute the thermal conductivity and thermal diffusi...
Interface for class HighPressureGasTransport.
virtual void getMultiDiffCoeffs(const size_t ld, doublereal *const d)
Return the Multicomponent diffusion coefficients. Units: [m^2/s].
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:265
virtual doublereal critPressure() const
Critical pressure (Pa).
Definition: ThermoPhase.h:1232
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
Definition: ThermoPhase.h:278
Class MultiTransport implements multicomponent transport properties for ideal gas mixtures...
const std::vector< std::string > & speciesNames() const
Return a const reference to the vector of species names.
Definition: Phase.cpp:278
doublereal temperature() const
Temperature (K).
Definition: Phase.h:602
virtual doublereal viscosity()
Viscosity of the mixture (kg /m /s)
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
vector_fp m_w_ac
Pitzer acentric factor.
Definition: GasTransport.h:480
const doublereal Tiny
Small number to compare differences of mole fractions against.
Definition: ct_defs.h:142
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:669
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
Contains declarations for string manipulation functions within Cantera.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
Definition: ct_defs.h:36
size_t m_nsp
Number of species.
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
Definition: ThermoPhase.h:849
Class that holds the data that is read in from the XML file, and which is used for processing of the ...
void update_C()
Update basic concentration-dependent quantities if the concentrations have changed.
vector_fp m_mw
Local copy of the species molecular weights.
Definition: GasTransport.h:274