18 PecosTransport::PecosTransport() :
23 warn_deprecated(
"class PecosTransport",
"To be removed after Cantera 2.2");
50 m_dipoleDiag.resize(m_nsp);
51 for (
int i = 0; i < m_nsp; i++) {
52 m_dipoleDiag[i] = tr.
dipole(i,i);
55 m_phi.
resize(m_nsp, m_nsp, 0.0);
56 m_wratjk.
resize(m_nsp, m_nsp, 0.0);
57 m_wratkj1.
resize(m_nsp, m_nsp, 0.0);
59 for (j = 0; j < m_nsp; j++)
60 for (k = j; k < m_nsp; k++) {
61 m_wratjk(j,k) = sqrt(m_mw[j]/m_mw[k]);
62 m_wratjk(k,j) = sqrt(m_wratjk(j,k));
63 m_wratkj1(j,k) = sqrt(1.0 + m_mw[k]/m_mw[j]);
66 m_polytempvec.resize(5);
68 m_sqvisc.resize(m_nsp);
70 m_bdiff.
resize(m_nsp, m_nsp);
72 m_molefracs.resize(m_nsp);
73 m_spwork.resize(m_nsp);
93 for (k = 0; k < m_nsp; k++) {
94 cv_rot[k] = tr.
crot[k];
96 cv_int[k] = cp_R[k] - 2.5 - cv_rot[k];
110 doublereal vismix = 0.0;
119 for (k = 0; k < m_nsp; k++) {
120 vismix += m_molefracs[k] * m_visc[k]/m_spwork[k];
138 for (i = 0; i < m_nsp; i++)
139 for (j = 0; j < m_nsp; j++) {
140 d[ld*j + i] = rp * m_bdiff(i,j);
148 doublereal c1 = ElectronCharge / (
Boltzmann * m_temp);
149 for (k = 0; k < m_nsp; k++) {
157 doublereal lambda = 0.0;
170 for (k = 0; k < m_nsp; k++) {
171 lambda += m_molefracs[k] * m_cond[k]/m_spwork[k];
183 for (k = 0; k < m_nsp; k++) {
189 const doublereal*
const grad_T,
190 size_t ldx,
const doublereal*
const grad_X,
191 size_t ldf, doublereal*
const fluxes)
207 doublereal correction=0.0;
209 for (k = 0; k < m_nsp; k++) {
210 correction += rhon * mw[k] * m_spwork[k] * grad_X[n*ldx + k];
213 for (n = 0; n < ndim; n++) {
214 for (k = 0; k < m_nsp; k++) {
215 fluxes[n*ldf + k] = -rhon * mw[k] * m_spwork[k] * grad_X[n*ldx + k] + y[k]*correction;
216 sum[n] += fluxes[n*ldf + k];
220 for (n = 0; n < ndim; n++) {
221 for (k = 0; k < m_nsp; k++) {
222 fluxes[n*ldf + k] -= y[k]*sum[n];
239 doublereal sumxw = 0.0, sum2;
242 d[0] = m_bdiff(0,0) / p;
244 for (k = 0; k < m_nsp; k++) {
245 sumxw += m_molefracs[k] * m_mw[k];
247 for (k = 0; k < m_nsp; k++) {
249 for (j = 0; j < m_nsp; j++) {
251 sum2 += m_molefracs[j] / m_bdiff(j,k);
255 d[k] = m_bdiff(k,k) / p;
257 d[k] = (sumxw - m_molefracs[k] * m_mw[k])/(p * mmw * sum2);
275 d[0] = m_bdiff(0,0) / p;
277 for (
int k = 0; k < m_nsp; k++) {
279 for (
int j = 0; j < m_nsp; j++) {
281 sum2 += m_molefracs[j] / m_bdiff(j,k);
285 d[k] = m_bdiff(k,k) / p;
287 d[k] = (1 - m_molefracs[k]) / (p * sum2);
307 d[0] = m_bdiff(0,0) / p;
309 for (
int k=0; k<m_nsp; k++) {
312 for (
int i=0; i<m_nsp; i++) {
316 sum1 += m_molefracs[i] / m_bdiff(k,i);
317 sum2 += m_molefracs[i] * m_mw[i] / m_bdiff(k,i);
320 sum2 *= p * m_molefracs[k] / (mmw - m_mw[k]*m_molefracs[k]);
321 d[k] = 1.0 / (sum1 + sum2);
339 "negative temperature "+
fp2str(t));
342 m_logt = log(m_temp);
344 m_sqrt_t = sqrt(m_temp);
345 m_t14 = sqrt(m_sqrt_t);
346 m_t32 = m_temp * m_sqrt_t;
350 m_polytempvec[0] = 1.0;
351 m_polytempvec[1] = m_logt;
352 m_polytempvec[2] = m_logt*m_logt;
353 m_polytempvec[3] = m_logt*m_logt*m_logt;
354 m_polytempvec[4] = m_logt*m_logt*m_logt*m_logt;
357 m_viscmix_ok =
false;
361 m_diffmix_ok =
false;
362 m_bindiff_ok =
false;
364 m_condmix_ok =
false;
373 m_viscmix_ok =
false;
374 m_diffmix_ok =
false;
375 m_condmix_ok =
false;
381 for (k = 0; k < m_nsp; k++) {
382 m_molefracs[k] = std::max(
Tiny, m_molefracs[k]);
389 doublereal fivehalves = 5/2;
390 for (k = 0; k < m_nsp; k++) {
392 m_cond[k] = m_visc[k] * (fivehalves * cv_int[k] + cv_rot[k] +
m_thermo->
cv_vib(k,m_temp));
395 m_condmix_ok =
false;
403 if (m_mode == CK_Mode) {
404 for (i = 0; i < m_nsp; i++) {
405 for (j = i; j < m_nsp; j++) {
406 m_bdiff(i,j) = exp(
dot4(m_polytempvec, m_diffcoeffs[ic]));
407 m_bdiff(j,i) = m_bdiff(i,j);
412 for (i = 0; i < m_nsp; i++) {
413 for (j = i; j < m_nsp; j++) {
414 m_bdiff(i,j) = m_temp * m_sqrt_t*
dot5(m_polytempvec,
416 m_bdiff(j,i) = m_bdiff(i,j);
423 m_diffmix_ok =
false;
430 for (k = 0; k < m_nsp; k++) {
431 m_visc[k] = 0.10*std::exp(a[k]*(m_logt*m_logt) + b[k]*m_logt + c[k]);
432 m_sqvisc[k] = sqrt(m_visc[k]);
463 (
"Air 2.68142000000e-02 3.17783800000e-01 -1.13155513000e+01\n"
464 "CPAir 2.68142000000e-02 3.17783800000e-01 -1.13155513000e+01\n"
465 "N 1.15572000000e-02 6.03167900000e-01 -1.24327495000e+01\n"
466 "N2 2.68142000000e-02 3.17783800000e-01 -1.13155513000e+01\n"
467 "CPN2 2.68142000000e-02 3.17783800000e-01 -1.13155513000e+01\n"
468 "NO 4.36378000000e-02 -3.35511000000e-02 -9.57674300000e+00\n"
469 "O 2.03144000000e-02 4.29440400000e-01 -1.16031403000e+01\n"
470 "O2 4.49290000000e-02 -8.26158000000e-02 -9.20194750000e+00\n"
471 "C -8.3285e-3 0.7703240 -12.7378000\n"
472 "C2 -8.4311e-3 0.7876060 -13.0268000\n"
473 "C3 -8.4312e-3 0.7876090 -12.8240000\n"
474 "C2H -2.4241e-2 1.0946550 -14.5835500\n"
475 "CN -8.3811e-3 0.7860330 -12.9406000\n"
476 "CO -0.019527394 1.013295 -13.97873\n"
477 "CO2 -0.019527387 1.047818 -14.32212\n"
478 "HCN -2.4241e-2 1.0946550 -14.5835500\n"
479 "H -8.3912e-3 0.7743270 -13.6653000\n"
480 "H2 -8.3346e-3 0.7815380 -13.5351000\n"
481 "e 0.00000000000e+00 0.00000000000e+00 -1.16031403000e+01\n");
485 string ss1,ss2,ss3,ss4,sss;
489 while (std::getline(blot, line)) {
491 istringstream ss(line);
492 std::getline(ss, ss1,
' ');
493 std::getline(ss, ss2,
' ');
494 std::getline(ss, ss3,
' ');
495 std::getline(ss, ss4,
' ');
499 for (k = 0; k < m_nsp; k++) {
503 if (sss.compare(ss1) == 0) {
523 doublereal vratiokj, wratiojk, factor1;
531 for (j = 0; j < m_nsp; j++) {
532 for (k = j; k < m_nsp; k++) {
533 vratiokj = m_visc[k]/m_visc[j];
534 wratiojk = m_mw[j]/m_mw[k];
538 factor1 = 1.0 + (m_sqvisc[k]/m_sqvisc[j]) * m_wratjk(k,j);
539 m_phi(k,j) = factor1*factor1 /
540 (sqrt(8.0) * m_wratkj1(j,k));
541 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: shallow pointer.
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
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
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)
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...
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.
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...