21 PecosTransport::PecosTransport() :
52 m_dipoleDiag.resize(m_nsp);
53 for (
int i = 0; i < m_nsp; i++) {
54 m_dipoleDiag[i] = tr.
dipole(i,i);
57 m_phi.
resize(m_nsp, m_nsp, 0.0);
58 m_wratjk.
resize(m_nsp, m_nsp, 0.0);
59 m_wratkj1.
resize(m_nsp, m_nsp, 0.0);
61 for (j = 0; j < m_nsp; j++)
62 for (k = j; k < m_nsp; k++) {
63 m_wratjk(j,k) = sqrt(m_mw[j]/m_mw[k]);
64 m_wratjk(k,j) = sqrt(m_wratjk(j,k));
65 m_wratkj1(j,k) = sqrt(1.0 + m_mw[k]/m_mw[j]);
68 m_polytempvec.resize(5);
70 m_sqvisc.resize(m_nsp);
72 m_bdiff.
resize(m_nsp, m_nsp);
74 m_molefracs.resize(m_nsp);
75 m_spwork.resize(m_nsp);
95 for (k = 0; k < m_nsp; k++) {
96 cv_rot[k] = tr.
crot[k];
98 cv_int[k] = cp_R[k] - 2.5 - cv_rot[k];
112 doublereal vismix = 0.0;
121 for (k = 0; k < m_nsp; k++) {
122 vismix += m_molefracs[k] * m_visc[k]/m_spwork[k];
140 for (i = 0; i < m_nsp; i++)
141 for (j = 0; j < m_nsp; j++) {
142 d[ld*j + i] = rp * m_bdiff(i,j);
150 doublereal c1 = ElectronCharge / (
Boltzmann * m_temp);
151 for (k = 0; k < m_nsp; k++) {
159 doublereal lambda = 0.0;
172 for (k = 0; k < m_nsp; k++) {
173 lambda += m_molefracs[k] * m_cond[k]/m_spwork[k];
185 for (k = 0; k < m_nsp; k++) {
191 const doublereal*
const grad_T,
192 size_t ldx,
const doublereal*
const grad_X,
193 size_t ldf, doublereal*
const fluxes)
209 doublereal correction=0.0;
211 for (k = 0; k < m_nsp; k++) {
212 correction += rhon * mw[k] * m_spwork[k] * grad_X[n*ldx + k];
215 for (n = 0; n < ndim; n++) {
216 for (k = 0; k < m_nsp; k++) {
217 fluxes[n*ldf + k] = -rhon * mw[k] * m_spwork[k] * grad_X[n*ldx + k] + y[k]*correction;
218 sum[n] += fluxes[n*ldf + k];
222 for (n = 0; n < ndim; n++) {
223 for (k = 0; k < m_nsp; k++) {
224 fluxes[n*ldf + k] -= y[k]*sum[n];
241 doublereal sumxw = 0.0, sum2;
244 d[0] = m_bdiff(0,0) / p;
246 for (k = 0; k < m_nsp; k++) {
247 sumxw += m_molefracs[k] * m_mw[k];
249 for (k = 0; k < m_nsp; k++) {
251 for (j = 0; j < m_nsp; j++) {
253 sum2 += m_molefracs[j] / m_bdiff(j,k);
257 d[k] = m_bdiff(k,k) / p;
259 d[k] = (sumxw - m_molefracs[k] * m_mw[k])/(p * mmw * sum2);
277 d[0] = m_bdiff(0,0) / p;
279 for (
int k = 0; k < m_nsp; k++) {
281 for (
int j = 0; j < m_nsp; j++) {
283 sum2 += m_molefracs[j] / m_bdiff(j,k);
287 d[k] = m_bdiff(k,k) / p;
289 d[k] = (1 - m_molefracs[k]) / (p * sum2);
309 d[0] = m_bdiff(0,0) / p;
311 for (
int k=0; k<m_nsp; k++) {
314 for (
int i=0; i<m_nsp; i++) {
318 sum1 += m_molefracs[i] / m_bdiff(k,i);
319 sum2 += m_molefracs[i] * m_mw[i] / m_bdiff(k,i);
322 sum2 *= p * m_molefracs[k] / (mmw - m_mw[k]*m_molefracs[k]);
323 d[k] = 1.0 / (sum1 + sum2);
341 "negative temperature "+
fp2str(t));
344 m_logt = log(m_temp);
346 m_sqrt_t = sqrt(m_temp);
347 m_t14 = sqrt(m_sqrt_t);
348 m_t32 = m_temp * m_sqrt_t;
352 m_polytempvec[0] = 1.0;
353 m_polytempvec[1] = m_logt;
354 m_polytempvec[2] = m_logt*m_logt;
355 m_polytempvec[3] = m_logt*m_logt*m_logt;
356 m_polytempvec[4] = m_logt*m_logt*m_logt*m_logt;
359 m_viscmix_ok =
false;
363 m_diffmix_ok =
false;
364 m_bindiff_ok =
false;
366 m_condmix_ok =
false;
375 m_viscmix_ok =
false;
376 m_diffmix_ok =
false;
377 m_condmix_ok =
false;
383 for (k = 0; k < m_nsp; k++) {
384 m_molefracs[k] = std::max(
Tiny, m_molefracs[k]);
391 doublereal fivehalves = 5/2;
392 for (k = 0; k < m_nsp; k++) {
394 m_cond[k] = m_visc[k] * (fivehalves * cv_int[k] + cv_rot[k] +
m_thermo->
cv_vib(k,m_temp));
397 m_condmix_ok =
false;
405 if (m_mode == CK_Mode) {
406 for (i = 0; i < m_nsp; i++) {
407 for (j = i; j < m_nsp; j++) {
408 m_bdiff(i,j) = exp(
dot4(m_polytempvec, m_diffcoeffs[ic]));
409 m_bdiff(j,i) = m_bdiff(i,j);
414 for (i = 0; i < m_nsp; i++) {
415 for (j = i; j < m_nsp; j++) {
416 m_bdiff(i,j) = m_temp * m_sqrt_t*
dot5(m_polytempvec,
418 m_bdiff(j,i) = m_bdiff(i,j);
425 m_diffmix_ok =
false;
436 for (k = 0; k < m_nsp; k++) {
437 m_visc[k] = 0.10*std::exp(a[k]*(m_logt*m_logt) + b[k]*m_logt + c[k]);
438 m_sqvisc[k] = sqrt(m_visc[k]);
491 (
"Air 2.68142000000e-02 3.17783800000e-01 -1.13155513000e+01\n"
492 "CPAir 2.68142000000e-02 3.17783800000e-01 -1.13155513000e+01\n"
493 "N 1.15572000000e-02 6.03167900000e-01 -1.24327495000e+01\n"
494 "N2 2.68142000000e-02 3.17783800000e-01 -1.13155513000e+01\n"
495 "CPN2 2.68142000000e-02 3.17783800000e-01 -1.13155513000e+01\n"
496 "NO 4.36378000000e-02 -3.35511000000e-02 -9.57674300000e+00\n"
497 "O 2.03144000000e-02 4.29440400000e-01 -1.16031403000e+01\n"
498 "O2 4.49290000000e-02 -8.26158000000e-02 -9.20194750000e+00\n"
499 "C -8.3285e-3 0.7703240 -12.7378000\n"
500 "C2 -8.4311e-3 0.7876060 -13.0268000\n"
501 "C3 -8.4312e-3 0.7876090 -12.8240000\n"
502 "C2H -2.4241e-2 1.0946550 -14.5835500\n"
503 "CN -8.3811e-3 0.7860330 -12.9406000\n"
504 "CO -0.019527394 1.013295 -13.97873\n"
505 "CO2 -0.019527387 1.047818 -14.32212\n"
506 "HCN -2.4241e-2 1.0946550 -14.5835500\n"
507 "H -8.3912e-3 0.7743270 -13.6653000\n"
508 "H2 -8.3346e-3 0.7815380 -13.5351000\n"
509 "e 0.00000000000e+00 0.00000000000e+00 -1.16031403000e+01\n");
513 string ss1,ss2,ss3,ss4,sss;
517 while (std::getline(blot, line)) {
519 istringstream ss(line);
520 std::getline(ss, ss1,
' ');
521 std::getline(ss, ss2,
' ');
522 std::getline(ss, ss3,
' ');
523 std::getline(ss, ss4,
' ');
527 for (k = 0; k < m_nsp; k++) {
531 if (sss.compare(ss1) == 0) {
568 doublereal vratiokj, wratiojk, factor1;
576 for (j = 0; j < m_nsp; j++) {
577 for (k = j; k < m_nsp; k++) {
578 vratiokj = m_visc[k]/m_visc[j];
579 wratiojk = m_mw[j]/m_mw[k];
583 factor1 = 1.0 + (m_sqvisc[k]/m_sqvisc[j]) * m_wratjk(k,j);
584 m_phi(k,j) = factor1*factor1 /
586 m_phi(j,k) = m_phi(k,j)/(vratiokj * wratiojk);
doublereal fpValue(const std::string &val)
Translate a string into one doublereal value.
DenseMatrix diam
hard-sphere diameter for (i,j) collision
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity.
This structure holds transport model parameters relevant to transport in ideal gases with a kinetic t...
vector_fp alpha
Polarizability of each species in the phase.
thermo_t * thermo
Pointer to the ThermoPhase object.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
doublereal dot4(const V &x, const V &y)
Templated Inner product of two vectors of length 4.
virtual doublereal cv_vib(int, double) const
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients.
Class IdealGasPhase represents low-density gases that obey the ideal gas equation of state...
thermo_t * m_thermo
pointer to the object representing the phase
virtual doublereal viscosity()
Viscosity of the mixture.
doublereal molarDensity() const
Molar density (kmol/m^3).
Header file defining class PecosTransport.
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
void read_blottner_transport_table()
Reads the transport table specified (currently defaults to internal file)
Header file defining class TransportFactory (see TransportFactory)
std::vector< vector_fp > diffcoeffs
temperature-fits of the diffusivity
vector_fp zrot
Rotational relaxation number for the species in the current phase.
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the matrix.
vector_fp eps
Lennard-Jones well-depth of the species in the current phase.
ThermoPhase object for the ideal gas equation of state - workhorse for Cantera (see Thermodynamic Pro...
const doublereal SqrtEight
sqrt(8)
virtual void update_C()
This is called the first time any transport property is requested from Mixture after the concentratio...
virtual void getMixDiffCoeffs(doublereal *const d)
Mixture-averaged diffusion coefficients [m^2/s].
void getMixDiffCoeffsMass(doublereal *const d)
Returns the mixture-averaged diffusion coefficients [m^2/s].
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
virtual void getSpeciesFluxes(size_t ndim, const doublereal *const grad_T, size_t ldx, const doublereal *const grad_X, size_t ldf, doublereal *const fluxes)
Get the species diffusive mass fluxes wrt to the mass averaged velocity, given the gradients in mole ...
virtual void getMobilities(doublereal *const mobil)
Get the Electrical mobilities (m^2/V/s).
const doublereal * massFractions() const
Return a const pointer to the mass fraction array.
void multiply(const DenseMatrix &A, const double *const b, double *const prod)
Multiply A*b and return the result in prod. Uses BLAS routine DGEMV.
Base class for exceptions thrown by Cantera classes.
void updateDiff_T()
Update the binary diffusion coefficients.
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal *const d)
binary diffusion coefficients
vector_fp crot
Dimensionless rotational heat capacity of the species in the current phase.
void updateSpeciesViscosities()
Update the pure-species viscosities.
DenseMatrix epsilon
The effective well depth for (i,j) collisions.
doublereal pressure_ig() const
Calculate the pressure from the ideal gas law.
size_t nSpecies() const
Returns the number of species in the phase.
std::vector< std::vector< int > > poly
This is vector of vectors containing the integer lookup value for the (i,j) interaction.
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
void updateCond_T()
Update the temperature-dependent parts of the mixture-averaged thermal conductivity.
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
doublereal temperature() const
Temperature (K).
doublereal dot5(const V &x, const V &y)
Templated Inner product of two vectors of length 5.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
DenseMatrix dipole
The effective dipole moment for (i,j) collisions.
std::vector< vector_fp > visccoeffs
temperature-fit of the viscosity
const doublereal Tiny
Small number to compare differences of mole fractions against.
std::vector< vector_fp > condcoeffs
temperature-fits of the heat conduction
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
void updateViscosity_T()
Update the temperature-dependent viscosity terms.
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.
void getMixDiffCoeffsMole(doublereal *const d)
Returns the mixture-averaged diffusion coefficients [m^2/s].
virtual bool initGas(GasTransportParams &tr)
Initialize the transport object.
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
Class that holds the data that is read in from the xml file, and which is used for processing of the ...
std::string speciesName(size_t k) const
Name of the species with index k.
const doublereal Boltzmann
Boltzmann's constant [J/K].
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...