Go to the documentation of this file.
13 IonGasTransport::IonGasTransport() :
25 "mode = CK_Mode, which is an outdated lower-order fit.");
29 for (
size_t k = 0; k <
m_nsp; k++) {
39 for (
size_t k = 0; k <
m_nsp; k++) {
50 const vector_fp temp{300.0, 400.0, 500.0, 600.0, 800.0, 1000.0,
51 1200.0, 1500.0, 2000.0, 2500.0, 3000.0, 4000.0};
52 const vector_fp om11_O2{120.0, 107.0, 98.1, 92.1, 83.0, 77.0,
53 72.6, 67.9, 62.7, 59.3, 56.7, 53.8};
57 polyfit(temp.size(), degree, temp.data(), om11_O2.data(),
78 for (
size_t j = 0; j <
m_nsp; j++) {
79 for (
size_t k = j; k <
m_nsp; k++) {
119 doublereal sum1 = 0.0, sum2 = 0.0;
152 const size_t np = 50;
159 for (
size_t n = 0; n < np; n++) {
166 double err = 0.0, relerr = 0.0,
167 mxerr = 0.0, mxrelerr = 0.0;
171 for (
size_t k = 0; k <
m_nsp; k++) {
172 for (
size_t j = k; j <
m_nsp; j++) {
186 for (
size_t n = 0; n < np; n++) {
190 double sigma =
m_diam(j,k);
192 *
Pi * sigma * sigma;
205 diff[n] = diffcoeff/pow(t, 1.5);
206 w[n] = 1.0/(diff[n]*diff[n]);
208 polyfit(np, degree, tlog.data(), diff.data(), w.data(), c.data());
210 for (
size_t n = 0; n < np; n++) {
212 double t = exp(tlog[n]);
213 double pre = pow(t, 1.5);
215 fit = pre *
poly4(tlog[n], c.data());
218 mxerr = std::max(mxerr, fabs(err));
219 mxrelerr = std::max(mxrelerr, fabs(relerr));
221 size_t sum = k * (k + 1) / 2;
231 writelogf(
"Maximum binary diffusion coefficient absolute error:"
233 writelogf(
"Maximum binary diffusion coefficient relative error:"
246 double alphaA_i =
m_alpha[i] * 1e30;
247 double alphaA_j =
m_alpha[j] * 1e30;
250 (1.0 + pow(2 * r_alpha, 2./3.)) * sqrt(alphaA_j));
254 double kappa = 0.095;
256 pow(alphaA_i * alphaA_j * (1.0 + 1.0 / xi), kappa);
265 if (epsilon != 0.0) {
273 m_disp[j] = exp(1.8846*log(alphaA_j)-0.4737)* 1e-50;
281 m_disp[i] = exp(1.8853*log(alphaA_i)+0.2682)* 1e-50;
283 m_disp[i] = exp(3.2246*log(alphaA_i)-3.2397)* 1e-50;
308 double logtstar = log(tstar);
312 "tstar = {} is smaller than 0.01", tstar);
313 }
else if (tstar <= 0.04) {
315 om11 = 2.97 - 12.0 * gamma
317 + 3.86 * gamma * gamma
318 - 6.45 * gamma * logtstar
319 - 0.275 * logtstar * logtstar
320 + 1.20 * gamma * gamma * logtstar
321 - 1.24 * gamma * logtstar * logtstar
322 - 0.164 * pow(logtstar,3);
323 }
else if (tstar <= 1000) {
325 om11 = 1.22 - 0.0343 * gamma
326 + (-0.769 + 0.232 * gamma) * logtstar
327 + (0.306 - 0.165 * gamma) * logtstar * logtstar
328 + (-0.0465 + 0.0388 * gamma) * pow(logtstar,3)
329 + (0.000614 - 0.00285 * gamma) * pow(logtstar,4)
330 + 0.000238 * pow(logtstar,5);
333 "tstar = {} is larger than 1000", tstar);
353 for (
size_t k = 0; k <
m_nsp; k++) {
383 for (
size_t k = 0; k <
m_nsp; k++) {
396 mobi[k] = 1.0 / sum / p;
bool m_condmix_ok
Update boolean for the mixture rule for the mixture thermal conductivity.
const double ElectronCharge
Elementary charge [C].
vector_fp m_cond
vector of species thermal conductivities (W/m /K)
vector_fp m_molefracs
Vector of species mole fractions.
vector_fp m_om11_O2
polynomial of the collision integral for O2/O2-
virtual double viscosity()
Viscosity of the mixture (kg/m/s).
std::vector< size_t > m_kIon
index of ions (exclude electron.)
const double Boltzmann
Boltzmann constant [J/K].
void setupN64()
setup parameters for n64 model
std::vector< vector_fp > m_diffcoeffs
Polynomial fits to the binary diffusivity of each species.
virtual void fitDiffCoeffs(MMCollisionInt &integrals)
Generate polynomial fits to the binary diffusion coefficients.
int m_log_level
Level of verbose printing during initialization.
std::string vec2str(const vector_fp &v, const std::string &fmt, const std::string &sep)
Convert a vector to a string (separated by commas)
virtual double electricalConductivity()
vector_fp m_mw
Local copy of the species molecular weights.
virtual void getMobilities(double *const mobi)
The mobilities for ions in gas.
bool m_visc_ok
Update boolean for mixture rule for the mixture viscosity.
void writelog(const std::string &fmt, const Args &... args)
Write a formatted message to the screen.
bool m_bindiff_ok
Update boolean for the binary diffusivities at unit pressure.
size_t m_kElectron
index of electron
R poly5(D x, R *c)
Templated evaluation of a polynomial of order 5.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
const double epsilon_0
Permittivity of free space [F/m].
int m_mode
Type of the polynomial fits to temperature.
virtual void update_C()
Update the internal parameters whenever the concentrations have changed.
std::vector< size_t > m_kNeutral
index of neutral species
virtual void getMixDiffCoeffs(double *const d)
The mixture transport for ionized gas.
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the matrix.
bool m_spcond_ok
Update boolean for the species thermal conductivities.
void updateCond_T()
Update the temperature dependent parts of the species thermal conductivities.
DenseMatrix m_wratjk
Holds square roots of molecular weight ratios.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
virtual void fitDiffCoeffs(MMCollisionInt &integrals)
Generate polynomial fits to the binary diffusion coefficients.
vector_fp m_spwork
work space length = m_kk
DenseMatrix m_bdiff
Matrix of binary diffusion coefficients at the reference pressure and the current temperature Size is...
virtual void updateViscosity_T()
Update the temperature-dependent viscosity terms.
virtual void init(thermo_t *thermo, int mode, int log_level)
Initialize a transport manager.
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
virtual void updateDiff_T()
Update the binary diffusion coefficients.
R poly4(D x, R *c)
Evaluates a polynomial of order 4.
vector_fp m_visc
vector of species viscosities (kg /m /s).
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.
virtual void update_T()
Update the internal parameters whenever the temperature has changed.
thermo_t * m_thermo
pointer to the object representing the phase
bool m_viscwt_ok
Update boolean for the weighting factors for the mixture viscosity.
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
DenseMatrix m_reducedMass
This is the reduced mass of the interaction between species i and j.
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
vector_fp m_sqvisc
vector of square root of species viscosities sqrt(kg /m /s).
DenseMatrix m_epsilon
The effective well depth for (i,j) collisions.
Calculation of Collision integrals.
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid.
DenseMatrix m_diam
hard-sphere diameter for (i,j) collision
Base class for a phase with thermodynamic properties.
void writelogf(const char *fmt, const Args &... args)
Write a formatted message to the screen.
void setupCollisionIntegral()
Setup range for polynomial fits to collision integrals of Monchick & Mason.
vector_fp m_disp
Dispersion coefficient.
virtual double pressure() const
Return the thermodynamic pressure (Pa).
size_t m_nsp
Number of species.
DenseMatrix m_wratkj1
Holds square roots of molecular weight ratios.
DenseMatrix m_phi
m_phi is a Viscosity Weighting Function. size = m_nsp * n_nsp
size_t nSpecies() const
Returns the number of species in the phase.
doublereal m_kbt
Current value of Boltzmann constant times the temperature (Joules)
doublereal m_lambda
Internal storage for the calculated mixture thermal conductivity.
DenseMatrix m_gamma
parameter of omega11 of n64
virtual double thermalConductivity()
Returns the mixture thermal conductivity (W/m/K).
double omega11_n64(const double tstar, const double gamma)
vector_fp m_alpha
Polarizability of each species in the phase.
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.
virtual void setupCollisionParameters()
Setup parameters for a new kinetic-theory-based transport manager for low-density gases.
Base class for exceptions thrown by Cantera classes.
const size_t npos
index returned by functions to indicate "no position"
vector_fp m_speciesCharge
electrical properties
vector_fp m_quad_polar
Quadrupole polarizability.
doublereal m_viscmix
Internal storage for the viscosity of the mixture (kg /m /s)
Namespace for the Cantera kernel.
std::string speciesName(size_t k) const
Name of the species with index k.