13 IonGasTransport::IonGasTransport() :
24 throw CanteraError(
"IonGasTransport::init(thermo, mode, log_level)",
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++) {
67 for (
size_t j = 0; j <
m_nsp; j++) {
68 for (
size_t k = j; k <
m_nsp; k++) {
108 doublereal sum1 = 0.0, sum2 = 0.0;
124 const size_t np = 50;
131 for (
size_t n = 0; n < np; n++) {
138 double err = 0.0, relerr = 0.0,
139 mxerr = 0.0, mxrelerr = 0.0;
143 for (
size_t k = 0; k <
m_nsp; k++) {
144 for (
size_t j = k; j <
m_nsp; j++) {
158 for (
size_t n = 0; n < np; n++) {
162 double sigma =
m_diam(j,k);
165 * pow(
Boltzmann * t, 1.5) / (
Pi * sigma * sigma * om11);
167 diff[n] = diffcoeff/pow(t, 1.5);
168 w[n] = 1.0/(diff[n]*diff[n]);
170 polyfit(np, degree, tlog.data(), diff.data(), w.data(), c.data());
172 for (
size_t n = 0; n < np; n++) {
174 double t = exp(tlog[n]);
175 double pre = pow(t, 1.5);
177 fit = pre *
poly4(tlog[n], c.data());
180 mxerr = std::max(mxerr, fabs(err));
181 mxrelerr = std::max(mxrelerr, fabs(relerr));
183 size_t sum = k * (k + 1) / 2;
193 writelogf(
"Maximum binary diffusion coefficient absolute error:" 195 writelogf(
"Maximum binary diffusion coefficient relative error:" 208 double alphaA_i =
m_alpha[i] * 1e30;
209 double alphaA_j =
m_alpha[j] * 1e30;
212 (1.0 + pow(2 * r_alpha, 2./3.)) * sqrt(alphaA_j));
216 double kappa = 0.095;
218 pow(alphaA_i * alphaA_j * (1.0 + 1.0 / xi), kappa);
223 double epsilon = K2 * ElectronCharge * ElectronCharge *
227 if (epsilon != 0.0) {
235 m_disp[j] = exp(1.8846*log(alphaA_j)-0.4737)* 1e-50;
243 m_disp[i] = exp(1.8853*log(alphaA_i)+0.2682)* 1e-50;
245 m_disp[i] = exp(3.2246*log(alphaA_i)-3.2397)* 1e-50;
270 double logtstar = log(tstar);
273 throw CanteraError(
"IonGasTransport::omega11_n64(tstar, gamma)",
274 "tstar = {} is smaller than 0.01", tstar);
275 }
else if (tstar <= 0.04) {
277 om11 = 2.97 - 12.0 * gamma
279 + 3.86 * gamma * gamma
280 - 6.45 * gamma * logtstar
281 - 0.275 * logtstar * logtstar
282 + 1.20 * gamma * gamma * logtstar
283 - 1.24 * gamma * logtstar * logtstar
284 - 0.164 * pow(logtstar,3);
285 }
else if (tstar <= 1000) {
287 om11 = 1.22 - 0.0343 * gamma
288 + (-0.769 + 0.232 * gamma) * logtstar
289 + (0.306 - 0.165 * gamma) * logtstar * logtstar
290 + (-0.0465 + 0.0388 * gamma) * pow(logtstar,3)
291 + (0.000614 - 0.00285 * gamma) * pow(logtstar,4)
292 + 0.000238 * pow(logtstar,5);
294 throw CanteraError(
"IonGasTransport::omega11_n64(tstar, gamma)",
295 "tstar = {} is larger than 1000", tstar);
315 for (
size_t k = 0; k <
m_nsp; k++) {
317 d[k] = 0.4 *
m_kbt / ElectronCharge;
338 for (
size_t k = 0; k <
m_nsp; k++) {
351 mobi[k] = 1.0 / sum / p;
virtual void getMixDiffCoeffs(double *const d)
The mixture transport for ionized gas.
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
vector_fp m_cond
vector of species thermal conductivities (W/m /K)
bool m_visc_ok
Update boolean for mixture rule for the mixture viscosity.
std::string vec2str(const vector_fp &v, const std::string &fmt, const std::string &sep)
Convert a vector to a string (separated by commas)
std::vector< size_t > m_kIon
index of ions (exclude electron.)
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
std::vector< vector_fp > m_diffcoeffs
Polynomial fits to the binary diffusivity of each species.
DenseMatrix m_gamma
parameter of omega11 of n64
const size_t npos
index returned by functions to indicate "no position"
bool m_condmix_ok
Update boolean for the mixture rule for the mixture thermal conductivity.
virtual void fitDiffCoeffs(MMCollisionInt &integrals)
Generate polynomial fits to the binary diffusion coefficients.
virtual void update_C()
Update the internal parameters whenever the concentrations have changed.
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.
thermo_t * m_thermo
pointer to the object representing the phase
size_t nSpecies() const
Returns the number of species in the phase.
size_t m_kElectron
index of electron
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid...
DenseMatrix m_wratjk
Holds square roots of molecular weight ratios.
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.
Monk and Monchick collision integrals.
bool m_spcond_ok
Update boolean for the species thermal conductivities.
R poly4(D x, R *c)
Evaluates a polynomial of order 4.
Base class for a phase with thermodynamic properties.
int m_mode
Type of the polynomial fits to temperature.
vector_int m_speciesCharge
electrical properties
virtual void update_T()
Update the internal parameters whenever the temperature has changed.
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the matrix.
void updateCond_T()
Update the temperature dependent parts of the species thermal conductivities.
virtual double thermalConductivity()
Returns the mixture thermal conductivity (W/m/K).
virtual void updateDiff_T()
Update the binary diffusion coefficients.
vector_fp m_visc
vector of species viscosities (kg /m /s).
vector_fp m_spwork
work space length = m_kk
std::string speciesName(size_t k) const
Name of the species with index k.
virtual double viscosity()
Viscosity of the mixture (kg/m/s).
vector_fp m_disp
Dispersion coefficient.
void setupCollisionIntegral()
Setup range for polynomial fits to collision integrals of Monchick & Mason.
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.
std::vector< size_t > m_kNeutral
index of neutral species
double omega11_n64(const double tstar, const double gamma)
bool m_viscwt_ok
Update boolean for the weighting factors for the mixture viscosity.
DenseMatrix m_phi
m_phi is a Viscosity Weighting Function. size = m_nsp * n_nsp
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
virtual void init(thermo_t *thermo, int mode, int log_level)
Initialize a transport manager.
DenseMatrix m_reducedMass
This is the reduced mass of the interaction between species i and j.
void writelogf(const char *fmt, const Args &... args)
Write a formatted message to the screen.
virtual void fitDiffCoeffs(MMCollisionInt &integrals)
Generate polynomial fits to the binary diffusion coefficients.
doublereal m_lambda
Internal storage for the calculated mixture thermal conductivity.
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.
virtual void getMobilities(double *const mobi)
The mobilities for ions in gas.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
DenseMatrix m_diam
hard-sphere diameter for (i,j) collision
virtual void setupCollisionParameters()
Setup parameters for a new kinetic-theory-based transport manager for low-density gases...
Contains declarations for string manipulation functions within Cantera.
size_t m_nsp
Number of species.
DenseMatrix m_wratkj1
Holds square roots of molecular weight ratios.
const doublereal epsilon_0
Permittivity of free space in F/m.
Calculation of Collision integrals.
doublereal m_viscmix
Internal storage for the viscosity of the mixture (kg /m /s)
doublereal m_kbt
Current value of Boltzmann constant times the temperature (Joules)
void setupN64()
setup parameters for n64 model
Namespace for the Cantera kernel.
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
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.
int m_log_level
Level of verbose printing during initialization.
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
const doublereal Boltzmann
Boltzmann's constant [J/K].
vector_fp m_quad_polar
Quadrupole polarizability.
vector_fp m_molefracs
Vector of species mole fractions.
vector_fp m_alpha
Polarizability of each species in the phase.
vector_fp m_mw
Local copy of the species molecular weights.