Cantera  2.4.0
TransportFactory.cpp
Go to the documentation of this file.
1 //! @file TransportFactory.cpp Implementation file for class TransportFactory.
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at http://www.cantera.org/license.txt for license and copyright information.
5 
6 // known transport models
18 #include "cantera/base/ctml.h"
20 #include "cantera/base/utilities.h"
21 
22 using namespace std;
23 
24 namespace Cantera
25 {
26 TransportFactory* TransportFactory::s_factory = 0;
27 
28 // declaration of static storage for the mutex
29 std::mutex TransportFactory::transport_mutex;
30 
31 //! Exception thrown if an error is encountered while reading the transport database
33 {
34 public:
35  //! Default constructor
36  /*!
37  * @param linenum inputs the line number
38  * @param msg String message to be sent to the user
39  */
40  TransportDBError(size_t linenum, const std::string& msg) :
41  CanteraError("getTransportData", "error reading transport data: " + msg + "\n") {
42  }
43 };
44 
45 //////////////////// class TransportFactory methods //////////////
46 
47 TransportFactory::TransportFactory()
48 {
49  reg("", []() { return new Transport(); });
50  m_synonyms["None"] = "";
51  reg("UnityLewis", []() { return new UnityLewisTransport(); });
52  reg("Mix", []() { return new MixTransport(); });
53  reg("Multi", []() { return new MultiTransport(); });
54  reg("Ion", []() { return new IonGasTransport(); });
55  m_synonyms["CK_Mix"] = "Mix";
56  m_synonyms["CK_Multi"] = "Multi";
57  reg("HighP", []() { return new HighPressureGasTransport(); });
58  m_CK_mode["CK_Mix"] = true;
59  m_CK_mode["CK_Multi"] = true;
60 
61  m_tranPropMap["viscosity"] = TP_VISCOSITY;
62  m_tranPropMap["ionConductivity"] = TP_IONCONDUCTIVITY;
63  m_tranPropMap["mobilityRatio"] = TP_MOBILITYRATIO;
64  m_tranPropMap["selfDiffusion"] = TP_SELFDIFFUSION;
65  m_tranPropMap["thermalConductivity"] = TP_THERMALCOND;
66  m_tranPropMap["speciesDiffusivity"] = TP_DIFFUSIVITY;
67  m_tranPropMap["hydrodynamicRadius"] = TP_HYDRORADIUS;
68  m_tranPropMap["electricalConductivity"] = TP_ELECTCOND;
69  m_tranPropMap["defectDiffusivity"] = TP_DEFECTDIFF;
70  m_tranPropMap["defectActivity"] = TP_DEFECTCONC;
71 
72  m_LTRmodelMap[""] = LTP_TD_CONSTANT;
73  m_LTRmodelMap["constant"] = LTP_TD_CONSTANT;
74  m_LTRmodelMap["arrhenius"] = LTP_TD_ARRHENIUS;
75  m_LTRmodelMap["coeffs"] = LTP_TD_POLY;
76  m_LTRmodelMap["exptemp"] = LTP_TD_EXPT;
77 
78  m_LTImodelMap[""] = LTI_MODEL_NOTSET;
79  m_LTImodelMap["solvent"] = LTI_MODEL_SOLVENT;
80  m_LTImodelMap["moleFractions"] = LTI_MODEL_MOLEFRACS;
81  m_LTImodelMap["massFractions"] = LTI_MODEL_MASSFRACS;
82  m_LTImodelMap["logMoleFractions"] = LTI_MODEL_LOG_MOLEFRACS;
83  m_LTImodelMap["pairwiseInteraction"] = LTI_MODEL_PAIRWISE_INTERACTION;
84  m_LTImodelMap["stefanMaxwell_PPN"] = LTI_MODEL_STEFANMAXWELL_PPN;
85  m_LTImodelMap["moleFractionsExpT"] = LTI_MODEL_MOLEFRACS_EXPT;
86  m_LTImodelMap["none"] = LTI_MODEL_NONE;
87  m_LTImodelMap["multiple"] = LTI_MODEL_MULTIPLE;
88 }
89 
90 void TransportFactory::deleteFactory()
91 {
92  std::unique_lock<std::mutex> transportLock(transport_mutex);
93  delete s_factory;
94  s_factory = 0;
95 }
96 
97 LTPspecies* TransportFactory::newLTP(const XML_Node& trNode, const std::string& name,
98  TransportPropertyType tp_ind, thermo_t* thermo)
99 {
100  std::string model = toLowerCopy(trNode["model"]);
101  LTPspecies* sp;
102  switch (m_LTRmodelMap[model]) {
103  case LTP_TD_CONSTANT:
104  sp = new LTPspecies_Const();
105  break;
106  case LTP_TD_ARRHENIUS:
107  sp = new LTPspecies_Arrhenius();
108  break;
109  case LTP_TD_POLY:
110  sp = new LTPspecies_Poly();
111  break;
112  case LTP_TD_EXPT:
113  sp = new LTPspecies_ExpT();
114  break;
115  default:
116  throw CanteraError("TransportFactory::newLTP","unknown transport model: " + model);
117  }
118  sp->setName(name);
119  sp->setThermo(thermo);
120  sp->setTransportPropertyType(tp_ind);
121  sp->setupFromXML(trNode);
122  return sp;
123 }
124 
125 LiquidTranInteraction* TransportFactory::newLTI(const XML_Node& trNode,
126  TransportPropertyType tp_ind,
127  LiquidTransportParams& trParam)
128 {
129  LiquidTranInteraction* lti = 0;
130  switch (m_LTImodelMap[trNode["model"]]) {
131  case LTI_MODEL_SOLVENT:
132  lti = new LTI_Solvent(tp_ind);
133  lti->init(trNode, trParam.thermo);
134  break;
135  case LTI_MODEL_MOLEFRACS:
136  lti = new LTI_MoleFracs(tp_ind);
137  lti->init(trNode, trParam.thermo);
138  break;
139  case LTI_MODEL_MASSFRACS:
140  lti = new LTI_MassFracs(tp_ind);
141  lti->init(trNode, trParam.thermo);
142  break;
143  case LTI_MODEL_LOG_MOLEFRACS:
144  lti = new LTI_Log_MoleFracs(tp_ind);
145  lti->init(trNode, trParam.thermo);
146  break;
147  case LTI_MODEL_PAIRWISE_INTERACTION:
148  lti = new LTI_Pairwise_Interaction(tp_ind);
149  lti->init(trNode, trParam.thermo);
150  lti->setParameters(trParam);
151  break;
152  case LTI_MODEL_STEFANMAXWELL_PPN:
153  lti = new LTI_StefanMaxwell_PPN(tp_ind);
154  lti->init(trNode, trParam.thermo);
155  lti->setParameters(trParam);
156  break;
157  case LTI_MODEL_STOKES_EINSTEIN:
158  lti = new LTI_StokesEinstein(tp_ind);
159  lti->init(trNode, trParam.thermo);
160  lti->setParameters(trParam);
161  break;
162  case LTI_MODEL_MOLEFRACS_EXPT:
163  lti = new LTI_MoleFracs_ExpT(tp_ind);
164  lti->init(trNode, trParam.thermo);
165  break;
166  case LTI_MODEL_NOTSET:
167  case LTI_MODEL_NONE:
168  case LTI_MODEL_MULTIPLE:
169  lti = new LiquidTranInteraction(tp_ind);
170  lti->init(trNode, trParam.thermo);
171  break;
172  default:
173  // @TODO make sure we can throw an error here with existing datasets and tests before changing code
174  lti = new LiquidTranInteraction(tp_ind);
175  lti->init(trNode, trParam.thermo);
176  }
177  return lti;
178 }
179 
180 Transport* TransportFactory::newTransport(const std::string& transportModel,
181  thermo_t* phase, int log_level, int ndim)
182 {
183  vector_fp state;
184  Transport* tr = 0;
185  phase->saveState(state);
186 
187  if (transportModel == "Solid") {
188  tr = new SolidTransport;
189  initSolidTransport(tr, phase, log_level);
190  tr->setThermo(*phase);
191  } else if (transportModel == "DustyGas") {
192  tr = new DustyGasTransport;
193  Transport* gastr = new MultiTransport;
194  gastr->init(phase, 0, log_level);
196  dtr->initialize(phase, gastr);
197  } else if (transportModel == "Simple") {
198  tr = new SimpleTransport();
199  initLiquidTransport(tr, phase, log_level);
200  tr->setThermo(*phase);
201  } else if (transportModel == "Liquid") {
202  tr = new LiquidTransport(phase, ndim);
203  initLiquidTransport(tr, phase, log_level);
204  tr->setThermo(*phase);
205  } else {
206  tr = create(transportModel);
207  int mode = m_CK_mode[transportModel] ? CK_Mode : 0;
208  tr->init(phase, mode, log_level);
209  }
210  phase->restoreState(state);
211  return tr;
212 }
213 
214 Transport* TransportFactory::newTransport(thermo_t* phase, int log_level)
215 {
216  std::string transportModel = "None";
217  XML_Node& phaseNode = phase->xml();
218  if (phaseNode.hasChild("transport")) {
219  transportModel = phaseNode.child("transport").attrib("model");
220  }
221  return newTransport(transportModel, phase,log_level);
222 }
223 
224 void TransportFactory::setupLiquidTransport(thermo_t* thermo, int log_level,
225  LiquidTransportParams& trParam)
226 {
227  const std::vector<const XML_Node*> & species_database = thermo->speciesData();
228  const XML_Node* phase_database = &thermo->xml();
229 
230  // constant mixture attributes
231  trParam.thermo = thermo;
232  trParam.nsp_ = trParam.thermo->nSpecies();
233  size_t nsp = trParam.nsp_;
234  trParam.tmin = thermo->minTemp();
235  trParam.tmax = thermo->maxTemp();
236  trParam.log_level = log_level;
237 
238  // Get the molecular weights and load them into trParam
239  trParam.mw = trParam.thermo->molecularWeights();
240 
241  // Resize all other vectors in trParam
242  trParam.LTData.resize(nsp);
243 
244  // Need to identify a method to obtain interaction matrices.
245  // This will fill LiquidTransportParams members visc_Eij, visc_Sij
246  trParam.thermalCond_Aij.resize(nsp,nsp);
247  trParam.diff_Dij.resize(nsp,nsp);
248  trParam.radius_Aij.resize(nsp,nsp);
249 
250  XML_Node log;
251  // Note that getLiquidSpeciesTransportData just populates the pure species transport data.
252  getLiquidSpeciesTransportData(species_database, log, trParam.thermo->speciesNames(), trParam);
253 
254  // getLiquidInteractionsTransportData() populates the species-species
255  // interaction models parameters like visc_Eij
256  if (phase_database->hasChild("transport")) {
257  XML_Node& transportNode = phase_database->child("transport");
258  getLiquidInteractionsTransportData(transportNode, log, trParam.thermo->speciesNames(), trParam);
259  }
260 }
261 
262 void TransportFactory::setupSolidTransport(thermo_t* thermo, int log_level,
263  SolidTransportData& trParam)
264 {
265  const XML_Node* phase_database = &thermo->xml();
266 
267  // constant mixture attributes
268  trParam.thermo = thermo;
269  trParam.nsp_ = trParam.thermo->nSpecies();
270  trParam.tmin = thermo->minTemp();
271  trParam.tmax = thermo->maxTemp();
272  trParam.log_level = log_level;
273 
274  // Get the molecular weights and load them into trParam
275  trParam.mw = trParam.thermo->molecularWeights();
276 
277  // getSolidTransportData() populates the phase transport models like
278  // electronic conductivity thermal conductivity, interstitial diffusion
279  if (phase_database->hasChild("transport")) {
280  XML_Node log;
281  XML_Node& transportNode = phase_database->child("transport");
282  getSolidTransportData(transportNode, log, thermo->name(), trParam);
283  }
284 }
285 
286 void TransportFactory::initLiquidTransport(Transport* tran,
287  thermo_t* thermo,
288  int log_level)
289 {
290  LiquidTransportParams trParam;
291  setupLiquidTransport(thermo, log_level, trParam);
292  // do model-specific initialization
293  tran->initLiquid(trParam);
294 }
295 
296 void TransportFactory::initSolidTransport(Transport* tran,
297  thermo_t* thermo,
298  int log_level)
299 {
300  SolidTransportData trParam;
301  setupSolidTransport(thermo, log_level, trParam);
302  // do model-specific initialization
303  tran->initSolid(trParam);
304 }
305 
306 void TransportFactory::getLiquidSpeciesTransportData(const std::vector<const XML_Node*> &xspecies,
307  XML_Node& log,
308  const std::vector<std::string> &names,
309  LiquidTransportParams& trParam)
310 {
311  // Create a map of species names versus liquid transport data parameters
312  std::map<std::string, LiquidTransportData> datatable;
313 
314  // Store the number of species in the phase
315  size_t nsp = trParam.nsp_;
316 
317  // Store the number of off-diagonal symmetric interactions between species in the phase
318  size_t nBinInt = nsp*(nsp-1)/2;
319 
320  // read all entries in database into 'datatable' and check for errors. Note
321  // that this procedure validates all entries, not only those for the species
322  // listed in 'names'.
323  for (size_t i = 0; i < nsp; i++) {
324  const XML_Node& sp = *xspecies[i];
325  string name = sp["name"];
326 
327  // Species with no 'transport' child are skipped. However, if that
328  // species is in the list, it will throw an exception below.
329  if (sp.hasChild("transport")) {
330  XML_Node& trNode = sp.child("transport");
331 
332  // Fill datatable with LiquidTransportData objects for error checking
333  // and then insertion into LiquidTransportData objects below.
334  LiquidTransportData data;
335  data.speciesName = name;
336  data.mobilityRatio.resize(nsp*nsp,0);
337  data.selfDiffusion.resize(nsp,0);
338  size_t num = trNode.nChildren();
339  for (size_t iChild = 0; iChild < num; iChild++) {
340  XML_Node& xmlChild = trNode.child(iChild);
341  std::string nodeName = xmlChild.name();
342 
343  switch (m_tranPropMap[nodeName]) {
344  case TP_VISCOSITY:
345  data.viscosity = newLTP(xmlChild, name, m_tranPropMap[nodeName], trParam.thermo);
346  break;
347  case TP_IONCONDUCTIVITY:
348  data.ionConductivity = newLTP(xmlChild, name, m_tranPropMap[nodeName], trParam.thermo);
349  break;
350  case TP_MOBILITYRATIO: {
351  for (size_t iSpec = 0; iSpec< nBinInt; iSpec++) {
352  XML_Node& propSpecNode = xmlChild.child(iSpec);
353  std::string specName = propSpecNode.name();
354  size_t loc = specName.find(":");
355  std::string firstSpec = specName.substr(0,loc);
356  std::string secondSpec = specName.substr(loc+1);
357  size_t index = trParam.thermo->speciesIndex(firstSpec)+nsp*trParam.thermo->speciesIndex(secondSpec);
358  data.mobilityRatio[index] = newLTP(propSpecNode, name, m_tranPropMap[nodeName], trParam.thermo);
359  };
360  };
361  break;
362  case TP_SELFDIFFUSION: {
363  for (size_t iSpec = 0; iSpec< nsp; iSpec++) {
364  XML_Node& propSpecNode = xmlChild.child(iSpec);
365  std::string specName = propSpecNode.name();
366  size_t index = trParam.thermo->speciesIndex(specName);
367  data.selfDiffusion[index] = newLTP(propSpecNode, name, m_tranPropMap[nodeName], trParam.thermo);
368  };
369  };
370  break;
371  case TP_THERMALCOND:
372  data.thermalCond = newLTP(xmlChild,
373  name,
374  m_tranPropMap[nodeName],
375  trParam.thermo);
376  break;
377  case TP_DIFFUSIVITY:
378  data.speciesDiffusivity = newLTP(xmlChild,
379  name,
380  m_tranPropMap[nodeName],
381  trParam.thermo);
382  break;
383  case TP_HYDRORADIUS:
384  data.hydroRadius = newLTP(xmlChild,
385  name,
386  m_tranPropMap[nodeName],
387  trParam.thermo);
388  break;
389  case TP_ELECTCOND:
390  data.electCond = newLTP(xmlChild,
391  name,
392  m_tranPropMap[nodeName],
393  trParam.thermo);
394  break;
395  default:
396  throw CanteraError("getLiquidSpeciesTransportData","unknown transport property: " + nodeName);
397  }
398  }
399  datatable[name] = data;
400  }
401  }
402 
403  trParam.LTData.clear();
404  for (size_t i = 0; i < trParam.nsp_; i++) {
405  // Check to see that we have a LiquidTransportData object for all of the
406  // species in the phase. If not, throw an error.
407  auto it = datatable.find(names[i]);
408  if (it == datatable.end()) {
409  throw TransportDBError(0,"No transport data found for species " + names[i]);
410  }
411 
412  // Now, transfer these objects into LTData in the correct phase index
413  // order by calling the default copy constructor for
414  // LiquidTransportData.
415  trParam.LTData.push_back(it->second);
416  }
417 }
418 
419 /*
420  * Read transport property data from a file for interactions between species in
421  * a liquid. Given the name of a file containing transport property parameters
422  * and a list of species names, this method returns an instance of
423  * TransportParams containing the transport data for these species read from the
424  * file.
425  */
426 void TransportFactory::getLiquidInteractionsTransportData(const XML_Node& transportNode,
427  XML_Node& log,
428  const std::vector<std::string> &names,
429  LiquidTransportParams& trParam)
430 {
431  try {
432  size_t nsp = trParam.nsp_;
433  size_t nBinInt = nsp*(nsp-1)/2;
434  for (size_t iChild = 0; iChild < transportNode.nChildren(); iChild++) {
435  //tranTypeNode is a type of transport property like viscosity
436  XML_Node& tranTypeNode = transportNode.child(iChild);
437  std::string nodeName = tranTypeNode.name();
438  trParam.mobilityRatio.resize(nsp*nsp,0);
439  trParam.selfDiffusion.resize(nsp,0);
440 
441  if (tranTypeNode.name() == "compositionDependence") {
442  std::string modelName = tranTypeNode.attrib("model");
443  auto it = m_LTImodelMap.find(modelName);
444  if (it == m_LTImodelMap.end()) {
445  throw CanteraError("TransportFactory::getLiquidInteractionsTransportData",
446  "Unknown compositionDependence string: " + modelName);
447  } else {
448  trParam.compositionDepTypeDefault_ = it->second;
449  }
450  } else {
451  if (tranTypeNode.hasChild("compositionDependence")) {
452  //compDepNode contains the interaction model
453  XML_Node& compDepNode = tranTypeNode.child("compositionDependence");
454  switch (m_tranPropMap[nodeName]) {
455  break;
456  case TP_VISCOSITY:
457  trParam.viscosity = newLTI(compDepNode, m_tranPropMap[nodeName], trParam);
458  break;
459  case TP_IONCONDUCTIVITY:
460  trParam.ionConductivity = newLTI(compDepNode,
461  m_tranPropMap[nodeName],
462  trParam);
463  break;
464  case TP_MOBILITYRATIO: {
465  for (size_t iSpec = 0; iSpec< nBinInt; iSpec++) {
466  XML_Node& propSpecNode = compDepNode.child(iSpec);
467  string specName = propSpecNode.name();
468  size_t loc = specName.find(":");
469  string firstSpec = specName.substr(0,loc);
470  string secondSpec = specName.substr(loc+1);
471  size_t index = trParam.thermo->speciesIndex(firstSpec)+nsp*trParam.thermo->speciesIndex(secondSpec);
472  trParam.mobilityRatio[index] = newLTI(propSpecNode,
473  m_tranPropMap[nodeName],
474  trParam);
475  };
476  };
477  break;
478  case TP_SELFDIFFUSION: {
479  for (size_t iSpec = 0; iSpec< nsp; iSpec++) {
480  XML_Node& propSpecNode = compDepNode.child(iSpec);
481  string specName = propSpecNode.name();
482  size_t index = trParam.thermo->speciesIndex(specName);
483  trParam.selfDiffusion[index] = newLTI(propSpecNode,
484  m_tranPropMap[nodeName],
485  trParam);
486  };
487  };
488  break;
489  case TP_THERMALCOND:
490  trParam.thermalCond = newLTI(compDepNode,
491  m_tranPropMap[nodeName],
492  trParam);
493  break;
494  case TP_DIFFUSIVITY:
495  trParam.speciesDiffusivity = newLTI(compDepNode,
496  m_tranPropMap[nodeName],
497  trParam);
498  break;
499  case TP_HYDRORADIUS:
500  trParam.hydroRadius = newLTI(compDepNode,
501  m_tranPropMap[nodeName],
502  trParam);
503  break;
504  case TP_ELECTCOND:
505  trParam.electCond = newLTI(compDepNode,
506  m_tranPropMap[nodeName],
507  trParam);
508  break;
509  default:
510  throw CanteraError("getLiquidInteractionsTransportData","unknown transport property: " + nodeName);
511  }
512  }
513  /* Allow a switch between mass-averaged, mole-averaged
514  * and solvent specified reference velocities.
515  * XML code within the transportProperty node
516  * (i.e. within <viscosity>) should read as follows
517  * <velocityBasis basis="mass"> <!-- mass averaged -->
518  * <velocityBasis basis="mole"> <!-- mole averaged -->
519  * <velocityBasis basis="H2O"> <!-- H2O solvent -->
520  */
521  if (tranTypeNode.hasChild("velocityBasis")) {
522  std::string velocityBasis =
523  tranTypeNode.child("velocityBasis").attrib("basis");
524  if (velocityBasis == "mass") {
525  trParam.velocityBasis_ = VB_MASSAVG;
526  } else if (velocityBasis == "mole") {
527  trParam.velocityBasis_ = VB_MOLEAVG;
528  } else if (trParam.thermo->speciesIndex(velocityBasis) > 0) {
529  trParam.velocityBasis_ = static_cast<int>(trParam.thermo->speciesIndex(velocityBasis));
530  } else {
531  int linenum = __LINE__;
532  throw TransportDBError(linenum, "Unknown attribute \"" + velocityBasis + "\" for <velocityBasis> node. ");
533  }
534  }
535  }
536  }
537  } catch (CanteraError& err) {
538  std::cout << err.what() << std::endl;
539  }
540  return;
541 }
542 
543 void TransportFactory::getSolidTransportData(const XML_Node& transportNode,
544  XML_Node& log,
545  const std::string phaseName,
546  SolidTransportData& trParam)
547 {
548  for (size_t iChild = 0; iChild < transportNode.nChildren(); iChild++) {
549  //tranTypeNode is a type of transport property like viscosity
550  XML_Node& tranTypeNode = transportNode.child(iChild);
551  std::string nodeName = tranTypeNode.name();
552 
553  //tranTypeNode contains the interaction model
554  switch (m_tranPropMap[nodeName]) {
555  case TP_IONCONDUCTIVITY:
556  trParam.ionConductivity = newLTP(tranTypeNode, phaseName,
557  m_tranPropMap[nodeName],
558  trParam.thermo);
559  break;
560  case TP_THERMALCOND:
561  trParam.thermalConductivity = newLTP(tranTypeNode, phaseName,
562  m_tranPropMap[nodeName],
563  trParam.thermo);
564  break;
565  case TP_DEFECTDIFF:
566  trParam.defectDiffusivity = newLTP(tranTypeNode, phaseName,
567  m_tranPropMap[nodeName],
568  trParam.thermo);
569  break;
570  case TP_DEFECTCONC:
571  trParam.defectActivity = newLTP(tranTypeNode, phaseName,
572  m_tranPropMap[nodeName],
573  trParam.thermo);
574  break;
575  case TP_ELECTCOND:
576  trParam.electConductivity = newLTP(tranTypeNode, phaseName,
577  m_tranPropMap[nodeName],
578  trParam.thermo);
579  break;
580  default:
581  throw CanteraError("getSolidTransportData","unknown transport property: " + nodeName);
582  }
583  }
584 }
585 
586 Transport* newTransportMgr(const std::string& transportModel, thermo_t* thermo, int loglevel, int ndim)
587 {
588  TransportFactory* f = TransportFactory::factory();
589  return f->newTransport(transportModel, thermo, loglevel, ndim);
590 }
591 
593 {
594  return TransportFactory::factory()->newTransport(thermo, loglevel);
595 }
596 
597 }
LTPspecies * defectDiffusivity
Model type for the defectDiffusivity – or more like a defect diffusivity in the context of the solid...
doublereal tmin
Minimum temperatures for parameter fits.
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
Definition: Phase.cpp:437
Headers for the DustyGasTransport object, which models transport properties in porous media using the...
TransportPropertyType
Enumeration of the types of transport properties that can be handled by the variables in the various ...
Definition: LTPspecies.h:34
void restoreState(const vector_fp &state)
Restore a state saved on a previous call to saveState.
Definition: Phase.cpp:233
DenseMatrix radius_Aij
Interaction associated with hydrodynamic radius.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
std::string name() const
Returns the name of the XML node.
Definition: xml.h:370
std::vector< LiquidTranInteraction * > mobilityRatio
Vector of pointer to the LiquidTranInteraction object which handles the calculation of the mobility r...
thermo_t * thermo
Pointer to the ThermoPhase object: shallow pointer.
const std::vector< const XML_Node * > & speciesData() const
Return a pointer to the vector of XML nodes containing the species data for this phase.
virtual Transport * newTransport(const std::string &model, thermo_t *thermo, int log_level=0, int ndim=1)
Build a new transport manager using a transport manager that may not be the same as in the phase desc...
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
size_t speciesIndex(const std::string &name) const
Returns the index of a species named &#39;name&#39; within the Phase object.
Definition: Phase.cpp:175
LTPspecies * thermalCond
Model type for the thermal conductivity.
Simple mass fraction weighting of transport properties.
void saveState(vector_fp &state) const
Save the current internal state of the phase.
Definition: Phase.cpp:221
virtual void setupFromXML(const XML_Node &propNode)
Set up the species transport property from the XML node, <propNode> that is a child of the <transport...
Definition: LTPspecies.h:111
Factory class for creating new instances of classes derived from Transport.
Interface for class MultiTransport.
LTPspecies * defectActivity
Model type for the defectActivity.
void setName(const std::string &name)
Set the species name.
Definition: LTPspecies.h:98
size_t nsp_
Local storage of the number of species.
doublereal tmax
Maximum temperatures for parameter fits.
const char * what() const
Get a description of the error.
Class LiquidTransport implements models for transport properties for liquid phases.
Class DustyGasTransport implements the Dusty Gas model for transport in porous media.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
Header file defining class SolidTransportData.
Transport properties that act like pairwise interactions as in binary diffusion coefficients.
Base class for transport property managers.
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:266
STL namespace.
void setThermo(thermo_t *thermo)
Set the ThermoPhase object, which is used to find the temperature.
Definition: LTPspecies.h:93
LiquidTranInteraction * viscosity
Object that specifies the viscosity interaction for the mixture.
Class LiquidTransportData holds transport parameters for a specific liquid-phase species.
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid...
Definition: ThermoPhase.h:131
virtual bool initSolid(SolidTransportData &tr)
Called by TransportFactory to set parameters.
Class LTPspecies_Arrhenius holds transport parameters for a specific liquid- phase species (LTPspecie...
Definition: LTPspecies.h:232
TransportDBError(size_t linenum, const std::string &msg)
Default constructor.
virtual void init(thermo_t *thermo, int mode=0, int log_level=0)
Initialize a transport manager.
LTPspecies * electConductivity
Model type for the electrical conductivity.
LTPspecies * speciesDiffusivity
Model type for the speciesDiffusivity.
Header file for defining the class SolidTransport, which handles transport of ions within solid phase...
const std::vector< std::string > & speciesNames() const
Return a const reference to the vector of species names.
Definition: Phase.cpp:197
std::vector< LiquidTransportData > LTData
Species transport parameters.
Header file defining class TransportFactory (see TransportFactory)
Class SolidTransport implements transport properties for solids.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
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; ...
Class IonGasTransport implements Stockmayer-(n,6,4) model for transport of ions.
Class MultiTransport implements transport properties for high pressure gas mixtures.
LiquidTranInteraction * ionConductivity
Object that specifies the ionic Conductivity of the mixture.
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the matrix.
Definition: DenseMatrix.cpp:69
VelocityBasis velocityBasis_
A basis for the average velocity can be specified.
void setTransportPropertyType(TransportPropertyType tp_ind)
TransportPropertyType containing the property id that this object is creating a parameterization for ...
Definition: LTPspecies.h:104
Mixing rule using logarithms of the mole fractions.
Header file for the class SimpleTransport which provides simple transport properties for liquids and ...
void initialize(ThermoPhase *phase, Transport *gastr)
Initialization routine called by TransportFactory.
DenseMatrix thermalCond_Aij
Interaction associated with linear weighting of thermal conductivity.
Class UnityLewisTransport implements the unity Lewis number approximation for the mixture-averaged sp...
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:65
LiquidTranMixingModel compositionDepTypeDefault_
Default composition dependence of the transport properties.
Class LTPspecies_Const holds transport parameters for a specific liquid- phase species (LTPspecies) w...
Definition: LTPspecies.h:190
Interface for class HighPressureGasTransport.
LiquidTranInteraction * speciesDiffusivity
Pointer to the LiquidTranInteraction object which handles the calculation of the species diffusivity ...
Class LTPspecies holds transport parameterizations for a specific liquid- phase species.
Definition: LTPspecies.h:78
XML_Node & xml() const
Returns a const reference to the XML_Node that describes the phase.
Definition: Phase.cpp:44
vector_fp mw
Local storage of the molecular weights of the species.
Simple mole fraction weighting of transport properties.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
Definition: xml.cpp:536
XML_Node & child(const size_t n) const
Return a changeable reference to the n&#39;th child of the current node.
Definition: xml.cpp:546
Class MultiTransport implements multicomponent transport properties for ideal gas mixtures...
const VelocityBasis VB_MOLEAVG
Diffusion velocities are based on the mole averaged velocities.
Definition: TransportBase.h:69
LTPspecies * electCond
Model type for the electrical conductivity.
Class LTPspecies_ExpT holds transport parameters for a specific liquid- phase species (LTPspecies) wh...
Definition: LTPspecies.h:350
Header file defining class LiquidTransport.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
Definition: xml.cpp:500
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
virtual bool initLiquid(LiquidTransportParams &tr)
Called by TransportFactory to set parameters.
std::string speciesName
A LiquidTransportData object is instantiated for each species.
std::vector< LTPspecies * > mobilityRatio
Model type for the mobility ratio.
LTPspecies * ionConductivity
Model type for the ionic conductivity.
Exception thrown if an error is encountered while reading the transport database. ...
std::string name() const
Return the name of the phase.
Definition: Phase.cpp:78
LTPspecies * hydroRadius
Model type for the hydroradius.
Stefan Maxwell Diffusion Coefficients can be solved for given ion conductivity, mobility ratios...
DenseMatrix diff_Dij
Interaction associated with linear weighting of thermal conductivity.
Contains declarations for string manipulation functions within Cantera.
std::vector< LTPspecies * > selfDiffusion
Model type for the self diffusion coefficients.
LTPspecies * viscosity
Model type for the viscosity.
Simple mole fraction weighting of transport properties.
LiquidTranInteraction * hydroRadius
Pointer to the LiquidTranInteraction object which handles the calculation of the hydrodynamic radius ...
Headers for the UnityLewisTransport object, which models transport properties in ideal gas solutions ...
const VelocityBasis VB_MASSAVG
Diffusion velocities are based on the mass averaged velocity.
Definition: TransportBase.h:67
virtual void setThermo(thermo_t &thermo)
Specifies the ThermoPhase object.
virtual void init(const XML_Node &compModelNode=XML_Node(), thermo_t *thermo=0)
initialize LiquidTranInteraction objects with thermo and XML node
LTPspecies * thermalConductivity
Model type for the thermal conductivity.
std::string toLowerCopy(const std::string &input)
Convert to lower case.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
Class MixTransport implements mixture-averaged transport properties for ideal gas mixtures...
Definition: MixTransport.h:56
LTPspecies * ionConductivity
Model type for the ionic conductivity.
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
Definition: ThermoPhase.h:184
Class LTPspecies_Poly holds transport parameters for a specific liquid-phase species (LTPspecies) whe...
Definition: LTPspecies.h:303
Class SolidTransportData holds transport parameters for a specific solid- phase species.
Headers for the MixTransport object, which models transport properties in ideal gas solutions using a...
Base class to handle transport property evaluation in a mixture.
LiquidTranInteraction * thermalCond
Pointer to the LiquidTranInteraction object which handles the calculation of the mixture thermal cond...
size_t nChildren(bool discardComments=false) const
Return the number of children.
Definition: xml.cpp:556
Transport * newDefaultTransportMgr(thermo_t *thermo, int loglevel)
Create a new transport manager instance.
Class SimpleTransport implements mixture-averaged transport properties for liquid phases...
LiquidTranInteraction * electCond
Pointer to the LiquidTranInteraction object which handles the calculation of the electrical conductiv...