Cantera  2.3.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
16 #include "cantera/base/ctml.h"
18 #include "cantera/base/utilities.h"
19 
20 using namespace std;
21 
22 namespace Cantera
23 {
24 TransportFactory* TransportFactory::s_factory = 0;
25 
26 // declaration of static storage for the mutex
27 std::mutex TransportFactory::transport_mutex;
28 
29 //! Exception thrown if an error is encountered while reading the transport database
31 {
32 public:
33  //! Default constructor
34  /*!
35  * @param linenum inputs the line number
36  * @param msg String message to be sent to the user
37  */
38  TransportDBError(size_t linenum, const std::string& msg) :
39  CanteraError("getTransportData", "error reading transport data: " + msg + "\n") {
40  }
41 };
42 
43 //////////////////// class TransportFactory methods //////////////
44 
45 TransportFactory::TransportFactory()
46 {
47  reg("", []() { return new Transport(); });
48  reg("None", []() { return new Transport(); });
49  reg("Mix", []() { return new MixTransport(); });
50  reg("Multi", []() { return new MultiTransport(); });
51  reg("CK_Mix", []() { return new MixTransport(); });
52  reg("CK_Multi", []() { return new MultiTransport(); });
53  reg("HighP", []() { return new HighPressureGasTransport(); });
54  m_CK_mode["CK_Mix"] = true;
55  m_CK_mode["CK_Multi"] = true;
56 
57  m_models["Mix"] = cMixtureAveraged;
58  m_models["Multi"] = cMulticomponent;
59  m_models["Solid"] = cSolidTransport;
60  m_models["DustyGas"] = cDustyGasTransport;
61  m_models["CK_Multi"] = CK_Multicomponent;
62  m_models["CK_Mix"] = CK_MixtureAveraged;
63  m_models["Liquid"] = cLiquidTransport;
64  m_models["Simple"] = cSimpleTransport;
65  m_models["User"] = cUserTransport;
66  m_models["HighP"] = cHighP;
67  m_models["None"] = None;
68  for (const auto& model : m_models) {
69  m_modelNames[model.second] = model.first;
70  }
71 
72  m_tranPropMap["viscosity"] = TP_VISCOSITY;
73  m_tranPropMap["ionConductivity"] = TP_IONCONDUCTIVITY;
74  m_tranPropMap["mobilityRatio"] = TP_MOBILITYRATIO;
75  m_tranPropMap["selfDiffusion"] = TP_SELFDIFFUSION;
76  m_tranPropMap["thermalConductivity"] = TP_THERMALCOND;
77  m_tranPropMap["speciesDiffusivity"] = TP_DIFFUSIVITY;
78  m_tranPropMap["hydrodynamicRadius"] = TP_HYDRORADIUS;
79  m_tranPropMap["electricalConductivity"] = TP_ELECTCOND;
80  m_tranPropMap["defectDiffusivity"] = TP_DEFECTDIFF;
81  m_tranPropMap["defectActivity"] = TP_DEFECTCONC;
82 
83  m_LTRmodelMap[""] = LTP_TD_CONSTANT;
84  m_LTRmodelMap["constant"] = LTP_TD_CONSTANT;
85  m_LTRmodelMap["arrhenius"] = LTP_TD_ARRHENIUS;
86  m_LTRmodelMap["coeffs"] = LTP_TD_POLY;
87  m_LTRmodelMap["exptemp"] = LTP_TD_EXPT;
88 
89  m_LTImodelMap[""] = LTI_MODEL_NOTSET;
90  m_LTImodelMap["solvent"] = LTI_MODEL_SOLVENT;
91  m_LTImodelMap["moleFractions"] = LTI_MODEL_MOLEFRACS;
92  m_LTImodelMap["massFractions"] = LTI_MODEL_MASSFRACS;
93  m_LTImodelMap["logMoleFractions"] = LTI_MODEL_LOG_MOLEFRACS;
94  m_LTImodelMap["pairwiseInteraction"] = LTI_MODEL_PAIRWISE_INTERACTION;
95  m_LTImodelMap["stefanMaxwell_PPN"] = LTI_MODEL_STEFANMAXWELL_PPN;
96  m_LTImodelMap["moleFractionsExpT"] = LTI_MODEL_MOLEFRACS_EXPT;
97  m_LTImodelMap["none"] = LTI_MODEL_NONE;
98  m_LTImodelMap["multiple"] = LTI_MODEL_MULTIPLE;
99 }
100 
101 void TransportFactory::deleteFactory()
102 {
103  std::unique_lock<std::mutex> transportLock(transport_mutex);
104  delete s_factory;
105  s_factory = 0;
106 }
107 
108 std::string TransportFactory::modelName(int model)
109 {
110  warn_deprecated("TransportFactory::modelName",
111  "To be removed after Cantera 2.3.");
112  return getValue<int,string>(factory()->m_modelNames, model, "");
113 }
114 
115 LTPspecies* TransportFactory::newLTP(const XML_Node& trNode, const std::string& name,
116  TransportPropertyType tp_ind, thermo_t* thermo)
117 {
118  std::string model = ba::to_lower_copy(trNode["model"]);
119  switch (m_LTRmodelMap[model]) {
120  case LTP_TD_CONSTANT:
121  return new LTPspecies_Const(trNode, name, tp_ind, thermo);
122  case LTP_TD_ARRHENIUS:
123  return new LTPspecies_Arrhenius(trNode, name, tp_ind, thermo);
124  case LTP_TD_POLY:
125  return new LTPspecies_Poly(trNode, name, tp_ind, thermo);
126  case LTP_TD_EXPT:
127  return new LTPspecies_ExpT(trNode, name, tp_ind, thermo);
128  default:
129  throw CanteraError("TransportFactory::newLTP","unknown transport model: " + model);
130  }
131 }
132 
133 LiquidTranInteraction* TransportFactory::newLTI(const XML_Node& trNode,
134  TransportPropertyType tp_ind,
135  LiquidTransportParams& trParam)
136 {
137  LiquidTranInteraction* lti = 0;
138  switch (m_LTImodelMap[trNode["model"]]) {
139  case LTI_MODEL_SOLVENT:
140  lti = new LTI_Solvent(tp_ind);
141  lti->init(trNode, trParam.thermo);
142  break;
143  case LTI_MODEL_MOLEFRACS:
144  lti = new LTI_MoleFracs(tp_ind);
145  lti->init(trNode, trParam.thermo);
146  break;
147  case LTI_MODEL_MASSFRACS:
148  lti = new LTI_MassFracs(tp_ind);
149  lti->init(trNode, trParam.thermo);
150  break;
151  case LTI_MODEL_LOG_MOLEFRACS:
152  lti = new LTI_Log_MoleFracs(tp_ind);
153  lti->init(trNode, trParam.thermo);
154  break;
155  case LTI_MODEL_PAIRWISE_INTERACTION:
156  lti = new LTI_Pairwise_Interaction(tp_ind);
157  lti->init(trNode, trParam.thermo);
158  lti->setParameters(trParam);
159  break;
160  case LTI_MODEL_STEFANMAXWELL_PPN:
161  lti = new LTI_StefanMaxwell_PPN(tp_ind);
162  lti->init(trNode, trParam.thermo);
163  lti->setParameters(trParam);
164  break;
165  case LTI_MODEL_STOKES_EINSTEIN:
166  lti = new LTI_StokesEinstein(tp_ind);
167  lti->init(trNode, trParam.thermo);
168  lti->setParameters(trParam);
169  break;
170  case LTI_MODEL_MOLEFRACS_EXPT:
171  lti = new LTI_MoleFracs_ExpT(tp_ind);
172  lti->init(trNode, trParam.thermo);
173  break;
174  case LTI_MODEL_NOTSET:
175  case LTI_MODEL_NONE:
176  case LTI_MODEL_MULTIPLE:
177  lti = new LiquidTranInteraction(tp_ind);
178  lti->init(trNode, trParam.thermo);
179  break;
180  default:
181  // @TODO make sure we can throw an error here with existing datasets and tests before changing code
182  lti = new LiquidTranInteraction(tp_ind);
183  lti->init(trNode, trParam.thermo);
184  }
185  return lti;
186 }
187 
188 Transport* TransportFactory::newTransport(const std::string& transportModel,
189  thermo_t* phase, int log_level, int ndim)
190 {
191  vector_fp state;
192  Transport* tr = 0;
193  phase->saveState(state);
194 
195  if (transportModel == "Solid") {
196  tr = new SolidTransport;
197  initSolidTransport(tr, phase, log_level);
198  tr->setThermo(*phase);
199  } else if (transportModel == "DustyGas") {
200  tr = new DustyGasTransport;
201  Transport* gastr = new MultiTransport;
202  gastr->init(phase, 0, log_level);
204  dtr->initialize(phase, gastr);
205  } else if (transportModel == "Simple") {
206  tr = new SimpleTransport();
207  initLiquidTransport(tr, phase, log_level);
208  tr->setThermo(*phase);
209  } else if (transportModel == "Liquid") {
210  tr = new LiquidTransport(phase, ndim);
211  initLiquidTransport(tr, phase, log_level);
212  tr->setThermo(*phase);
213  } else {
214  tr = create(transportModel);
215  tr->init(phase, m_CK_mode[transportModel], log_level);
216  }
217  phase->restoreState(state);
218  return tr;
219 }
220 
221 Transport* TransportFactory::newTransport(thermo_t* phase, int log_level)
222 {
223  std::string transportModel = "None";
224  XML_Node& phaseNode = phase->xml();
225  if (phaseNode.hasChild("transport")) {
226  transportModel = phaseNode.child("transport").attrib("model");
227  }
228  return newTransport(transportModel, phase,log_level);
229 }
230 
231 void TransportFactory::setupLiquidTransport(thermo_t* thermo, int log_level,
232  LiquidTransportParams& trParam)
233 {
234  const std::vector<const XML_Node*> & species_database = thermo->speciesData();
235  const XML_Node* phase_database = &thermo->xml();
236 
237  // constant mixture attributes
238  trParam.thermo = thermo;
239  trParam.nsp_ = trParam.thermo->nSpecies();
240  size_t nsp = trParam.nsp_;
241  trParam.tmin = thermo->minTemp();
242  trParam.tmax = thermo->maxTemp();
243  trParam.log_level = log_level;
244 
245  // Get the molecular weights and load them into trParam
246  trParam.mw = trParam.thermo->molecularWeights();
247 
248  // Resize all other vectors in trParam
249  trParam.LTData.resize(nsp);
250 
251  // Need to identify a method to obtain interaction matrices.
252  // This will fill LiquidTransportParams members visc_Eij, visc_Sij
253  trParam.thermalCond_Aij.resize(nsp,nsp);
254  trParam.diff_Dij.resize(nsp,nsp);
255  trParam.radius_Aij.resize(nsp,nsp);
256 
257  XML_Node log;
258  // Note that getLiquidSpeciesTransportData just populates the pure species transport data.
259  getLiquidSpeciesTransportData(species_database, log, trParam.thermo->speciesNames(), trParam);
260 
261  // getLiquidInteractionsTransportData() populates the species-species
262  // interaction models parameters like visc_Eij
263  if (phase_database->hasChild("transport")) {
264  XML_Node& transportNode = phase_database->child("transport");
265  getLiquidInteractionsTransportData(transportNode, log, trParam.thermo->speciesNames(), trParam);
266  }
267 }
268 
269 void TransportFactory::setupSolidTransport(thermo_t* thermo, int log_level,
270  SolidTransportData& trParam)
271 {
272  const XML_Node* phase_database = &thermo->xml();
273 
274  // constant mixture attributes
275  trParam.thermo = thermo;
276  trParam.nsp_ = trParam.thermo->nSpecies();
277  trParam.tmin = thermo->minTemp();
278  trParam.tmax = thermo->maxTemp();
279  trParam.log_level = log_level;
280 
281  // Get the molecular weights and load them into trParam
282  trParam.mw = trParam.thermo->molecularWeights();
283 
284  // getSolidTransportData() populates the phase transport models like
285  // electronic conductivity thermal conductivity, interstitial diffusion
286  if (phase_database->hasChild("transport")) {
287  XML_Node log;
288  XML_Node& transportNode = phase_database->child("transport");
289  getSolidTransportData(transportNode, log, thermo->name(), trParam);
290  }
291 }
292 
293 void TransportFactory::initLiquidTransport(Transport* tran,
294  thermo_t* thermo,
295  int log_level)
296 {
297  LiquidTransportParams trParam;
298  setupLiquidTransport(thermo, log_level, trParam);
299  // do model-specific initialization
300  tran->initLiquid(trParam);
301 }
302 
303 void TransportFactory::initSolidTransport(Transport* tran,
304  thermo_t* thermo,
305  int log_level)
306 {
307  SolidTransportData trParam;
308  setupSolidTransport(thermo, log_level, trParam);
309  // do model-specific initialization
310  tran->initSolid(trParam);
311 }
312 
313 void TransportFactory::getLiquidSpeciesTransportData(const std::vector<const XML_Node*> &xspecies,
314  XML_Node& log,
315  const std::vector<std::string> &names,
316  LiquidTransportParams& trParam)
317 {
318  // Create a map of species names versus liquid transport data parameters
319  std::map<std::string, LiquidTransportData> datatable;
320 
321  // Store the number of species in the phase
322  size_t nsp = trParam.nsp_;
323 
324  // Store the number of off-diagonal symmetric interactions between species in the phase
325  size_t nBinInt = nsp*(nsp-1)/2;
326 
327  // read all entries in database into 'datatable' and check for errors. Note
328  // that this procedure validates all entries, not only those for the species
329  // listed in 'names'.
330  for (size_t i = 0; i < nsp; i++) {
331  const XML_Node& sp = *xspecies[i];
332  string name = sp["name"];
333 
334  // Species with no 'transport' child are skipped. However, if that
335  // species is in the list, it will throw an exception below.
336  if (sp.hasChild("transport")) {
337  XML_Node& trNode = sp.child("transport");
338 
339  // Fill datatable with LiquidTransportData objects for error checking
340  // and then insertion into LiquidTransportData objects below.
341  LiquidTransportData data;
342  data.speciesName = name;
343  data.mobilityRatio.resize(nsp*nsp,0);
344  data.selfDiffusion.resize(nsp,0);
345  size_t num = trNode.nChildren();
346  for (size_t iChild = 0; iChild < num; iChild++) {
347  XML_Node& xmlChild = trNode.child(iChild);
348  std::string nodeName = xmlChild.name();
349 
350  switch (m_tranPropMap[nodeName]) {
351  case TP_VISCOSITY:
352  data.viscosity = newLTP(xmlChild, name, m_tranPropMap[nodeName], trParam.thermo);
353  break;
354  case TP_IONCONDUCTIVITY:
355  data.ionConductivity = newLTP(xmlChild, name, m_tranPropMap[nodeName], trParam.thermo);
356  break;
357  case TP_MOBILITYRATIO: {
358  for (size_t iSpec = 0; iSpec< nBinInt; iSpec++) {
359  XML_Node& propSpecNode = xmlChild.child(iSpec);
360  std::string specName = propSpecNode.name();
361  size_t loc = specName.find(":");
362  std::string firstSpec = specName.substr(0,loc);
363  std::string secondSpec = specName.substr(loc+1);
364  size_t index = trParam.thermo->speciesIndex(firstSpec)+nsp*trParam.thermo->speciesIndex(secondSpec);
365  data.mobilityRatio[index] = newLTP(propSpecNode, name, m_tranPropMap[nodeName], trParam.thermo);
366  };
367  };
368  break;
369  case TP_SELFDIFFUSION: {
370  for (size_t iSpec = 0; iSpec< nsp; iSpec++) {
371  XML_Node& propSpecNode = xmlChild.child(iSpec);
372  std::string specName = propSpecNode.name();
373  size_t index = trParam.thermo->speciesIndex(specName);
374  data.selfDiffusion[index] = newLTP(propSpecNode, name, m_tranPropMap[nodeName], trParam.thermo);
375  };
376  };
377  break;
378  case TP_THERMALCOND:
379  data.thermalCond = newLTP(xmlChild,
380  name,
381  m_tranPropMap[nodeName],
382  trParam.thermo);
383  break;
384  case TP_DIFFUSIVITY:
385  data.speciesDiffusivity = newLTP(xmlChild,
386  name,
387  m_tranPropMap[nodeName],
388  trParam.thermo);
389  break;
390  case TP_HYDRORADIUS:
391  data.hydroRadius = newLTP(xmlChild,
392  name,
393  m_tranPropMap[nodeName],
394  trParam.thermo);
395  break;
396  case TP_ELECTCOND:
397  data.electCond = newLTP(xmlChild,
398  name,
399  m_tranPropMap[nodeName],
400  trParam.thermo);
401  break;
402  default:
403  throw CanteraError("getLiquidSpeciesTransportData","unknown transport property: " + nodeName);
404  }
405  }
406  datatable[name] = data;
407  }
408  }
409 
410  trParam.LTData.clear();
411  for (size_t i = 0; i < trParam.nsp_; i++) {
412  // Check to see that we have a LiquidTransportData object for all of the
413  // species in the phase. If not, throw an error.
414  auto it = datatable.find(names[i]);
415  if (it == datatable.end()) {
416  throw TransportDBError(0,"No transport data found for species " + names[i]);
417  }
418 
419  // Now, transfer these objects into LTData in the correct phase index
420  // order by calling the default copy constructor for
421  // LiquidTransportData.
422  trParam.LTData.push_back(it->second);
423  }
424 }
425 
426 /*
427  * Read transport property data from a file for interactions between species in
428  * a liquid. Given the name of a file containing transport property parameters
429  * and a list of species names, this method returns an instance of
430  * TransportParams containing the transport data for these species read from the
431  * file.
432  */
433 void TransportFactory::getLiquidInteractionsTransportData(const XML_Node& transportNode,
434  XML_Node& log,
435  const std::vector<std::string> &names,
436  LiquidTransportParams& trParam)
437 {
438  try {
439  size_t nsp = trParam.nsp_;
440  size_t nBinInt = nsp*(nsp-1)/2;
441  for (size_t iChild = 0; iChild < transportNode.nChildren(); iChild++) {
442  //tranTypeNode is a type of transport property like viscosity
443  XML_Node& tranTypeNode = transportNode.child(iChild);
444  std::string nodeName = tranTypeNode.name();
445  trParam.mobilityRatio.resize(nsp*nsp,0);
446  trParam.selfDiffusion.resize(nsp,0);
447 
448  if (tranTypeNode.name() == "compositionDependence") {
449  std::string modelName = tranTypeNode.attrib("model");
450  auto it = m_LTImodelMap.find(modelName);
451  if (it == m_LTImodelMap.end()) {
452  throw CanteraError("TransportFactory::getLiquidInteractionsTransportData",
453  "Unknown compositionDependence string: " + modelName);
454  } else {
455  trParam.compositionDepTypeDefault_ = it->second;
456  }
457  } else {
458  if (tranTypeNode.hasChild("compositionDependence")) {
459  //compDepNode contains the interaction model
460  XML_Node& compDepNode = tranTypeNode.child("compositionDependence");
461  switch (m_tranPropMap[nodeName]) {
462  break;
463  case TP_VISCOSITY:
464  trParam.viscosity = newLTI(compDepNode, m_tranPropMap[nodeName], trParam);
465  break;
466  case TP_IONCONDUCTIVITY:
467  trParam.ionConductivity = newLTI(compDepNode,
468  m_tranPropMap[nodeName],
469  trParam);
470  break;
471  case TP_MOBILITYRATIO: {
472  for (size_t iSpec = 0; iSpec< nBinInt; iSpec++) {
473  XML_Node& propSpecNode = compDepNode.child(iSpec);
474  string specName = propSpecNode.name();
475  size_t loc = specName.find(":");
476  string firstSpec = specName.substr(0,loc);
477  string secondSpec = specName.substr(loc+1);
478  size_t index = trParam.thermo->speciesIndex(firstSpec)+nsp*trParam.thermo->speciesIndex(secondSpec);
479  trParam.mobilityRatio[index] = newLTI(propSpecNode,
480  m_tranPropMap[nodeName],
481  trParam);
482  };
483  };
484  break;
485  case TP_SELFDIFFUSION: {
486  for (size_t iSpec = 0; iSpec< nsp; iSpec++) {
487  XML_Node& propSpecNode = compDepNode.child(iSpec);
488  string specName = propSpecNode.name();
489  size_t index = trParam.thermo->speciesIndex(specName);
490  trParam.selfDiffusion[index] = newLTI(propSpecNode,
491  m_tranPropMap[nodeName],
492  trParam);
493  };
494  };
495  break;
496  case TP_THERMALCOND:
497  trParam.thermalCond = newLTI(compDepNode,
498  m_tranPropMap[nodeName],
499  trParam);
500  break;
501  case TP_DIFFUSIVITY:
502  trParam.speciesDiffusivity = newLTI(compDepNode,
503  m_tranPropMap[nodeName],
504  trParam);
505  break;
506  case TP_HYDRORADIUS:
507  trParam.hydroRadius = newLTI(compDepNode,
508  m_tranPropMap[nodeName],
509  trParam);
510  break;
511  case TP_ELECTCOND:
512  trParam.electCond = newLTI(compDepNode,
513  m_tranPropMap[nodeName],
514  trParam);
515  break;
516  default:
517  throw CanteraError("getLiquidInteractionsTransportData","unknown transport property: " + nodeName);
518  }
519  }
520  /* Allow a switch between mass-averaged, mole-averaged
521  * and solvent specified reference velocities.
522  * XML code within the transportProperty node
523  * (i.e. within <viscosity>) should read as follows
524  * <velocityBasis basis="mass"> <!-- mass averaged -->
525  * <velocityBasis basis="mole"> <!-- mole averaged -->
526  * <velocityBasis basis="H2O"> <!-- H2O solvent -->
527  */
528  if (tranTypeNode.hasChild("velocityBasis")) {
529  std::string velocityBasis =
530  tranTypeNode.child("velocityBasis").attrib("basis");
531  if (velocityBasis == "mass") {
532  trParam.velocityBasis_ = VB_MASSAVG;
533  } else if (velocityBasis == "mole") {
534  trParam.velocityBasis_ = VB_MOLEAVG;
535  } else if (trParam.thermo->speciesIndex(velocityBasis) > 0) {
536  trParam.velocityBasis_ = static_cast<int>(trParam.thermo->speciesIndex(velocityBasis));
537  } else {
538  int linenum = __LINE__;
539  throw TransportDBError(linenum, "Unknown attribute \"" + velocityBasis + "\" for <velocityBasis> node. ");
540  }
541  }
542  }
543  }
544  } catch (CanteraError& err) {
545  std::cout << err.what() << std::endl;
546  }
547  return;
548 }
549 
550 void TransportFactory::getSolidTransportData(const XML_Node& transportNode,
551  XML_Node& log,
552  const std::string phaseName,
553  SolidTransportData& trParam)
554 {
555  for (size_t iChild = 0; iChild < transportNode.nChildren(); iChild++) {
556  //tranTypeNode is a type of transport property like viscosity
557  XML_Node& tranTypeNode = transportNode.child(iChild);
558  std::string nodeName = tranTypeNode.name();
559 
560  //tranTypeNode contains the interaction model
561  switch (m_tranPropMap[nodeName]) {
562  case TP_IONCONDUCTIVITY:
563  trParam.ionConductivity = newLTP(tranTypeNode, phaseName,
564  m_tranPropMap[nodeName],
565  trParam.thermo);
566  break;
567  case TP_THERMALCOND:
568  trParam.thermalConductivity = newLTP(tranTypeNode, phaseName,
569  m_tranPropMap[nodeName],
570  trParam.thermo);
571  break;
572  case TP_DEFECTDIFF:
573  trParam.defectDiffusivity = newLTP(tranTypeNode, phaseName,
574  m_tranPropMap[nodeName],
575  trParam.thermo);
576  break;
577  case TP_DEFECTCONC:
578  trParam.defectActivity = newLTP(tranTypeNode, phaseName,
579  m_tranPropMap[nodeName],
580  trParam.thermo);
581  break;
582  case TP_ELECTCOND:
583  trParam.electConductivity = newLTP(tranTypeNode, phaseName,
584  m_tranPropMap[nodeName],
585  trParam.thermo);
586  break;
587  default:
588  throw CanteraError("getSolidTransportData","unknown transport property: " + nodeName);
589  }
590  }
591 }
592 
593 
594 Transport* newTransportMgr(const std::string& transportModel, thermo_t* thermo, int loglevel, TransportFactory* f, int ndim)
595 {
596  warn_deprecated("newTransportMgr(string, thermo_t*, int, TransportFactory*, int)",
597  "This overload is deprecated and will be removed after Cantera 2.3."
598  " Use the version that does not take a TransportFactory*.");
599  if (f == 0) {
600  f = TransportFactory::factory();
601  }
602  return f->newTransport(transportModel, thermo, loglevel, ndim);
603 }
604 
605 Transport* newTransportMgr(const std::string& transportModel, thermo_t* thermo, int loglevel, int ndim)
606 {
607  TransportFactory* f = TransportFactory::factory();
608  return f->newTransport(transportModel, thermo, loglevel, ndim);
609 }
610 
612 {
613  if (f == 0) {
614  f = TransportFactory::factory();
615  } else {
616  warn_deprecated("newDefaultTransportMgr(ThermoPhase*, int, TransportFactory*)",
617  "The `TransportFactory*` argument to this function is deprecated"
618  " and will be removed after Cantera 2.3.");
619  }
620  return f->newTransport(thermo, loglevel);
621 }
622 }
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:513
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:309
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:251
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:297
Factory class for creating new instances of classes derived from Transport.
Interface for class MultiTransport.
LTPspecies * defectActivity
Model type for the defectActivity.
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.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:262
STL namespace.
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:164
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:237
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:273
std::vector< LiquidTransportData > LTData
Species transport parameters.
Header file defining class TransportFactory (see TransportFactory)
Class SolidTransport implements transport properties for solids.
ThermoPhase thermo_t
typedef for the ThermoPhase class
Definition: ThermoPhase.h:1741
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 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.
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.
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:183
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:76
XML_Node & xml() const
Returns a const reference to the XML_Node that describes the phase.
Definition: Phase.cpp:117
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:85
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:382
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.
Transport * newTransportMgr(const std::string &transportModel, thermo_t *thermo, int loglevel, TransportFactory *f, int ndim)
Create a new transport manager instance.
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:151
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 ...
const VelocityBasis VB_MASSAVG
Diffusion velocities are based on the mass averaged velocity.
Definition: TransportBase.h:83
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.
Transport * newDefaultTransportMgr(thermo_t *thermo, int loglevel, TransportFactory *f)
Create a new transport manager instance.
Namespace for the Cantera kernel.
Definition: application.cpp:29
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:217
Class LTPspecies_Poly holds transport parameters for a specific liquid-phase species (LTPspecies) whe...
Definition: LTPspecies.h:322
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
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...