24 "mode = CK_Mode, which is an outdated lower-order fit.");
26 if (log_level == -7) {
30 "is deprecated and will be removed after Cantera 3.1.");
34 for (
size_t k = 0; k <
m_nsp; k++) {
39 size_t nElectronSpecies = 0;
40 for (
size_t k = 0; k <
m_nsp; k++) {
48 if (nElectronSpecies > 1) {
50 "Found multiple electron species.");
54 for (
size_t k = 0; k <
m_nsp; k++) {
65 const vector<double> temp{300.0, 400.0, 500.0, 600.0, 800.0, 1000.0,
66 1200.0, 1500.0, 2000.0, 2500.0, 3000.0, 4000.0};
67 const vector<double> om11_O2{120.0, 107.0, 98.1, 92.1, 83.0, 77.0,
68 72.6, 67.9, 62.7, 59.3, 56.7, 53.8};
69 vector<double> w(temp.size(),-1);
72 polyfit(temp.size(), degree, temp.data(), om11_O2.data(),
93 for (
size_t j = 0; j <
m_nsp; j++) {
94 for (
size_t k = j; k <
m_nsp; k++) {
134 double sum1 = 0.0, sum2 = 0.0;
147 vector<double> mobi(
m_nsp);
167 const size_t np = 50;
170 vector<double> tlog(np);
171 vector<double> w(np);
174 for (
size_t n = 0; n < np; n++) {
180 vector<double> c(degree + 1);
181 double err = 0.0, relerr = 0.0,
182 mxerr = 0.0, mxrelerr = 0.0;
184 vector<double> diff(np + 1);
186 for (
size_t k = 0; k <
m_nsp; k++) {
187 for (
size_t j = k; j <
m_nsp; j++) {
201 for (
size_t n = 0; n < np; n++) {
205 double sigma =
m_diam(j,k);
207 *
Pi * sigma * sigma;
220 diff[n] = diffcoeff/pow(t, 1.5);
221 w[n] = 1.0/(diff[n]*diff[n]);
223 polyfit(np, degree, tlog.data(), diff.data(), w.data(), c.data());
225 for (
size_t n = 0; n < np; n++) {
227 double t = exp(tlog[n]);
228 double pre = pow(t, 1.5);
230 fit = pre *
poly4(tlog[n], c.data());
233 mxerr = std::max(mxerr, fabs(err));
234 mxrelerr = std::max(mxrelerr, fabs(relerr));
236 size_t sum = k * (k + 1) / 2;
252 writelogf(
"Maximum binary diffusion coefficient absolute error:"
254 writelogf(
"Maximum binary diffusion coefficient relative error:"
267 double alphaA_i =
m_alpha[i] * 1e30;
268 double alphaA_j =
m_alpha[j] * 1e30;
271 (1.0 + pow(2 * r_alpha, 2./3.)) * sqrt(alphaA_j));
275 double kappa = 0.095;
277 pow(alphaA_i * alphaA_j * (1.0 + 1.0 / xi), kappa);
286 if (epsilon != 0.0) {
294 m_disp[j] = exp(1.8846*log(alphaA_j)-0.4737)* 1e-50;
302 m_disp[i] = exp(1.8853*log(alphaA_i)+0.2682)* 1e-50;
304 m_disp[i] = exp(3.2246*log(alphaA_i)-3.2397)* 1e-50;
329 double logtstar = log(tstar);
333 "tstar = {} is smaller than 0.01", tstar);
334 }
else if (tstar <= 0.04) {
336 om11 = 2.97 - 12.0 * gamma
338 + 3.86 * gamma * gamma
339 - 6.45 * gamma * logtstar
340 - 0.275 * logtstar * logtstar
341 + 1.20 * gamma * gamma * logtstar
342 - 1.24 * gamma * logtstar * logtstar
343 - 0.164 * pow(logtstar,3);
344 }
else if (tstar <= 1000) {
346 om11 = 1.22 - 0.0343 * gamma
347 + (-0.769 + 0.232 * gamma) * logtstar
348 + (0.306 - 0.165 * gamma) * logtstar * logtstar
349 + (-0.0465 + 0.0388 * gamma) * pow(logtstar,3)
350 + (0.000614 - 0.00285 * gamma) * pow(logtstar,4)
351 + 0.000238 * pow(logtstar,5);
354 "tstar = {} is larger than 1000", tstar);
374 for (
size_t k = 0; k <
m_nsp; k++) {
404 for (
size_t k = 0; k <
m_nsp; k++) {
417 mobi[k] = 1.0 / sum / p;
Monchick and Mason collision integrals.
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
double getDouble(const string &key, double default_) const
If key exists, return it as a double, otherwise return default_.
Base class for exceptions thrown by Cantera classes.
void resize(size_t n, size_t m, double v=0.0) override
Resize the matrix.
virtual void setupCollisionParameters()
Setup parameters for a new kinetic-theory-based transport manager for low-density gases.
vector< double > m_mw
Local copy of the species molecular weights.
vector< double > m_molefracs
Vector of species mole fractions.
vector< double > m_quad_polar
Quadrupole polarizability.
bool m_visc_ok
Update boolean for mixture rule for the mixture viscosity.
DenseMatrix m_wratkj1
Holds square roots of molecular weight ratios.
virtual void fitDiffCoeffs(MMCollisionInt &integrals)
Generate polynomial fits to the binary diffusion coefficients.
vector< double > m_disp
Dispersion coefficient.
virtual void updateDiff_T()
Update the binary diffusion coefficients.
vector< double > m_sqvisc
vector of square root of species viscosities sqrt(kg /m /s).
DenseMatrix m_wratjk
Holds square roots of molecular weight ratios.
bool m_bindiff_ok
Update boolean for the binary diffusivities at unit pressure.
DenseMatrix m_epsilon
The effective well depth for (i,j) collisions.
DenseMatrix m_diam
hard-sphere diameter for (i,j) collision
vector< double > m_spwork
work space length = m_kk
int m_mode
Type of the polynomial fits to temperature.
virtual void updateViscosity_T()
Update the temperature-dependent viscosity terms.
double m_viscmix
Internal storage for the viscosity of the mixture (kg /m /s)
vector< double > m_visc
vector of species viscosities (kg /m /s).
DenseMatrix m_bdiff
Matrix of binary diffusion coefficients at the reference pressure and the current temperature Size is...
vector< vector< double > > m_diffcoeffs
Polynomial fits to the binary diffusivity of each species.
double m_kbt
Current value of Boltzmann constant times the temperature (Joules)
DenseMatrix m_reducedMass
This is the reduced mass of the interaction between species i and j.
int m_log_level
Level of verbose printing during initialization.
bool m_viscwt_ok
Update boolean for the weighting factors for the mixture viscosity.
vector< double > m_alpha
Polarizability of each species in the phase.
DenseMatrix m_phi
m_phi is a Viscosity Weighting Function. size = m_nsp * n_nsp
void setupCollisionIntegral()
Setup range for polynomial fits to collision integrals of Monchick & Mason .
void fitDiffCoeffs(MMCollisionInt &integrals) override
Generate polynomial fits to the binary diffusion coefficients.
void getMobilities(double *const mobi) override
The mobilities for ions in gas.
size_t m_kElectron
index of electron
double thermalConductivity() override
Returns the mixture thermal conductivity (W/m/K).
void getMixDiffCoeffs(double *const d) override
The mixture transport for ionized gas.
vector< double > m_om11_O2
polynomial of the collision integral for O2/O2-
double omega11_n64(const double tstar, const double gamma)
Collision integral of omega11 of n64 collision model.
void init(ThermoPhase *thermo, int mode, int log_level=-7) override
Initialize a transport manager.
DenseMatrix m_gamma
parameter of omega11 of n64
void setupN64()
setup parameters for n64 model
double viscosity() override
Viscosity of the mixture (kg/m/s).
vector< size_t > m_kIon
index of ions (exclude electron.)
double electricalConductivity() override
The electrical conductivity (Siemens/m).
vector< size_t > m_kNeutral
index of neutral species
vector< double > m_speciesCharge
electrical properties
Calculation of Collision integrals.
void update_T() override
Update the internal parameters whenever the temperature has changed.
bool m_spcond_ok
Update boolean for the species thermal conductivities.
double m_lambda
Internal storage for the calculated mixture thermal conductivity.
void updateCond_T()
Update the temperature dependent parts of the species thermal conductivities.
void update_C() override
Update the internal parameters whenever the concentrations have changed.
vector< double > m_cond
vector of species thermal conductivities (W/m /K)
bool m_condmix_ok
Update boolean for the mixture rule for the mixture thermal conductivity.
size_t nSpecies() const
Returns the number of species in the phase.
double meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
string speciesName(size_t k) const
Name of the species with index k.
const vector< double > & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
size_t speciesIndex(const string &name) const
Returns the index of a species named 'name' within the Phase object.
double molecularWeight(size_t k) const
Molecular weight of species k.
virtual double pressure() const
Return the thermodynamic pressure (Pa).
double charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
Base class for a phase with thermodynamic properties.
virtual double minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid.
virtual double maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
ThermoPhase * m_thermo
pointer to the object representing the phase
size_t m_nsp
Number of species.
ThermoPhase & thermo()
Phase object.
AnyMap m_fittingErrors
Maximum errors associated with fitting pure species transport properties.
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
string vec2str(const vector< double > &v, const string &fmt, const string &sep)
Convert a vector to a string (separated by commas)
void writelogf(const char *fmt, const Args &... args)
Write a formatted message to the screen.
void writelog(const string &fmt, const Args &... args)
Write a formatted message to the screen.
R poly4(D x, R *c)
Evaluates a polynomial of order 4.
R poly5(D x, R *c)
Templated evaluation of a polynomial of order 5.
double polyfit(size_t n, size_t deg, const double *xp, const double *yp, const double *wp, double *pp)
Fits a polynomial function to a set of data points.
const double Boltzmann
Boltzmann constant [J/K].
const double epsilon_0
Permittivity of free space [F/m].
const double ElectronCharge
Elementary charge [C].
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
double getElementWeight(const string &ename)
Get the atomic weight of an element.
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.
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.
Contains declarations for string manipulation functions within Cantera.
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...