Cantera  3.1.0
Loading...
Searching...
No Matches
MultiTransport.cpp
Go to the documentation of this file.
1/**
2 * @file MultiTransport.cpp
3 * Implementation file for class MultiTransport
4 */
5
6// This file is part of Cantera. See License.txt in the top-level directory or
7// at https://cantera.org/license.txt for license and copyright information.
8
13
14using namespace std;
15
16namespace Cantera
17{
18
19///////////////////// helper functions /////////////////////////
20
21/**
22 * The Parker temperature correction to the rotational collision number.
23 *
24 * @param tr Reduced temperature @f$ \epsilon/kT @f$
25 * @param sqtr square root of tr.
26 */
27double Frot(double tr, double sqtr)
28{
29 const double c1 = 0.5*sqrt(Pi)*Pi;
30 const double c2 = 0.25*Pi*Pi + 2.0;
31 const double c3 = sqrt(Pi)*Pi;
32 return 1.0 + c1*sqtr + c2*tr + c3*sqtr*tr;
33}
34
35//////////////////// class MultiTransport methods //////////////
36
37void MultiTransport::init(ThermoPhase* thermo, int mode, int log_level)
38{
39 GasTransport::init(thermo, mode, log_level);
40
41 // the L matrix
42 m_Lmatrix.resize(3*m_nsp, 3*m_nsp);
43 m_a.resize(3*m_nsp, 1.0);
44 m_b.resize(3*m_nsp, 0.0);
45 m_aa.resize(m_nsp, m_nsp, 0.0);
46 m_molefracs_last.resize(m_nsp, -1.0);
47 m_frot_298.resize(m_nsp);
48 m_rotrelax.resize(m_nsp);
49 m_cinternal.resize(m_nsp);
53
54 // set flags all false
55 m_l0000_ok = false;
56 m_lmatrix_soln_ok = false;
57 m_thermal_tlast = Undef;
58
59 // some work space
60 m_spwork1.resize(m_nsp);
61 m_spwork2.resize(m_nsp);
62 m_spwork3.resize(m_nsp);
63
64 // precompute and store log(epsilon_ij/k_B)
65 m_log_eps_k.resize(m_nsp, m_nsp);
66 for (size_t i = 0; i < m_nsp; i++) {
67 for (size_t j = i; j < m_nsp; j++) {
68 m_log_eps_k(i,j) = log(m_epsilon(i,j)/Boltzmann);
69 m_log_eps_k(j,i) = m_log_eps_k(i,j);
70 }
71 }
72
73 // precompute and store constant parts of the Parker rotational
74 // collision number temperature correction
75 const double sq298 = sqrt(298.0);
76 const double kb298 = Boltzmann * 298.0;
77 m_sqrt_eps_k.resize(m_nsp);
78 for (size_t k = 0; k < m_nsp; k++) {
79 m_sqrt_eps_k[k] = sqrt(m_eps[k]/Boltzmann);
80 m_frot_298[k] = Frot(m_eps[k]/kb298, m_sqrt_eps_k[k]/sq298);
81 }
82}
83
85{
87 m_thermal_tlast = Undef;
88 m_l0000_ok = false;
89 m_lmatrix_soln_ok = false;
90 m_molefracs_last[0] += 1.23e-4;
91}
92
94{
95 solveLMatrixEquation();
96 double sum = 0.0;
97 for (size_t k = 0; k < 2*m_nsp; k++) {
98 sum += m_b[k + m_nsp] * m_a[k + m_nsp];
99 }
100 return -4.0*sum;
101}
102
104{
105 solveLMatrixEquation();
106 const double c = 1.6/GasConstant;
107 for (size_t k = 0; k < m_nsp; k++) {
108 dt[k] = c * m_mw[k] * m_molefracs[k] * m_a[k];
109 }
110}
111
112double MultiTransport::pressure_ig()
113{
115}
116
117void MultiTransport::solveLMatrixEquation()
118{
119 // if T has changed, update the temperature-dependent properties.
121 update_C();
122 if (m_lmatrix_soln_ok) {
123 return;
124 }
125
126 // Copy the mole fractions twice into the last two blocks of the right-hand-
127 // side vector m_b. The first block of m_b was set to zero when it was
128 // created, and is not modified so doesn't need to be reset to zero.
129 for (size_t k = 0; k < m_nsp; k++) {
130 m_b[k] = 0.0;
131 m_b[k + m_nsp] = m_molefracs[k];
132 m_b[k + 2*m_nsp] = m_molefracs[k];
133 }
134
135 // Set the right-hand side vector to zero in the 3rd block for all species
136 // with no internal energy modes. The corresponding third-block rows and
137 // columns will be set to zero, except on the diagonal of L01,01, where they
138 // are set to 1.0. This has the effect of eliminating these equations from
139 // the system, since the equation becomes: m_a[2*m_nsp + k] = 0.0.
140
141 // Note that this differs from the Chemkin procedure, where all *monatomic*
142 // species are excluded. Since monatomic radicals can have non-zero internal
143 // heat capacities due to electronic excitation, they should be retained.
144 for (size_t k = 0; k < m_nsp; k++) {
145 if (!hasInternalModes(k)) {
146 m_b[2*m_nsp + k] = 0.0;
147 }
148 }
149
150 // evaluate the submatrices of the L matrix
151 m_Lmatrix.resize(3*m_nsp, 3*m_nsp, 0.0);
152
153 //! Evaluate the upper-left block of the L matrix.
154 eval_L0000(m_molefracs.data());
155 eval_L0010(m_molefracs.data());
156 eval_L0001();
157 eval_L1000();
158 eval_L1010(m_molefracs.data());
159 eval_L1001(m_molefracs.data());
160 eval_L0100();
161 eval_L0110();
162 eval_L0101(m_molefracs.data());
163
164 // Solve it using GMRES or LU decomposition. The last solution in m_a should
165 // provide a good starting guess, so convergence should be fast.
166 m_a = m_b;
167 solve(m_Lmatrix, m_a.data());
168 m_lmatrix_soln_ok = true;
170 // L matrix is overwritten with LU decomposition
171 m_l0000_ok = false;
172}
173
174void MultiTransport::getSpeciesFluxes(size_t ndim, const double* const grad_T,
175 size_t ldx, const double* const grad_X,
176 size_t ldf, double* const fluxes)
177{
178 // update the binary diffusion coefficients if necessary
179 update_T();
180 updateDiff_T();
181
182 // If any component of grad_T is non-zero, then get the
183 // thermal diffusion coefficients
184 bool addThermalDiffusion = false;
185 for (size_t i = 0; i < ndim; i++) {
186 if (grad_T[i] != 0.0) {
187 addThermalDiffusion = true;
188 }
189 }
190 if (addThermalDiffusion) {
192 }
193
194 const double* y = m_thermo->massFractions();
195 double rho = m_thermo->density();
196
197 for (size_t i = 0; i < m_nsp; i++) {
198 double sum = 0.0;
199 for (size_t j = 0; j < m_nsp; j++) {
200 m_aa(i,j) = m_molefracs[j]*m_molefracs[i]/m_bdiff(i,j);
201 sum += m_aa(i,j);
202 }
203 m_aa(i,i) -= sum;
204 }
205
206 // enforce the condition \sum Y_k V_k = 0. This is done by replacing
207 // the flux equation with the largest gradx component in the first
208 // coordinate direction with the flux balance condition.
209 size_t jmax = 0;
210 double gradmax = -1.0;
211 for (size_t j = 0; j < m_nsp; j++) {
212 if (fabs(grad_X[j]) > gradmax) {
213 gradmax = fabs(grad_X[j]);
214 jmax = j;
215 }
216 }
217
218 // set the matrix elements in this row to the mass fractions,
219 // and set the entry in gradx to zero
220 for (size_t j = 0; j < m_nsp; j++) {
221 m_aa(jmax,j) = y[j];
222 }
223 vector<double> gsave(ndim), grx(ldx*m_nsp);
224 for (size_t n = 0; n < ldx*ndim; n++) {
225 grx[n] = grad_X[n];
226 }
227
228 // copy grad_X to fluxes
229 for (size_t n = 0; n < ndim; n++) {
230 const double* gx = grad_X + ldx*n;
231 copy(gx, gx + m_nsp, fluxes + ldf*n);
232 fluxes[jmax + n*ldf] = 0.0;
233 }
234
235 // solve the equations
236 solve(m_aa, fluxes, ndim, ldf);
237 double pp = pressure_ig();
238
239 // multiply diffusion velocities by rho * V to create mass fluxes, and
240 // restore the gradx elements that were modified
241 for (size_t n = 0; n < ndim; n++) {
242 size_t offset = n*ldf;
243 for (size_t i = 0; i < m_nsp; i++) {
244 fluxes[i + offset] *= rho * y[i] / pp;
245 }
246 }
247
248 // thermal diffusion
249 if (addThermalDiffusion) {
250 for (size_t n = 0; n < ndim; n++) {
251 size_t offset = n*ldf;
252 double grad_logt = grad_T[n]/m_temp;
253 for (size_t i = 0; i < m_nsp; i++) {
254 fluxes[i + offset] -= m_spwork[i]*grad_logt;
255 }
256 }
257 }
258}
259
260void MultiTransport::getMassFluxes(const double* state1, const double* state2,
261 double delta, double* fluxes)
262{
263 double* x1 = m_spwork1.data();
264 double* x2 = m_spwork2.data();
265 double* x3 = m_spwork3.data();
266 size_t nsp = m_thermo->nSpecies();
267 m_thermo->restoreState(nsp+2, state1);
268 double p1 = m_thermo->pressure();
269 double t1 = state1[0];
271
272 m_thermo->restoreState(nsp+2, state2);
273 double p2 = m_thermo->pressure();
274 double t2 = state2[0];
276
277 double p = 0.5*(p1 + p2);
278 double t = 0.5*(state1[0] + state2[0]);
279
280 for (size_t n = 0; n < nsp; n++) {
281 x3[n] = 0.5*(x1[n] + x2[n]);
282 }
283 m_thermo->setState_TPX(t, p, x3);
285
286 // update the binary diffusion coefficients if necessary
287 update_T();
288 updateDiff_T();
289
290 // If there is a temperature gradient, then get the
291 // thermal diffusion coefficients
292 bool addThermalDiffusion = false;
293 if (state1[0] != state2[0]) {
294 addThermalDiffusion = true;
296 }
297
298 const double* y = m_thermo->massFractions();
299 double rho = m_thermo->density();
300 for (size_t i = 0; i < m_nsp; i++) {
301 double sum = 0.0;
302 for (size_t j = 0; j < m_nsp; j++) {
303 m_aa(i,j) = m_molefracs[j]*m_molefracs[i]/m_bdiff(i,j);
304 sum += m_aa(i,j);
305 }
306 m_aa(i,i) -= sum;
307 }
308
309 // enforce the condition \sum Y_k V_k = 0. This is done by replacing the
310 // flux equation with the largest gradx component with the flux balance
311 // condition.
312 size_t jmax = 0;
313 double gradmax = -1.0;
314 for (size_t j = 0; j < m_nsp; j++) {
315 if (fabs(x2[j] - x1[j]) > gradmax) {
316 gradmax = fabs(x1[j] - x2[j]) / delta;
317 jmax = j;
318 }
319 }
320
321 // set the matrix elements in this row to the mass fractions,
322 // and set the entry in gradx to zero
323 for (size_t j = 0; j < m_nsp; j++) {
324 m_aa(jmax,j) = y[j];
325 fluxes[j] = (x2[j] - x1[j]) / delta;
326 }
327 fluxes[jmax] = 0.0;
328
329 // Solve the equations
330 solve(m_aa, fluxes);
331
332 double pp = pressure_ig();
333 // multiply diffusion velocities by rho * Y_k to create
334 // mass fluxes, and divide by pressure
335 for (size_t i = 0; i < m_nsp; i++) {
336 fluxes[i] *= rho * y[i] / pp;
337 }
338
339 // thermal diffusion
340 if (addThermalDiffusion) {
341 double grad_logt = (t2 - t1) / m_temp / delta;
342 for (size_t i = 0; i < m_nsp; i++) {
343 fluxes[i] -= m_spwork[i]*grad_logt;
344 }
345 }
346}
347
348void MultiTransport::getMolarFluxes(const double* const state1,
349 const double* const state2,
350 const double delta,
351 double* const fluxes)
352{
353 getMassFluxes(state1, state2, delta, fluxes);
354 for (size_t k = 0; k < m_thermo->nSpecies(); k++) {
355 fluxes[k] /= m_mw[k];
356 }
357}
358
359void MultiTransport::getMultiDiffCoeffs(const size_t ld, double* const d)
360{
361 double p = pressure_ig();
362
363 // update the mole fractions
364 update_C();
365
366 // update the binary diffusion coefficients
367 update_T();
369
370 // evaluate L0000 if the temperature or concentrations have
371 // changed since it was last evaluated.
372 if (!m_l0000_ok) {
373 eval_L0000(m_molefracs.data());
374 }
375
376 // invert L00,00
377 invert(m_Lmatrix, m_nsp);
378 m_l0000_ok = false; // matrix is overwritten by inverse
379 m_lmatrix_soln_ok = false;
380
381 double prefactor = 16.0 * m_temp
382 * m_thermo->meanMolecularWeight()/(25.0 * p);
383 for (size_t i = 0; i < m_nsp; i++) {
384 for (size_t j = 0; j < m_nsp; j++) {
385 double c = prefactor/m_mw[j];
386 d[ld*j + i] = c*m_molefracs[i]*
387 (m_Lmatrix(i,j) - m_Lmatrix(i,i));
388 }
389 }
390
391}
392
394{
395 if (m_temp == m_thermo->temperature() && m_nsp == m_thermo->nSpecies()) {
396 return;
397 }
398 GasTransport::update_T();
399 // temperature has changed, so polynomial fits will need to be
400 // redone, and the L matrix reevaluated.
401 m_lmatrix_soln_ok = false;
402 m_l0000_ok = false;
403}
404
406{
407 // Update the local mole fraction array
409
410 for (size_t k = 0; k < m_nsp; k++) {
411 // add an offset to avoid a pure species condition
412 m_molefracs[k] = std::max(Tiny, m_molefracs[k]);
413 if (m_molefracs[k] != m_molefracs_last[k]) {
414 // If any mole fractions have changed, signal that concentration-
415 // dependent quantities will need to be recomputed before use.
416 m_l0000_ok = false;
417 m_lmatrix_soln_ok = false;
418 }
419 }
420}
421
423{
424 if (m_thermal_tlast == m_thermo->temperature()) {
425 return;
426 }
427 // we need species viscosities and binary diffusion coefficients
429 updateDiff_T();
430
431 // evaluate polynomial fits for A*, B*, C*
432 for (size_t i = 0; i < m_nsp; i++) {
433 for (size_t j = i; j < m_nsp; j++) {
434 double z = m_star_poly_uses_actualT[i][j] == 1 ? m_logt : m_logt - m_log_eps_k(i,j);
435 int ipoly = m_poly[i][j];
436 if (m_mode == CK_Mode) {
437 m_astar(i,j) = poly6(z, m_astar_poly[ipoly].data());
438 m_bstar(i,j) = poly6(z, m_bstar_poly[ipoly].data());
439 m_cstar(i,j) = poly6(z, m_cstar_poly[ipoly].data());
440 } else {
441 m_astar(i,j) = poly8(z, m_astar_poly[ipoly].data());
442 m_bstar(i,j) = poly8(z, m_bstar_poly[ipoly].data());
443 m_cstar(i,j) = poly8(z, m_cstar_poly[ipoly].data());
444 }
445 m_astar(j,i) = m_astar(i,j);
446 m_bstar(j,i) = m_bstar(i,j);
447 m_cstar(j,i) = m_cstar(i,j);
448 }
449 }
450
451 // evaluate the temperature-dependent rotational relaxation rate
452 for (size_t k = 0; k < m_nsp; k++) {
453 double tr = m_eps[k]/ m_kbt;
454 double sqtr = m_sqrt_eps_k[k] / m_sqrt_t;
455 m_rotrelax[k] = std::max(1.0,m_zrot[k]) * m_frot_298[k]/Frot(tr, sqtr);
456 }
457
458 double c = 1.2*GasConstant*m_temp;
459 for (size_t k = 0; k < m_nsp; k++) {
460 m_bdiff(k,k) = c * m_visc[k] * m_astar(k,k)/m_mw[k];
461 }
462
463 // Calculate the internal heat capacities by subtracting off the translational contributions
464 /*
465 * HKM Exploratory comment:
466 * The translational component is 1.5
467 * The rotational component is 1.0 for a linear molecule and 1.5 for a nonlinear molecule
468 * and zero for a monatomic.
469 * Chemkin has traditionally subtracted 1.5 here (SAND86-8246).
470 * The original Dixon-Lewis paper subtracted 1.5 here.
471 */
472 vector<double> cp(m_thermo->nSpecies());
473 m_thermo->getCp_R_ref(&cp[0]);
474 for (size_t k = 0; k < m_nsp; k++) {
475 m_cinternal[k] = cp[k] - 2.5;
476 }
477 m_thermal_tlast = m_thermo->temperature();
478}
479
480//! Constant to compare dimensionless heat capacities against zero
481static const double Min_C_Internal = 0.001;
482
483bool MultiTransport::hasInternalModes(size_t j)
484{
485 return (m_cinternal[j] > Min_C_Internal);
486}
487
488void MultiTransport::eval_L0000(const double* const x)
489{
490 double prefactor = 16.0*m_temp/25.0;
491 double sum;
492 for (size_t i = 0; i < m_nsp; i++) {
493 // subtract-off the k=i term to account for the first delta
494 // function in Eq. (12.121)
495 sum = -x[i]/m_bdiff(i,i);
496 for (size_t k = 0; k < m_nsp; k++) {
497 sum += x[k]/m_bdiff(i,k);
498 }
499
500 sum /= m_mw[i];
501 for (size_t j = 0; j != m_nsp; ++j) {
502 m_Lmatrix(i,j) = prefactor * x[j]
503 * (m_mw[j] * sum + x[i]/m_bdiff(i,j));
504 }
505 // diagonal term is zero
506 m_Lmatrix(i,i) = 0.0;
507 }
508}
509
510void MultiTransport::eval_L0010(const double* const x)
511{
512 double prefactor = 1.6*m_temp;
513 for (size_t j = 0; j < m_nsp; j++) {
514 double xj = x[j];
515 double wj = m_mw[j];
516 double sum = 0.0;
517 for (size_t i = 0; i < m_nsp; i++) {
518 m_Lmatrix(i,j + m_nsp) = - prefactor * x[i] * xj * m_mw[i] *
519 (1.2 * m_cstar(j,i) - 1.0) /
520 ((wj + m_mw[i]) * m_bdiff(j,i));
521
522 // the next term is independent of "j";
523 // need to do it for the "j,j" term
524 sum -= m_Lmatrix(i,j+m_nsp);
525 }
526 m_Lmatrix(j,j+m_nsp) += sum;
527 }
528}
529
531{
532 for (size_t j = 0; j < m_nsp; j++) {
533 for (size_t i = 0; i < m_nsp; i++) {
534 m_Lmatrix(i+m_nsp,j) = m_Lmatrix(j,i+m_nsp);
535 }
536 }
537}
538
539void MultiTransport::eval_L1010(const double* x)
540{
541 const double fiveover3pi = 5.0/(3.0*Pi);
542 double prefactor = (16.0*m_temp)/25.0;
543
544 for (size_t j = 0; j < m_nsp; j++) {
545 // get constant terms that depend on just species "j"
546 double constant1 = prefactor*x[j];
547 double wjsq = m_mw[j]*m_mw[j];
548 double constant2 = 13.75*wjsq;
549 double constant3 = m_crot[j]/m_rotrelax[j];
550 double constant4 = 7.5*wjsq;
551 double fourmj = 4.0*m_mw[j];
552 double threemjsq = 3.0*m_mw[j]*m_mw[j];
553 double sum = 0.0;
554 for (size_t i = 0; i < m_nsp; i++) {
555 double sumwij = m_mw[i] + m_mw[j];
556 double term1 = m_bdiff(i,j) * sumwij*sumwij;
557 double term2 = fourmj*m_astar(i,j)*(1.0 + fiveover3pi*
558 (constant3 + (m_crot[i]/m_rotrelax[i]))); // see Eq. (12.125)
559
560 m_Lmatrix(i+m_nsp,j+m_nsp) = constant1*x[i]*m_mw[i] /(m_mw[j]*term1) *
561 (constant2 - threemjsq*m_bstar(i,j)
562 - term2*m_mw[j]);
563
564 sum += x[i] /(term1) *
565 (constant4 + m_mw[i]*m_mw[i]*
566 (6.25 - 3.0*m_bstar(i,j)) + term2*m_mw[i]);
567 }
568
569 m_Lmatrix(j+m_nsp,j+m_nsp) -= sum*constant1;
570 }
571}
572
573void MultiTransport::eval_L1001(const double* x)
574{
575 double prefactor = 32.00*m_temp/(5.00*Pi);
576 for (size_t j = 0; j < m_nsp; j++) {
577 // collect terms that depend only on "j"
578 if (hasInternalModes(j)) {
579 double constant = prefactor*m_mw[j]*x[j]*m_crot[j]/(m_cinternal[j]*m_rotrelax[j]);
580 double sum = 0.0;
581 for (size_t i = 0; i < m_nsp; i++) {
582 // see Eq. (12.127)
583 m_Lmatrix(i+m_nsp,j+2*m_nsp) = constant * m_astar(j,i) * x[i] /
584 ((m_mw[j] + m_mw[i]) * m_bdiff(j,i));
585 sum += m_Lmatrix(i+m_nsp,j+2*m_nsp);
586 }
587 m_Lmatrix(j+m_nsp,j+2*m_nsp) += sum;
588 } else {
589 for (size_t i = 0; i < m_nsp; i++) {
590 m_Lmatrix(i+m_nsp,j+2*m_nsp) = 0.0;
591 }
592 }
593 }
594}
595
596void MultiTransport::eval_L0001()
597{
598 for (size_t j = 0; j < m_nsp; j++) {
599 for (size_t i = 0; i < m_nsp; i++) {
600 m_Lmatrix(i,j+2*m_nsp) = 0.0;
601 }
602 }
603}
604
605void MultiTransport::eval_L0100()
606{
607 for (size_t j = 0; j < m_nsp; j++) {
608 for (size_t i = 0; i < m_nsp; i++) {
609 m_Lmatrix(i+2*m_nsp,j) = 0.0; // see Eq. (12.123)
610 }
611 }
612}
613
614void MultiTransport::eval_L0110()
615{
616 for (size_t j = 0; j < m_nsp; j++) {
617 for (size_t i = 0; i < m_nsp; i++) {
618 m_Lmatrix(i+2*m_nsp,j+m_nsp) = m_Lmatrix(j+m_nsp,i+2*m_nsp); // see Eq. (12.123)
619 }
620 }
621}
622
623void MultiTransport::eval_L0101(const double* x)
624{
625 for (size_t i = 0; i < m_nsp; i++) {
626 if (hasInternalModes(i)) {
627 // collect terms that depend only on "i"
628 double constant1 = 4*m_temp*x[i]/m_cinternal[i];
629 double constant2 = 12*m_mw[i]*m_crot[i] /
630 (5*Pi*m_cinternal[i]*m_rotrelax[i]);
631 double sum = 0.0;
632 for (size_t k = 0; k < m_nsp; k++) {
633 // see Eq. (12.131)
634 double diff_int = m_bdiff(i,k);
635 m_Lmatrix(k+2*m_nsp,i+2*m_nsp) = 0.0;
636 sum += x[k]/diff_int;
637 if (k != i) {
638 sum += x[k]*m_astar(i,k)*constant2 / (m_mw[k]*diff_int);
639 }
640 }
641 // see Eq. (12.130)
642 m_Lmatrix(i+2*m_nsp,i+2*m_nsp) =
643 - 8/Pi*m_mw[i]*x[i]*x[i]*m_crot[i] /
644 (m_cinternal[i]*m_cinternal[i]*GasConstant*m_visc[i]*m_rotrelax[i])
645 - constant1*sum;
646 } else {
647 for (size_t k = 0; k < m_nsp; k++) {
648 m_Lmatrix(i+2*m_nsp,i+2*m_nsp) = 1.0;
649 }
650 }
651 }
652}
653
654}
ThermoPhase object for the ideal gas equation of state - workhorse for Cantera (see Thermodynamic Pro...
Interface for class MultiTransport.
void resize(size_t n, size_t m, double v=0.0) override
Resize the matrix.
vector< double > m_mw
Local copy of the species molecular weights.
vector< double > m_molefracs
Vector of species mole fractions.
double m_temp
Current value of the temperature at which the properties in this object are calculated (Kelvin).
vector< double > m_eps
Lennard-Jones well-depth of the species in the current phase.
virtual void updateDiff_T()
Update the binary diffusion coefficients.
DenseMatrix m_epsilon
The effective well depth for (i,j) collisions.
vector< double > m_spwork
work space length = m_kk
vector< double > m_zrot
Rotational relaxation number for each species.
int m_mode
Type of the polynomial fits to temperature.
double m_logt
Current value of the log of the temperature.
vector< double > m_visc
vector of species viscosities (kg /m /s).
virtual void updateSpeciesViscosities()
Update the pure-species viscosities.
double m_sqrt_t
current value of temperature to 1/2 power
DenseMatrix m_bdiff
Matrix of binary diffusion coefficients at the reference pressure and the current temperature Size is...
void init(ThermoPhase *thermo, int mode=0, int log_level=-7) override
Initialize a transport manager.
vector< double > m_crot
Dimensionless rotational heat capacity of each species.
void invalidateCache() override
Invalidate any cached values which are normally updated only when a change in state is detected.
double m_kbt
Current value of Boltzmann constant times the temperature (Joules)
vector< vector< int > > m_star_poly_uses_actualT
Flag to indicate for which (i,j) interaction pairs the actual temperature is used instead of the redu...
vector< vector< double > > m_bstar_poly
Fit for bstar collision integral.
vector< vector< double > > m_astar_poly
Fit for astar collision integral.
vector< vector< int > > m_poly
Indices for the (i,j) interaction in collision integral fits.
vector< vector< double > > m_cstar_poly
Fit for cstar collision integral.
void getMassFluxes(const double *state1, const double *state2, double delta, double *fluxes) override
Get the mass diffusional fluxes [kg/m^2/s] of the species, given the thermodynamic state at two nearb...
void getMolarFluxes(const double *const state1, const double *const state2, const double delta, double *const fluxes) override
Get the molar diffusional fluxes [kmol/m^2/s] of the species, given the thermodynamic state at two ne...
bool m_l0000_ok
Boolean indicating viscosity is up to date.
void update_T() override
Update basic temperature-dependent quantities if the temperature has changed.
double thermalConductivity() override
Returns the mixture thermal conductivity in W/m/K.
void eval_L0010(const double *const x)
Evaluate the L0010 matrices.
void eval_L0000(const double *const x)
Evaluate the L0000 matrices.
DenseMatrix m_astar
Dense matrix for astar.
void getSpeciesFluxes(size_t ndim, const double *const grad_T, size_t ldx, const double *const grad_X, size_t ldf, double *const fluxes) override
Get the species diffusive mass fluxes wrt to the mass averaged velocity, given the gradients in mole ...
void updateThermal_T()
Update the temperature-dependent terms needed to compute the thermal conductivity and thermal diffusi...
vector< double > m_molefracs_last
Mole fraction vector from last L-matrix evaluation.
void init(ThermoPhase *thermo, int mode=0, int log_level=-7) override
Initialize a transport manager.
DenseMatrix m_cstar
Dense matrix for cstar.
void update_C() override
Update basic concentration-dependent quantities if the concentrations have changed.
void invalidateCache() override
Invalidate any cached values which are normally updated only when a change in state is detected.
void getThermalDiffCoeffs(double *const dt) override
Return the thermal diffusion coefficients (kg/m/s)
void getMultiDiffCoeffs(const size_t ld, double *const d) override
Return the Multicomponent diffusion coefficients. Units: [m^2/s].
DenseMatrix m_bstar
Dense matrix for bstar.
void eval_L1000()
Evaluate the L1000 matrices.
virtual double molarDensity() const
Molar density (kmol/m^3).
Definition Phase.cpp:576
void restoreState(const vector< double > &state)
Restore a state saved on a previous call to saveState.
Definition Phase.cpp:260
size_t nSpecies() const
Returns the number of species in the phase.
Definition Phase.h:231
double temperature() const
Temperature (K).
Definition Phase.h:562
double meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition Phase.h:655
void getMoleFractions(double *const x) const
Get the species mole fraction vector.
Definition Phase.cpp:434
const double * massFractions() const
Return a const pointer to the mass fraction array.
Definition Phase.h:442
virtual double density() const
Density (kg/m^3).
Definition Phase.h:587
virtual double pressure() const
Return the thermodynamic pressure (Pa).
Definition Phase.h:580
Base class for a phase with thermodynamic properties.
virtual void getCp_R_ref(double *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
virtual void setState_TPX(double t, double p, const double *x)
Set the temperature (K), pressure (Pa), and mole fractions.
ThermoPhase * m_thermo
pointer to the object representing the phase
Definition Transport.h:437
size_t m_nsp
Number of species.
Definition Transport.h:440
ThermoPhase & thermo()
Phase object.
Definition Transport.h:103
R poly6(D x, R *c)
Templated evaluation of a polynomial of order 6.
Definition utilities.h:117
R poly8(D x, R *c)
Templated evaluation of a polynomial of order 8.
Definition utilities.h:129
const double Boltzmann
Boltzmann constant [J/K].
Definition ct_defs.h:84
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:120
const double Pi
Pi.
Definition ct_defs.h:68
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
const double Tiny
Small number to compare differences of mole fractions against.
Definition ct_defs.h:173
const double Undef
Fairly random number to be used to initialize variables against to see if they are subsequently defin...
Definition ct_defs.h:164
int invert(DenseMatrix &A, size_t nn)
invert A. A is overwritten with A^-1.
offset
Offsets of solution components in the 1D solution array.
Definition Flow1D.h:24
static const double Min_C_Internal
Constant to compare dimensionless heat capacities against zero.
int solve(DenseMatrix &A, double *b, size_t nrhs, size_t ldb)
Solve Ax = b. Array b is overwritten on exit with x.
double Frot(double tr, double sqtr)
The Parker temperature correction to the rotational collision number.
Contains declarations for string manipulation functions within Cantera.
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...