Cantera  2.3.0
LiquidTransport.cpp
Go to the documentation of this file.
1 /**
2  * @file LiquidTransport.cpp
3  * Mixture-averaged transport properties for ideal gas mixtures.
4  */
5 
6 // This file is part of Cantera. See License.txt in the top-level directory or
7 // at http://www.cantera.org/license.txt for license and copyright information.
8 
11 
12 using namespace std;
13 
14 namespace Cantera
15 {
16 LiquidTransport::LiquidTransport(thermo_t* thermo, int ndim) :
17  Transport(thermo, ndim),
18  m_nsp2(0),
19  m_viscMixModel(0),
20  m_ionCondMixModel(0),
21  m_lambdaMixModel(0),
22  m_diffMixModel(0),
23  m_radiusMixModel(0),
24  m_iStateMF(-1),
25  concTot_(0.0),
26  concTot_tran_(0.0),
27  dens_(0.0),
28  m_temp(-1.0),
29  m_press(-1.0),
30  m_lambda(-1.0),
31  m_viscmix(-1.0),
32  m_ionCondmix(-1.0),
33  m_visc_mix_ok(false),
34  m_visc_temp_ok(false),
35  m_visc_conc_ok(false),
36  m_ionCond_mix_ok(false),
37  m_ionCond_temp_ok(false),
38  m_ionCond_conc_ok(false),
39  m_mobRat_mix_ok(false),
40  m_mobRat_temp_ok(false),
41  m_mobRat_conc_ok(false),
42  m_selfDiff_mix_ok(false),
43  m_selfDiff_temp_ok(false),
44  m_selfDiff_conc_ok(false),
45  m_radi_mix_ok(false),
46  m_radi_temp_ok(false),
47  m_radi_conc_ok(false),
48  m_diff_mix_ok(false),
49  m_diff_temp_ok(false),
50  m_lambda_temp_ok(false),
51  m_lambda_mix_ok(false),
52  m_mode(-1000),
53  m_debug(false)
54 {
55 }
56 
58  Transport(right.m_thermo, right.m_nDim),
59  m_nsp2(0),
60  m_viscMixModel(0),
61  m_ionCondMixModel(0),
62  m_lambdaMixModel(0),
63  m_diffMixModel(0),
64  m_radiusMixModel(0),
65  m_iStateMF(-1),
66  concTot_(0.0),
67  concTot_tran_(0.0),
68  dens_(0.0),
69  m_temp(-1.0),
70  m_press(-1.0),
71  m_lambda(-1.0),
72  m_viscmix(-1.0),
73  m_ionCondmix(-1.0),
74  m_visc_mix_ok(false),
75  m_visc_temp_ok(false),
76  m_visc_conc_ok(false),
77  m_ionCond_mix_ok(false),
78  m_ionCond_temp_ok(false),
79  m_ionCond_conc_ok(false),
80  m_mobRat_mix_ok(false),
81  m_mobRat_temp_ok(false),
82  m_mobRat_conc_ok(false),
83  m_selfDiff_mix_ok(false),
84  m_selfDiff_temp_ok(false),
85  m_selfDiff_conc_ok(false),
86  m_radi_mix_ok(false),
87  m_radi_temp_ok(false),
88  m_radi_conc_ok(false),
89  m_diff_mix_ok(false),
90  m_diff_temp_ok(false),
91  m_lambda_temp_ok(false),
92  m_lambda_mix_ok(false),
93  m_mode(-1000),
94  m_debug(false)
95 {
96  /*
97  * Use the assignment operator to do the brunt
98  * of the work for the copy constructor.
99  */
100  *this = right;
101 }
102 
103 LiquidTransport& LiquidTransport::operator=(const LiquidTransport& right)
104 {
105  if (&right == this) {
106  return *this;
107  }
108  Transport::operator=(right);
109  m_nsp2 = right.m_nsp2;
110  m_mw = right.m_mw;
111  m_viscTempDep_Ns = right.m_viscTempDep_Ns;
112  m_ionCondTempDep_Ns = right.m_ionCondTempDep_Ns;
113  m_mobRatTempDep_Ns = right.m_mobRatTempDep_Ns;
114  m_selfDiffTempDep_Ns = right.m_selfDiffTempDep_Ns;
115  m_lambdaTempDep_Ns = right.m_lambdaTempDep_Ns;
116  m_diffTempDep_Ns = right.m_diffTempDep_Ns;
117  m_radiusTempDep_Ns = right.m_radiusTempDep_Ns;
118  m_hydrodynamic_radius = right.m_hydrodynamic_radius;
119  m_Grad_X = right.m_Grad_X;
120  m_Grad_T = right.m_Grad_T;
121  m_Grad_V = right.m_Grad_V;
122  m_Grad_mu = right.m_Grad_mu;
123  m_bdiff = right.m_bdiff;
124  m_viscSpecies = right.m_viscSpecies;
125  m_ionCondSpecies = right.m_ionCondSpecies;
126  m_mobRatSpecies = right.m_mobRatSpecies;
127  m_selfDiffSpecies = right.m_selfDiffSpecies;
128  m_hydrodynamic_radius = right.m_hydrodynamic_radius;
129  m_lambdaSpecies = right.m_lambdaSpecies;
130  m_viscMixModel = right.m_viscMixModel;
131  m_ionCondMixModel = right.m_ionCondMixModel;
132  m_mobRatMixModel = right.m_mobRatMixModel;
133  m_selfDiffMixModel = right.m_selfDiffMixModel;
134  m_lambdaMixModel = right.m_lambdaMixModel;
135  m_diffMixModel = right.m_diffMixModel;
136  m_iStateMF = -1;
137  m_massfracs = right.m_massfracs;
138  m_massfracs_tran = right.m_massfracs_tran;
139  m_molefracs = right.m_molefracs;
140  m_molefracs_tran = right.m_molefracs_tran;
141  m_concentrations = right.m_concentrations;
142  m_actCoeff = right.m_actCoeff;
143  m_Grad_lnAC = right.m_Grad_lnAC;
144  m_chargeSpecies = right.m_chargeSpecies;
145  m_B = right.m_B;
146  m_A = right.m_A;
147  m_temp = right.m_temp;
148  m_press = right.m_press;
149  m_flux = right.m_flux;
150  m_Vdiff = right.m_Vdiff;
151  m_lambda = right.m_lambda;
152  m_viscmix = right.m_viscmix;
153  m_ionCondmix = right.m_ionCondmix;
154  m_mobRatMix = right.m_mobRatMix;
155  m_selfDiffMix = right.m_selfDiffMix;
156  m_spwork = right.m_spwork;
157  m_visc_mix_ok = false;
158  m_visc_temp_ok = false;
159  m_visc_conc_ok = false;
160  m_ionCond_mix_ok = false;
161  m_ionCond_temp_ok = false;
162  m_ionCond_conc_ok = false;
163  m_mobRat_mix_ok = false;
164  m_mobRat_temp_ok = false;
165  m_mobRat_conc_ok = false;
166  m_selfDiff_mix_ok = false;
167  m_selfDiff_temp_ok = false;
168  m_selfDiff_conc_ok = false;
169  m_radi_mix_ok = false;
170  m_radi_temp_ok = false;
171  m_radi_conc_ok = false;
172  m_diff_mix_ok = false;
173  m_diff_temp_ok = false;
174  m_lambda_temp_ok = false;
175  m_lambda_mix_ok = false;
176  m_mode = right.m_mode;
177  m_debug = right.m_debug;
178  m_nDim = right.m_nDim;
179 
180  return *this;
181 }
182 
184 {
185  return new LiquidTransport(*this);
186 }
187 
188 LiquidTransport::~LiquidTransport()
189 {
190  //These are constructed in TransportFactory::newLTP
191  for (size_t k = 0; k < m_nsp; k++) {
192  delete m_viscTempDep_Ns[k];
193  delete m_ionCondTempDep_Ns[k];
194  for (size_t j = 0; j < m_nsp; j++) {
195  delete m_selfDiffTempDep_Ns[j][k];
196  }
197  for (size_t j=0; j < m_nsp2; j++) {
198  delete m_mobRatTempDep_Ns[j][k];
199  }
200  delete m_lambdaTempDep_Ns[k];
201  delete m_radiusTempDep_Ns[k];
202  delete m_diffTempDep_Ns[k];
203  //These are constructed in TransportFactory::newLTI
204  delete m_selfDiffMixModel[k];
205  }
206 
207  for (size_t k = 0; k < m_nsp2; k++) {
208  delete m_mobRatMixModel[k];
209  }
210 
211  delete m_viscMixModel;
212  delete m_ionCondMixModel;
213  delete m_lambdaMixModel;
214  delete m_diffMixModel;
215 }
216 
218 {
219  // Transfer quantitities from the database to the Transport object
220  m_thermo = tr.thermo;
222  m_nsp = m_thermo->nSpecies();
223  m_nsp2 = m_nsp*m_nsp;
224 
225  // Resize the local storage according to the number of species
226  m_mw.resize(m_nsp, 0.0);
227  m_viscSpecies.resize(m_nsp, 0.0);
228  m_viscTempDep_Ns.resize(m_nsp, 0);
229  m_ionCondSpecies.resize(m_nsp, 0.0);
230  m_ionCondTempDep_Ns.resize(m_nsp, 0);
231  m_mobRatTempDep_Ns.resize(m_nsp2);
232  m_mobRatMixModel.resize(m_nsp2);
234  m_mobRatMix.resize(m_nsp2,0.0);
235  m_selfDiffTempDep_Ns.resize(m_nsp);
236  m_selfDiffMixModel.resize(m_nsp);
238  m_selfDiffMix.resize(m_nsp,0.0);
239  for (size_t k = 0; k < m_nsp; k++) {
240  m_selfDiffTempDep_Ns[k].resize(m_nsp, 0);
241  }
242  for (size_t k = 0; k < m_nsp2; k++) {
243  m_mobRatTempDep_Ns[k].resize(m_nsp, 0);
244  }
245  m_lambdaSpecies.resize(m_nsp, 0.0);
246  m_lambdaTempDep_Ns.resize(m_nsp, 0);
247  m_hydrodynamic_radius.resize(m_nsp, 0.0);
248  m_radiusTempDep_Ns.resize(m_nsp, 0);
249 
250  // Make a local copy of the molecular weights
252 
253  // First populate mixing rules and indices (NOTE, we transfer pointers of
254  // manually allocated quantities. We zero out pointers so that we only have
255  // one copy of the pointer)
256  for (size_t k = 0; k < m_nsp; k++) {
258  tr.selfDiffusion[k] = 0;
259  }
260  for (size_t k = 0; k < m_nsp2; k++) {
261  m_mobRatMixModel[k] = tr.mobilityRatio[k];
262  tr.mobilityRatio[k] = 0;
263  }
264 
265  //for each species, assign viscosity model and coefficients
266  for (size_t k = 0; k < m_nsp; k++) {
267  LiquidTransportData& ltd = tr.LTData[k];
268  m_viscTempDep_Ns[k] = ltd.viscosity;
269  ltd.viscosity = 0;
271  ltd.ionConductivity = 0;
272  for (size_t j = 0; j < m_nsp2; j++) {
273  m_mobRatTempDep_Ns[j][k] = ltd.mobilityRatio[j];
274  ltd.mobilityRatio[j] = 0;
275  }
276  for (size_t j = 0; j < m_nsp; j++) {
277  m_selfDiffTempDep_Ns[j][k] = ltd.selfDiffusion[j];
278  ltd.selfDiffusion[j] = 0;
279  }
281  ltd.thermalCond = 0;
283  ltd.hydroRadius = 0;
284  }
285 
286  // Get the input Species Diffusivities. Note that species diffusivities are
287  // not what is needed. Rather the Stefan Boltzmann interaction parameters
288  // are needed for the current model. This section may, therefore, be
289  // extraneous.
290  m_diffTempDep_Ns.resize(m_nsp, 0);
291  //for each species, assign viscosity model and coefficients
292  for (size_t k = 0; k < m_nsp; k++) {
293  LiquidTransportData& ltd = tr.LTData[k];
294  if (ltd.speciesDiffusivity != 0) {
295  cout << "Warning: diffusion coefficient data for "
296  << m_thermo->speciesName(k)
297  << endl
298  << "in the input file is not used for LiquidTransport model."
299  << endl
300  << "LiquidTransport model uses Stefan-Maxwell interaction "
301  << endl
302  << "parameters defined in the <transport> input block."
303  << endl;
304  }
305  }
306 
307  // Here we get interaction parameters from LiquidTransportParams that were
308  // filled in TransportFactory::getLiquidInteractionsTransportData
309  // Interaction models are provided here for viscosity, thermal conductivity,
310  // species diffusivity and hydrodynamics radius (perhaps not needed in the
311  // present class).
313  tr.viscosity = 0;
314 
316  tr.ionConductivity = 0;
317 
319  tr.thermalCond = 0;
320 
322  tr.speciesDiffusivity = 0;
323  if (! m_diffMixModel) {
324  throw CanteraError("LiquidTransport::initLiquid()",
325  "A speciesDiffusivity model is required in the transport block for the phase, but none was provided");
326  }
327 
328  m_bdiff.resize(m_nsp,m_nsp, 0.0);
329 
330  // Don't really need to update this here. It is updated in updateDiff_T()
331  m_diffMixModel->getMatrixTransProp(m_bdiff);
332 
333  m_mode = tr.mode_;
334  m_massfracs.resize(m_nsp, 0.0);
335  m_massfracs_tran.resize(m_nsp, 0.0);
336  m_molefracs.resize(m_nsp, 0.0);
337  m_molefracs_tran.resize(m_nsp, 0.0);
338  m_concentrations.resize(m_nsp, 0.0);
339  m_actCoeff.resize(m_nsp, 0.0);
340  m_chargeSpecies.resize(m_nsp, 0.0);
341  for (size_t i = 0; i < m_nsp; i++) {
343  }
344  m_volume_spec.resize(m_nsp, 0.0);
345  m_Grad_lnAC.resize(m_nDim * m_nsp, 0.0);
346  m_spwork.resize(m_nsp, 0.0);
347 
348  // resize the internal gradient variables
349  m_Grad_X.resize(m_nDim * m_nsp, 0.0);
350  m_Grad_T.resize(m_nDim, 0.0);
351  m_Grad_V.resize(m_nDim, 0.0);
352  m_Grad_mu.resize(m_nDim * m_nsp, 0.0);
353  m_flux.resize(m_nsp, m_nDim, 0.0);
354  m_Vdiff.resize(m_nsp, m_nDim, 0.0);
355 
356  // set all flags to false
357  m_visc_mix_ok = false;
358  m_visc_temp_ok = false;
359  m_visc_conc_ok = false;
360  m_ionCond_mix_ok = false;
361  m_ionCond_temp_ok = false;
362  m_ionCond_conc_ok = false;
363  m_mobRat_mix_ok = false;
364  m_mobRat_temp_ok = false;
365  m_mobRat_conc_ok = false;
366  m_selfDiff_mix_ok = false;
367  m_selfDiff_temp_ok = false;
368  m_selfDiff_conc_ok = false;
369  m_radi_temp_ok = false;
370  m_radi_conc_ok = false;
371  m_lambda_temp_ok = false;
372  m_lambda_mix_ok = false;
373  m_diff_temp_ok = false;
374  m_diff_mix_ok = false;
375  return true;
376 }
377 
379 {
380  update_T();
381  update_C();
382  if (m_visc_mix_ok) {
383  return m_viscmix;
384  }
385  ////// LiquidTranInteraction method
387  return m_viscmix;
388 }
389 
390 void LiquidTransport::getSpeciesViscosities(doublereal* const visc)
391 {
392  update_T();
393  if (!m_visc_temp_ok) {
395  }
396  copy(m_viscSpecies.begin(), m_viscSpecies.end(), visc);
397 }
398 
400 {
401  update_T();
402  update_C();
403  if (m_ionCond_mix_ok) {
404  return m_ionCondmix;
405  }
406  ////// LiquidTranInteraction method
408  return m_ionCondmix;
409 }
410 
412 {
413  update_T();
414  if (!m_ionCond_temp_ok) {
416  }
417  copy(m_ionCondSpecies.begin(), m_ionCondSpecies.end(), ionCond);
418 }
419 
420 void LiquidTransport::mobilityRatio(doublereal* mobRat)
421 {
422  update_T();
423  update_C();
424  // LiquidTranInteraction method
425  if (!m_mobRat_mix_ok) {
426  for (size_t k = 0; k < m_nsp2; k++) {
427  if (m_mobRatMixModel[k]) {
428  m_mobRatMix[k] = m_mobRatMixModel[k]->getMixTransProp(m_mobRatTempDep_Ns[k]);
429  if (m_mobRatMix[k] > 0.0) {
430  m_mobRatMix[k / m_nsp + m_nsp * (k % m_nsp)] = 1.0 / m_mobRatMix[k]; // Also must be off diagonal: k%(1+n)!=0, but then m_mobRatMixModel[k] shouldn't be initialized anyway
431  }
432  }
433  }
434  }
435  for (size_t k = 0; k < m_nsp2; k++) {
436  mobRat[k] = m_mobRatMix[k];
437  }
438 }
439 
441 {
442  update_T();
443  if (!m_mobRat_temp_ok) {
445  }
446  for (size_t k = 0; k < m_nsp2; k++) {
447  for (size_t j = 0; j < m_nsp; j++) {
448  mobRat[k][j] = m_mobRatSpecies(k,j);
449  }
450  }
451 }
452 
453 void LiquidTransport::selfDiffusion(doublereal* const selfDiff)
454 {
455  update_T();
456  update_C();
457  if (!m_selfDiff_mix_ok) {
458  for (size_t k = 0; k < m_nsp; k++) {
459  m_selfDiffMix[k] = m_selfDiffMixModel[k]->getMixTransProp(m_selfDiffTempDep_Ns[k]);
460  }
461  }
462  for (size_t k = 0; k < m_nsp; k++) {
463  selfDiff[k] = m_selfDiffMix[k];
464  }
465 }
466 
467 void LiquidTransport::getSpeciesSelfDiffusion(doublereal** selfDiff)
468 {
469  update_T();
470  if (!m_selfDiff_temp_ok) {
472  }
473  for (size_t k=0; k<m_nsp; k++) {
474  for (size_t j=0; j < m_nsp; j++) {
475  selfDiff[k][j] = m_selfDiffSpecies(k,j);
476  }
477  }
478 }
479 
480 void LiquidTransport::getSpeciesHydrodynamicRadius(doublereal* const radius)
481 {
482  update_T();
483  if (!m_radi_temp_ok) {
485  }
486  copy(m_hydrodynamic_radius.begin(), m_hydrodynamic_radius.end(), radius);
487 }
488 
490 {
491  update_T();
492  update_C();
493  if (!m_lambda_mix_ok) {
495  m_cond_mix_ok = true;
496  }
497  return m_lambda;
498 }
499 
500 void LiquidTransport::getThermalDiffCoeffs(doublereal* const dt)
501 {
502  for (size_t k = 0; k < m_nsp; k++) {
503  dt[k] = 0.0;
504  }
505 }
506 
507 void LiquidTransport::getBinaryDiffCoeffs(size_t ld, doublereal* d)
508 {
509  if (ld != m_nsp) {
510  throw CanteraError("LiquidTransport::getBinaryDiffCoeffs",
511  "First argument does not correspond to number of species in model.\nDiff Coeff matrix may be misdimensioned");
512  }
513  update_T();
514  // if necessary, evaluate the binary diffusion coefficients
515  // from the polynomial fits
516  if (!m_diff_temp_ok) {
517  updateDiff_T();
518  }
519  for (size_t i = 0; i < m_nsp; i++) {
520  for (size_t j = 0; j < m_nsp; j++) {
521  d[ld*j + i] = 1.0 / m_bdiff(i,j);
522 
523  }
524  }
525 }
526 
527 void LiquidTransport::getMobilities(doublereal* const mobil)
528 {
529  getMixDiffCoeffs(m_spwork.data());
530  doublereal c1 = ElectronCharge / (Boltzmann * m_temp);
531  for (size_t k = 0; k < m_nsp; k++) {
532  mobil[k] = c1 * m_spwork[k];
533  }
534 }
535 
536 void LiquidTransport::getFluidMobilities(doublereal* const mobil_f)
537 {
538  getMixDiffCoeffs(m_spwork.data());
539  doublereal c1 = 1.0 / (GasConstant * m_temp);
540  for (size_t k = 0; k < m_nsp; k++) {
541  mobil_f[k] = c1 * m_spwork[k];
542  }
543 }
544 
545 void LiquidTransport::set_Grad_T(const doublereal* grad_T)
546 {
547  for (size_t a = 0; a < m_nDim; a++) {
548  m_Grad_T[a] = grad_T[a];
549  }
550 }
551 
552 void LiquidTransport::set_Grad_V(const doublereal* grad_V)
553 {
554  for (size_t a = 0; a < m_nDim; a++) {
555  m_Grad_V[a] = grad_V[a];
556  }
557 }
558 
559 void LiquidTransport::set_Grad_X(const doublereal* grad_X)
560 {
561  size_t itop = m_nDim * m_nsp;
562  for (size_t i = 0; i < itop; i++) {
563  m_Grad_X[i] = grad_X[i];
564  }
565 }
566 
568 {
569  vector_fp gradT(m_nDim,0.0);
570  vector_fp gradX(m_nDim * m_nsp, 0.0);
571  vector_fp gradV(m_nDim, 1.0);
572 
573  set_Grad_T(&gradT[0]);
574  set_Grad_X(&gradX[0]);
575  set_Grad_V(&gradV[0]);
576 
577  vector_fp fluxes(m_nsp * m_nDim);
578  doublereal current;
579  getSpeciesFluxesExt(m_nDim, &fluxes[0]);
580 
581  //sum over species charges, fluxes, Faraday to get current
582  // Since we want the scalar conductivity, we need only consider one-dim
583  for (size_t i = 0; i < 1; i++) {
584  current = 0.0;
585  for (size_t k = 0; k < m_nsp; k++) {
586  current += m_chargeSpecies[k] * Faraday * fluxes[k] / m_mw[k];
587  }
588  //divide by unit potential gradient
589  current /= - gradV[i];
590  }
591  return current;
592 }
593 
595  const doublereal* grad_T,
596  int ldx,
597  const doublereal* grad_X,
598  int ldf,
599  const doublereal* grad_V,
600  doublereal* current)
601 {
602  set_Grad_T(grad_T);
603  set_Grad_X(grad_X);
604  set_Grad_V(grad_V);
605 
606  vector_fp fluxes(m_nsp * m_nDim);
607  getSpeciesFluxesExt(ldf, &fluxes[0]);
608 
609  //sum over species charges, fluxes, Faraday to get current
610  for (size_t i = 0; i < m_nDim; i++) {
611  current[i] = 0.0;
612  for (size_t k = 0; k < m_nsp; k++) {
613  current[i] += m_chargeSpecies[k] * Faraday * fluxes[k] / m_mw[k];
614  }
615  //divide by unit potential gradient
616  }
617 }
618 
620  const doublereal* grad_T,
621  int ldx, const doublereal* grad_X,
622  int ldf, doublereal* Vdiff)
623 {
624  set_Grad_T(grad_T);
625  set_Grad_X(grad_X);
626  getSpeciesVdiffExt(ldf, Vdiff);
627 }
628 
630  const doublereal* grad_T,
631  int ldx,
632  const doublereal* grad_X,
633  int ldf,
634  const doublereal* grad_V,
635  doublereal* Vdiff)
636 {
637  set_Grad_T(grad_T);
638  set_Grad_X(grad_X);
639  set_Grad_V(grad_V);
640  getSpeciesVdiffExt(ldf, Vdiff);
641 }
642 
644  const doublereal* const grad_T,
645  size_t ldx, const doublereal* const grad_X,
646  size_t ldf, doublereal* const fluxes)
647 {
648  set_Grad_T(grad_T);
649  set_Grad_X(grad_X);
650  getSpeciesFluxesExt(ldf, fluxes);
651 }
652 
654  const doublereal* grad_T,
655  size_t ldx,
656  const doublereal* grad_X,
657  size_t ldf,
658  const doublereal* grad_V,
659  doublereal* fluxes)
660 {
661  set_Grad_T(grad_T);
662  set_Grad_X(grad_X);
663  set_Grad_V(grad_V);
664  getSpeciesFluxesExt(ldf, fluxes);
665 }
666 
667 void LiquidTransport::getSpeciesVdiffExt(size_t ldf, doublereal* Vdiff)
668 {
670  for (size_t n = 0; n < m_nDim; n++) {
671  for (size_t k = 0; k < m_nsp; k++) {
672  Vdiff[n*ldf + k] = m_Vdiff(k,n);
673  }
674  }
675 }
676 
677 void LiquidTransport::getSpeciesFluxesExt(size_t ldf, doublereal* fluxes)
678 {
680  for (size_t n = 0; n < m_nDim; n++) {
681  for (size_t k = 0; k < m_nsp; k++) {
682  fluxes[n*ldf + k] = m_flux(k,n);
683  }
684  }
685 }
686 
687 void LiquidTransport::getMixDiffCoeffs(doublereal* const d)
688 {
690  for (size_t n = 0; n < m_nDim; n++) {
691  for (size_t k = 0; k < m_nsp; k++) {
692  if (m_Grad_X[n*m_nsp + k] != 0.0) {
693  d[n*m_nsp + k] = - m_Vdiff(k,n) * m_molefracs[k]
694  / m_Grad_X[n*m_nsp + k];
695  } else {
696  //avoid divide by zero with nonsensical response
697  d[n*m_nsp + k] = - 1.0;
698  }
699  }
700  }
701 }
702 
704 {
705  // First make a decision about whether we need to recalculate
706  doublereal t = m_thermo->temperature();
707  if (t == m_temp) {
708  return false;
709  }
710 
711  // Next do a reality check on temperature value
712  if (t < 0.0) {
713  throw CanteraError("LiquidTransport::update_T()",
714  "negative temperature {}", t);
715  }
716 
717  // Compute various direct functions of temperature
718  m_temp = t;
719 
720  // temperature has changed so temp flags are flipped
721  m_visc_temp_ok = false;
722  m_ionCond_temp_ok = false;
723  m_mobRat_temp_ok = false;
724  m_selfDiff_temp_ok = false;
725  m_radi_temp_ok = false;
726  m_diff_temp_ok = false;
727  m_lambda_temp_ok = false;
728 
729  // temperature has changed, so polynomial temperature
730  // interpolations will need to be reevaluated.
731  m_visc_conc_ok = false;
732  m_ionCond_conc_ok = false;
733  m_mobRat_conc_ok = false;
734  m_selfDiff_conc_ok = false;
735 
736  // Mixture stuff needs to be evaluated
737  m_visc_mix_ok = false;
738  m_ionCond_mix_ok = false;
739  m_mobRat_mix_ok = false;
740  m_selfDiff_mix_ok = false;
741  m_diff_mix_ok = false;
742  m_lambda_mix_ok = false; //(don't need it because a lower lvl flag is set
743  return true;
744 }
745 
747 {
748  // If the pressure has changed then the concentrations have changed.
749  doublereal pres = m_thermo->pressure();
750  bool qReturn = true;
751  if (pres != m_press) {
752  qReturn = false;
753  m_press = pres;
754  }
755  int iStateNew = m_thermo->stateMFNumber();
756  if (iStateNew != m_iStateMF) {
757  qReturn = false;
761  concTot_ = 0.0;
762  concTot_tran_ = 0.0;
763  for (size_t k = 0; k < m_nsp; k++) {
764  m_molefracs[k] = std::max(0.0, m_molefracs[k]);
765  m_molefracs_tran[k] = std::max(Tiny, m_molefracs[k]);
766  m_massfracs_tran[k] = std::max(Tiny, m_massfracs[k]);
769  }
770  dens_ = m_thermo->density();
773  }
774  if (qReturn) {
775  return false;
776  }
777 
778  // signal that concentration-dependent quantities will need to be recomputed
779  // before use, and update the local mole fractions.
780  m_visc_conc_ok = false;
781  m_ionCond_conc_ok = false;
782  m_mobRat_conc_ok = false;
783  m_selfDiff_conc_ok = false;
784 
785  // Mixture stuff needs to be evaluated
786  m_visc_mix_ok = false;
787  m_ionCond_mix_ok = false;
788  m_mobRat_mix_ok = false;
789  m_selfDiff_mix_ok = false;
790  m_diff_mix_ok = false;
791  m_lambda_mix_ok = false;
792 
793  return true;
794 }
795 
797 {
798  for (size_t k = 0; k < m_nsp; k++) {
799  m_lambdaSpecies[k] = m_lambdaTempDep_Ns[k]->getSpeciesTransProp();
800  }
801  m_lambda_temp_ok = true;
802  m_lambda_mix_ok = false;
803 }
804 
806 {
807  m_diffMixModel->getMatrixTransProp(m_bdiff);
808  m_diff_temp_ok = true;
809  m_diff_mix_ok = false;
810 }
811 
813 {
814  m_visc_conc_ok = true;
815 }
816 
818 {
819  for (size_t k = 0; k < m_nsp; k++) {
820  m_viscSpecies[k] = m_viscTempDep_Ns[k]->getSpeciesTransProp();
821  }
822  m_visc_temp_ok = true;
823  m_visc_mix_ok = false;
824 }
825 
827 {
828  m_ionCond_conc_ok = true;
829 }
830 
832 {
833  for (size_t k = 0; k < m_nsp; k++) {
834  m_ionCondSpecies[k] = m_ionCondTempDep_Ns[k]->getSpeciesTransProp();
835  }
836  m_ionCond_temp_ok = true;
837  m_ionCond_mix_ok = false;
838 }
839 
841 {
842  m_mobRat_conc_ok = true;
843 }
844 
846 {
847  for (size_t k = 0; k < m_nsp2; k++) {
848  for (size_t j = 0; j < m_nsp; j++) {
849  m_mobRatSpecies(k,j) = m_mobRatTempDep_Ns[k][j]->getSpeciesTransProp();
850  }
851  }
852  m_mobRat_temp_ok = true;
853  m_mobRat_mix_ok = false;
854 }
855 
857 {
858  m_selfDiff_conc_ok = true;
859 }
860 
862 {
863  for (size_t k = 0; k < m_nsp2; k++) {
864  for (size_t j = 0; j < m_nsp; j++) {
865  m_selfDiffSpecies(k,j) = m_selfDiffTempDep_Ns[k][j]->getSpeciesTransProp();
866  }
867  }
868  m_selfDiff_temp_ok = true;
869  m_selfDiff_mix_ok = false;
870 }
871 
873 {
874  m_radi_conc_ok = true;
875 }
876 
878 {
879  for (size_t k = 0; k < m_nsp; k++) {
880  m_hydrodynamic_radius[k] = m_radiusTempDep_Ns[k]->getSpeciesTransProp();
881  }
882  m_radi_temp_ok = true;
883  m_radi_mix_ok = false;
884 }
885 
887 {
888  for (size_t k = 0; k < m_nDim; k++) {
889  double grad_T = m_Grad_T[k];
890  size_t start = m_nsp*k;
891  m_thermo->getdlnActCoeffds(grad_T, &m_Grad_X[start], &m_Grad_lnAC[start]);
892  for (size_t i = 0; i < m_nsp; i++) {
893  if (m_molefracs[i] < 1.e-15) {
894  m_Grad_lnAC[start+i] = 0;
895  } else {
896  m_Grad_lnAC[start+i] += m_Grad_X[start+i]/m_molefracs[i];
897  }
898  }
899  }
900 }
901 
903 {
904  m_B.resize(m_nsp, m_nDim, 0.0);
905  m_A.resize(m_nsp, m_nsp, 0.0);
906 
907  //! grab a local copy of the molecular weights
908  const vector_fp& M = m_thermo->molecularWeights();
909  //! grad a local copy of the ion molar volume (inverse total ion concentration)
910  const doublereal vol = m_thermo->molarVolume();
911 
912  //! Update the temperature, concentrations and diffusion coefficients in the
913  //! mixture.
914  update_T();
915  update_C();
916  if (!m_diff_temp_ok) {
917  updateDiff_T();
918  }
919 
920  double T = m_thermo->temperature();
923 
924  /*
925  * Calculate the electrochemical potential gradient. This is the
926  * driving force for relative diffusional transport.
927  *
928  * Here we calculate
929  *
930  * X_i * (grad (mu_i) + S_i grad T - M_i / dens * grad P
931  *
932  * This is Eqn. 13-1 p. 318 Newman. The original equation is from
933  * Hershfeld, Curtis, and Bird.
934  *
935  * S_i is the partial molar entropy of species i. This term will cancel
936  * out a lot of the grad T terms in grad (mu_i), therefore simplifying
937  * the expression.
938  *
939  * Ok I think there may be many ways to do this. One way is to do it via basis
940  * functions, at the nodes, as a function of the variables in the problem.
941  *
942  * For calculation of molality based thermo systems, we current get
943  * the molar based values. This may change.
944  *
945  * Note, we have broken the symmetry of the matrix here, due to
946  * considerations involving species concentrations going to zero.
947  */
948  for (size_t a = 0; a < m_nDim; a++) {
949  for (size_t i = 0; i < m_nsp; i++) {
950  m_Grad_mu[a*m_nsp + i] =
951  m_chargeSpecies[i] * Faraday * m_Grad_V[a]
952  + GasConstant * T * m_Grad_lnAC[a*m_nsp+i];
953  }
954  }
955 
957  int iSolvent = 0;
958  double mwSolvent = m_thermo->molecularWeight(iSolvent);
959  double mnaught = mwSolvent/ 1000.;
960  double lnmnaught = log(mnaught);
961  for (size_t a = 0; a < m_nDim; a++) {
962  for (size_t i = 1; i < m_nsp; i++) {
963  m_Grad_mu[a*m_nsp + i] -=
964  m_molefracs[i] * GasConstant * m_Grad_T[a] * lnmnaught;
965  }
966  }
967  }
968 
969  // Just for Note, m_A(i,j) refers to the ith row and jth column.
970  // They are still fortran ordered, so that i varies fastest.
971  double condSum1;
972  const doublereal invRT = 1.0 / (GasConstant * T);
973  switch (m_nDim) {
974  case 1: // 1-D approximation
975  m_B(0,0) = 0.0;
976  // equation for the reference velocity
977  for (size_t j = 0; j < m_nsp; j++) {
978  if (m_velocityBasis == VB_MOLEAVG) {
979  m_A(0,j) = m_molefracs_tran[j];
980  } else if (m_velocityBasis == VB_MASSAVG) {
981  m_A(0,j) = m_massfracs_tran[j];
982  } else if ((m_velocityBasis >= 0)
983  && (m_velocityBasis < static_cast<int>(m_nsp))) {
984  // use species number m_velocityBasis as reference velocity
985  if (m_velocityBasis == static_cast<int>(j)) {
986  m_A(0,j) = 1.0;
987  } else {
988  m_A(0,j) = 0.0;
989  }
990  } else {
991  throw CanteraError("LiquidTransport::stefan_maxwell_solve",
992  "Unknown reference velocity provided.");
993  }
994  }
995  for (size_t i = 1; i < m_nsp; i++) {
996  m_B(i,0) = m_Grad_mu[i] * invRT;
997  m_A(i,i) = 0.0;
998  for (size_t j = 0; j < m_nsp; j++) {
999  if (j != i) {
1000  double tmp = m_molefracs_tran[j] * m_bdiff(i,j);
1001  m_A(i,i) -= tmp;
1002  m_A(i,j) = tmp;
1003  }
1004  }
1005  }
1006 
1007  // invert and solve the system Ax = b. Answer is in m_B
1008  solve(m_A, m_B);
1009  condSum1 = 0;
1010  for (size_t i = 0; i < m_nsp; i++) {
1011  condSum1 -= Faraday*m_chargeSpecies[i]*m_B(i,0)*m_molefracs_tran[i]/vol;
1012  }
1013  break;
1014  case 2: // 2-D approximation
1015  m_B(0,0) = 0.0;
1016  m_B(0,1) = 0.0;
1017  //equation for the reference velocity
1018  for (size_t j = 0; j < m_nsp; j++) {
1019  if (m_velocityBasis == VB_MOLEAVG) {
1020  m_A(0,j) = m_molefracs_tran[j];
1021  } else if (m_velocityBasis == VB_MASSAVG) {
1022  m_A(0,j) = m_massfracs_tran[j];
1023  } else if ((m_velocityBasis >= 0)
1024  && (m_velocityBasis < static_cast<int>(m_nsp))) {
1025  // use species number m_velocityBasis as reference velocity
1026  if (m_velocityBasis == static_cast<int>(j)) {
1027  m_A(0,j) = 1.0;
1028  } else {
1029  m_A(0,j) = 0.0;
1030  }
1031  } else {
1032  throw CanteraError("LiquidTransport::stefan_maxwell_solve",
1033  "Unknown reference velocity provided.");
1034  }
1035  }
1036  for (size_t i = 1; i < m_nsp; i++) {
1037  m_B(i,0) = m_Grad_mu[i] * invRT;
1038  m_B(i,1) = m_Grad_mu[m_nsp + i] * invRT;
1039  m_A(i,i) = 0.0;
1040  for (size_t j = 0; j < m_nsp; j++) {
1041  if (j != i) {
1042  double tmp = m_molefracs_tran[j] * m_bdiff(i,j);
1043  m_A(i,i) -= tmp;
1044  m_A(i,j) = tmp;
1045  }
1046  }
1047  }
1048 
1049  // invert and solve the system Ax = b. Answer is in m_B
1050  solve(m_A, m_B);
1051  break;
1052  case 3: // 3-D approximation
1053  m_B(0,0) = 0.0;
1054  m_B(0,1) = 0.0;
1055  m_B(0,2) = 0.0;
1056  // equation for the reference velocity
1057  for (size_t j = 0; j < m_nsp; j++) {
1058  if (m_velocityBasis == VB_MOLEAVG) {
1059  m_A(0,j) = m_molefracs_tran[j];
1060  } else if (m_velocityBasis == VB_MASSAVG) {
1061  m_A(0,j) = m_massfracs_tran[j];
1062  } else if ((m_velocityBasis >= 0)
1063  && (m_velocityBasis < static_cast<int>(m_nsp))) {
1064  // use species number m_velocityBasis as reference velocity
1065  if (m_velocityBasis == static_cast<int>(j)) {
1066  m_A(0,j) = 1.0;
1067  } else {
1068  m_A(0,j) = 0.0;
1069  }
1070  } else {
1071  throw CanteraError("LiquidTransport::stefan_maxwell_solve",
1072  "Unknown reference velocity provided.");
1073  }
1074  }
1075  for (size_t i = 1; i < m_nsp; i++) {
1076  m_B(i,0) = m_Grad_mu[i] * invRT;
1077  m_B(i,1) = m_Grad_mu[m_nsp + i] * invRT;
1078  m_B(i,2) = m_Grad_mu[2*m_nsp + i] * invRT;
1079  m_A(i,i) = 0.0;
1080  for (size_t j = 0; j < m_nsp; j++) {
1081  if (j != i) {
1082  double tmp = m_molefracs_tran[j] * m_bdiff(i,j);
1083  m_A(i,i) -= tmp;
1084  m_A(i,j) = tmp;
1085  }
1086  }
1087  }
1088 
1089  // invert and solve the system Ax = b. Answer is in m_B
1090  solve(m_A, m_B);
1091  break;
1092  default:
1093  throw CanteraError("routine", "not done");
1094  }
1095 
1096  for (size_t a = 0; a < m_nDim; a++) {
1097  for (size_t j = 0; j < m_nsp; j++) {
1098  m_Vdiff(j,a) = m_B(j,a);
1099  m_flux(j,a) = concTot_ * M[j] * m_molefracs_tran[j] * m_B(j,a);
1100  }
1101  }
1102 }
1103 
1104 }
bool m_debug
Debugging flags. Turn on to get debugging information.
virtual doublereal ionConductivity()
Returns the ionic conductivity of the solution.
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
Definition: Phase.cpp:513
bool m_lambda_mix_ok
Boolean indicating that mixture conductivity is current.
vector_fp m_mw
Local copy of the molecular weights of the species.
vector_fp m_lambdaSpecies
Internal value of the species individual thermal conductivities.
doublereal molarVolume() const
Molar volume (m^3/kmol).
Definition: Phase.cpp:676
size_t m_nsp2
Number of species squared.
virtual doublereal viscosity()
Returns the viscosity of the solution.
bool m_ionCond_mix_ok
Boolean indicating that the top-level mixture ionic conductivity is current.
virtual void getSpeciesVdiffES(size_t ndim, const doublereal *grad_T, int ldx, const doublereal *grad_X, int ldf, const doublereal *grad_Phi, doublereal *Vdiff)
Get the species diffusive velocities wrt to the averaged velocity, given the gradients in mole fracti...
doublereal m_press
Current value of the pressure.
virtual Transport * duplMyselfAsTransport() const
Duplication routine for objects which inherit from Transport.
bool m_radi_conc_ok
Flag to indicate that the hydrodynamic radius is current is current wrt the concentration.
bool m_visc_conc_ok
Flag to indicate that the pure species viscosities are current wrt the concentration.
std::vector< LiquidTranInteraction * > mobilityRatio
Vector of pointer to the LiquidTranInteraction object which handles the calculation of the mobility r...
bool m_diff_temp_ok
Boolean indicating that binary diffusion coeffs are current.
vector_fp m_Grad_V
Internal value of the gradient of the Electric Voltage.
void getMassFractions(doublereal *const y) const
Get the species mass fractions.
Definition: Phase.cpp:584
bool m_cond_mix_ok
Flag to indicate that the mixture conductivity is current.
thermo_t * thermo
Pointer to the ThermoPhase object: shallow pointer.
std::vector< LTPvector > m_selfDiffTempDep_Ns
Self Diffusion for each species in each pure species phase expressed as an appropriate subclass of LT...
doublereal temperature() const
Temperature (K).
Definition: Phase.h:601
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the array, and fill the new entries with &#39;v&#39;.
Definition: Array.h:112
virtual void getSpeciesFluxesExt(size_t ldf, doublereal *fluxes)
Return the species diffusive fluxes relative to the averaged velocity.
virtual void set_Grad_V(const doublereal *const grad_V)
Specify the value of the gradient of the voltage.
LTPspecies * thermalCond
Model type for the thermal conductivity.
void updateIonConductivity_C()
Update the concentration parts of the ionic conductivity.
std::vector< LTPspecies * > m_radiusTempDep_Ns
Hydrodynamic radius for each species expressed as an appropriate subclass of LTPspecies.
size_t m_nDim
Number of dimensions used in flux expressions.
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal *const d)
Returns the binary diffusion coefficients.
virtual void update_Grad_lnAC()
Updates the internal value of the gradient of the logarithm of the activity, which is used in the gra...
doublereal m_ionCondmix
Saved value of the mixture ionic conductivity.
doublereal meanMolecularWeight_
Mean molecular mass.
thermo_t * m_thermo
pointer to the object representing the phase
Class LiquidTransport implements models for transport properties for liquid phases.
vector_fp m_Grad_mu
Gradient of the electrochemical potential.
bool m_mobRat_temp_ok
Boolean indicating that weight factors wrt mobility ratio is current.
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients.
virtual void set_Grad_T(const doublereal *const grad_T)
Specify the value of the gradient of the temperature.
bool m_radi_mix_ok
Boolean indicating that mixture diffusion coeffs are current.
std::vector< LiquidTranInteraction * > m_mobRatMixModel
Mobility ratio for each binary combination of mobile species in the mixture expressed as a subclass o...
Array2D m_Vdiff
Solution of the Stefan Maxwell equation.
Base class for transport property managers.
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:262
STL namespace.
virtual doublereal density() const
Density (kg/m^3).
Definition: Phase.h:607
int solve(DenseMatrix &A, double *b, size_t nrhs, size_t ldb)
Solve Ax = b. Array b is overwritten on exit with x.
vector_fp m_ionCondSpecies
Internal value of the species ionic conductivities.
LiquidTranInteraction * viscosity
Object that specifies the viscosity interaction for the mixture.
Class LiquidTransportData holds transport parameters for a specific liquid-phase species.
virtual void getSpeciesMobilityRatio(doublereal **mobRat)
Returns a double pointer to the mobility ratios of the transported species in each pure species phase...
std::vector< LTPvector > m_mobRatTempDep_Ns
Mobility ratio for the binary combinations of each species in each pure phase expressed as an appropr...
void updateViscosity_T()
Updates the array of pure species viscosities internally.
void updateDiff_T()
Update the binary Stefan-Maxwell diffusion coefficients wrt T using calls to the appropriate LTPspeci...
LiquidTranInteraction * m_lambdaMixModel
Thermal conductivity of the mixture expressed as a subclass of LiquidTranInteraction.
void updateHydrodynamicRadius_C()
Update the concentration dependence of the hydrodynamic radius.
virtual doublereal getMixTransProp(doublereal *speciesValues, doublereal *weightSpecies=0)
Return the mixture transport property value.
vector_fp m_molefracs
Local copy of the mole fractions of the species in the phase.
LTPspecies * speciesDiffusivity
Model type for the speciesDiffusivity.
bool m_ionCond_conc_ok
Flag to indicate that the pure species ionic conductivities are current wrt the concentration.
virtual void getSpeciesVdiff(size_t ndim, const doublereal *grad_T, int ldx, const doublereal *grad_X, int ldf, doublereal *Vdiff)
Get the species diffusive velocities wrt to the averaged velocity, given the gradients in mole fracti...
int m_mode
Mode indicator for transport models – currently unused.
bool m_visc_temp_ok
Boolean indicating that weight factors wrt viscosity is current.
virtual bool update_T()
Returns true if temperature has changed, in which case flags are set to recompute transport propertie...
virtual void getFluidMobilities(doublereal *const mobil_f)
Get the fluid mobilities (s kmol/kg).
void updateSelfDiffusion_C()
Update the concentration parts of the self diffusion.
std::vector< LiquidTransportData > LTData
Species transport parameters.
std::vector< LTPspecies * > m_viscTempDep_Ns
Viscosity for each species expressed as an appropriate subclass of LTPspecies.
virtual void set_Grad_X(const doublereal *const grad_X)
Specify the value of the gradient of the MoleFractions.
virtual void getElectricCurrent(int ndim, const doublereal *grad_T, int ldx, const doublereal *grad_X, int ldf, const doublereal *grad_V, doublereal *current)
Compute the electric current density in A/m^2.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
vector_fp m_Grad_T
Internal value of the gradient of the Temperature vector.
bool m_mobRat_conc_ok
Flag to indicate that the pure species mobility ratios are current wrt the concentration.
Class LiquidTransportParams holds transport model parameters relevant to transport in mixtures...
std::vector< LiquidTranInteraction * > selfDiffusion
Vector of pointer to the LiquidTranInteraction object which handles the calculation of each species&#39; ...
doublereal m_temp
Current Temperature -> locally stored.
void updateMobilityRatio_C()
Update the concentration parts of the mobility ratio.
LiquidTranInteraction * ionConductivity
Object that specifies the ionic Conductivity of the mixture.
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)
Return the species diffusive mass fluxes wrt to the averaged velocity in [kmol/m^2/s].
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the matrix.
Definition: DenseMatrix.cpp:69
DenseMatrix m_B
RHS to the Stefan-Maxwell equation.
void updateCond_T()
Update the temperature-dependent parts of the mixture-averaged thermal conductivity internally...
virtual void getSpeciesViscosities(doublereal *const visc)
Returns the pure species viscosities for all species.
bool m_diff_mix_ok
Boolean indicating that mixture diffusion coeffs are current.
VelocityBasis velocityBasis_
A basis for the average velocity can be specified.
doublereal m_viscmix
Saved value of the mixture viscosity.
virtual void getSpeciesSelfDiffusion(doublereal **selfDiff)
Returns the self diffusion coefficients in the pure species phases.
vector_fp m_spwork
work space. Length is equal to m_nsp
std::string speciesName(size_t k) const
Name of the species with index k.
Definition: Phase.cpp:267
void updateSelfDiffusion_T()
Updates the array of pure species self diffusion coeffs internally.
int m_iStateMF
State of the mole fraction vector.
void stefan_maxwell_solve()
Solve the Stefan-Maxwell equations for the diffusive fluxes.
std::vector< LTPspecies * > m_ionCondTempDep_Ns
Ionic conductivity for each species expressed as an appropriate subclass of LTPspecies.
bool m_lambda_temp_ok
Flag to indicate that the pure species conductivities are current wrt the temperature.
vector_fp m_Grad_X
Internal value of the gradient of the mole fraction vector.
virtual doublereal thermalConductivity()
Return the thermal conductivity of the solution.
bool m_selfDiff_conc_ok
Flag to indicate that the pure species self diffusion are current wrt the concentration.
virtual int activityConvention() const
This method returns the convention used in specification of the activities, of which there are curren...
vector_fp m_Grad_lnAC
Gradient of the logarithm of the activity.
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:65
int stateMFNumber() const
Return the State Mole Fraction Number.
Definition: Phase.h:747
const int cAC_CONVENTION_MOLALITY
Standard state uses the molality convention.
Definition: ThermoPhase.h:28
doublereal dens_
Density.
bool m_selfDiff_temp_ok
Boolean indicating that weight factors wrt self diffusion is current.
std::vector< LiquidTranInteraction * > m_selfDiffMixModel
Self Diffusion for each species in the mixture expressed as a subclass of LiquidTranInteraction.
virtual void getMobilities(doublereal *const mobil_e)
Get the Electrical mobilities (m^2/V/s).
vector_fp m_chargeSpecies
Local copy of the charge of each species.
LiquidTranInteraction * speciesDiffusivity
Pointer to the LiquidTranInteraction object which handles the calculation of the species diffusivity ...
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
Definition: Phase.cpp:542
bool m_radi_temp_ok
Boolean indicating that temperature dependence of hydrodynamic radius is current. ...
virtual void selfDiffusion(doublereal *const selfDiff)
Returns the self diffusion coefficients of the species in the phase.
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
Definition: ThermoPhase.h:453
virtual bool initLiquid(LiquidTransportParams &tr)
Initialize the transport object.
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
Definition: ThermoPhase.h:278
bool m_selfDiff_mix_ok
Boolean indicating that the top-level mixture self diffusion is current.
LiquidTranInteraction * m_diffMixModel
Species diffusivity of the mixture expressed as a subclass of LiquidTranInteraction.
vector_fp m_volume_spec
Specific volume for each species. Local copy from thermo object.
vector_fp m_mobRatMix
Saved values of the mixture mobility ratios.
vector_fp m_massfracs_tran
Local copy of the mass fractions of the species in the phase.
virtual void getSpeciesVdiffExt(size_t ldf, doublereal *Vdiff)
Return the species diffusive velocities relative to the averaged velocity.
std::vector< LTPspecies * > m_lambdaTempDep_Ns
Thermal conductivity for each species expressed as an appropriate subclass of LTPspecies.
const VelocityBasis VB_MOLEAVG
Diffusion velocities are based on the mole averaged velocities.
Definition: TransportBase.h:85
vector_fp m_actCoeff
Vector of activity coefficients.
bool m_visc_mix_ok
Boolean indicating that the top-level mixture viscosity is current.
doublereal concTot_tran_
Local copy of the total concentration.
int mode_
Mode parameter.
Header file defining class LiquidTransport.
void updateMobilityRatio_T()
Updates the array of pure species mobility ratios internally.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:661
vector_fp m_hydrodynamic_radius
Species hydrodynamic radius.
const doublereal Tiny
Small number to compare differences of mole fractions against.
Definition: ct_defs.h:143
std::vector< LTPspecies * > mobilityRatio
Model type for the mobility ratio.
LiquidTranInteraction * m_ionCondMixModel
Ionic Conductivity of the mixture expressed as a subclass of LiquidTranInteraction.
void updateViscosities_C()
Update the concentration parts of the viscosities.
DenseMatrix m_selfDiffSpecies
Internal value of the species self diffusion coefficients.
virtual void getMixDiffCoeffs(doublereal *const d)
Get the Mixture diffusion coefficients.
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
virtual bool update_C()
Returns true if mixture composition has changed, in which case flags are set to recompute transport p...
LiquidTransport(thermo_t *thermo=0, int ndim=1)
Default constructor.
LTPspecies * hydroRadius
Model type for the hydroradius.
vector_fp m_concentrations
Local copy of the concentrations of the species in the phase.
vector_fp m_selfDiffMix
Saved values of the mixture self diffusion coefficients.
Contains declarations for string manipulation functions within Cantera.
vector_fp m_molefracs_tran
Non-zero mole fraction vector used in transport property calculations.
std::vector< LTPspecies * > selfDiffusion
Model type for the self diffusion coefficients.
LTPspecies * viscosity
Model type for the viscosity.
size_t m_nsp
Number of species.
const VelocityBasis VB_MASSAVG
Diffusion velocities are based on the mass averaged velocity.
Definition: TransportBase.h:83
virtual void getSpeciesIonConductivity(doublereal *const ionCond)
Returns the pure species ionic conductivities for all species.
void updateHydrodynamicRadius_T()
Update the temperature-dependent hydrodynamic radius terms for each species internally.
doublereal molecularWeight(size_t k) const
Molecular weight of species k.
Definition: Phase.cpp:496
bool m_ionCond_temp_ok
Boolean indicating that weight factors wrt ionic conductivity is current.
void updateIonConductivity_T()
Update the temperature-dependent ionic conductivity terms for each species internally.
virtual void mobilityRatio(doublereal *mobRat)
Returns the pointer to the mobility ratios of the binary combinations of the transported species for ...
DenseMatrix m_A
Matrix for the Stefan-Maxwell equation.
Namespace for the Cantera kernel.
Definition: application.cpp:29
void getConcentrations(doublereal *const c) const
Get the species concentrations (kmol/m^3).
Definition: Phase.cpp:595
LTPspecies * ionConductivity
Model type for the ionic conductivity.
doublereal m_lambda
Saved value of the mixture thermal conductivity.
virtual doublereal getElectricConduct()
Compute the mixture electrical conductivity from the Stefan-Maxwell equation.
vector_fp m_massfracs
Local copy of the mass fractions of the species in the phase.
vector_fp m_viscSpecies
Internal value of the species viscosities.
virtual void getSpeciesHydrodynamicRadius(doublereal *const radius)
Returns the hydrodynamic radius for all species.
virtual void getdlnActCoeffds(const doublereal dTds, const doublereal *const dXds, doublereal *dlnActCoeffds) const
Get the change in activity coefficients wrt changes in state (temp, mole fraction, etc) along a line in parameter space or along a line in physical space.
Definition: ThermoPhase.h:1586
virtual void getSpeciesFluxesES(size_t ndim, const doublereal *grad_T, size_t ldx, const doublereal *grad_X, size_t ldf, const doublereal *grad_Phi, doublereal *fluxes)
Return the species diffusive mass fluxes wrt to the averaged velocity in [kmol/m^2/s].
LiquidTranInteraction * thermalCond
Pointer to the LiquidTranInteraction object which handles the calculation of the mixture thermal cond...
int m_velocityBasis
Velocity basis from which diffusion velocities are computed.
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
Definition: Phase.h:577
const doublereal Boltzmann
Boltzmann&#39;s constant [J/K].
Definition: ct_defs.h:76
Transport & operator=(const Transport &right)
Array2D m_flux
Solution of the Stefan Maxwell equation in terms of flux.
doublereal concTot_
Local copy of the total concentration.
LiquidTranInteraction * m_viscMixModel
Viscosity of the mixture expressed as a subclass of LiquidTranInteraction.
bool m_mobRat_mix_ok
Boolean indicating that the top-level mixture mobility ratio is current.
std::vector< LTPspecies * > m_diffTempDep_Ns
(NOT USED IN LiquidTransport.) Diffusion coefficient model for each species expressed as an appropria...
DenseMatrix m_bdiff
Array of Binary Diffusivities.
DenseMatrix m_mobRatSpecies
Internal value of the species mobility ratios.