Cantera
2.2.1
|
Factory class for creating new instances of classes derived from Transport. More...
#include <TransportFactory.h>
Public Member Functions | |
virtual void | deleteFactory () |
Deletes the statically allocated factory instance. More... | |
virtual LTPspecies * | newLTP (const XML_Node &trNode, const std::string &name, TransportPropertyType tp_ind, thermo_t *thermo) |
Make one of several transport models, and return a base class pointer to it. More... | |
virtual LiquidTranInteraction * | newLTI (const XML_Node &trNode, TransportPropertyType tp_ind, LiquidTransportParams &trParam) |
Factory function for the construction of new LiquidTranInteraction objects, which are transport models. More... | |
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 description and return a base class pointer to it. More... | |
virtual Transport * | newTransport (thermo_t *thermo, int log_level=0) |
Build a new transport manager using the default transport manager in the phase description and return a base class pointer to it. More... | |
virtual void | initTransport (Transport *tr, thermo_t *thermo, int mode=0, int log_level=0) |
Initialize an existing transport manager. More... | |
virtual void | initLiquidTransport (Transport *tr, thermo_t *thermo, int log_level=0) |
Initialize an existing transport manager for liquid phase. More... | |
Public Member Functions inherited from FactoryBase | |
virtual | ~FactoryBase () |
destructor More... | |
Static Public Member Functions | |
static TransportFactory * | factory () |
Return a pointer to a TransportFactory instance. More... | |
static std::string | modelName (int model) |
Get the name of the transport model corresponding to the specified constant. More... | |
Static Public Member Functions inherited from FactoryBase | |
static void | deleteFactories () |
static function that deletes all factories in the internal registry maintained in a static variable More... | |
Private Member Functions | |
virtual void | initSolidTransport (Transport *tr, thermo_t *thermo, int log_level=0) |
Initialize an existing transport manager for solid phase. More... | |
TransportFactory () | |
The constructor is private; use static method factory() to get a pointer to a factory instance. More... | |
void | getLiquidSpeciesTransportData (const std::vector< const XML_Node * > &db, XML_Node &log, const std::vector< std::string > &names, LiquidTransportParams &tr) |
Read transport property data from a file for a list of species that comprise the phase. More... | |
void | getLiquidInteractionsTransportData (const XML_Node &phaseTran_db, XML_Node &log, const std::vector< std::string > &names, LiquidTransportParams &tr) |
Read transport property data from a file for interactions between species. More... | |
void | getSolidTransportData (const XML_Node &transportNode, XML_Node &log, const std::string phaseName, SolidTransportData &tr) |
Read transport property data from a file for a solid phase. More... | |
void | setupLiquidTransport (thermo_t *thermo, int log_level, LiquidTransportParams &trParam) |
Prepare to build a new transport manager for liquids assuming that viscosity transport data is provided in Arrhenius form. More... | |
void | setupSolidTransport (thermo_t *thermo, int log_level, SolidTransportData &trParam) |
Prepare to build a new transport manager for solids. More... | |
Private Attributes | |
std::map< std::string, int > | m_models |
Mapping between between the string name for a transport model and the integer name. More... | |
std::map< int, std::string > | m_modelNames |
Inverse mapping of transport models, from integer constant to string. More... | |
std::map< std::string, TransportPropertyType > | m_tranPropMap |
Mapping between between the string name for a transport property and the integer name. More... | |
std::map< std::string, LTPTemperatureDependenceType > | m_LTRmodelMap |
Mapping between between the string name for a species-specific transport property model and the integer name. More... | |
std::map< std::string, LiquidTranMixingModel > | m_LTImodelMap |
Mapping between between the string name for a liquid mixture transport property model and the integer name. More... | |
Static Private Attributes | |
static TransportFactory * | s_factory = 0 |
Static instance of the factor -> This is the only instance of this object allowed. More... | |
static mutex_t | transport_mutex |
Static instance of the mutex used to ensure the proper reading of the transport database. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from FactoryBase | |
FactoryBase () | |
Constructor. More... | |
Factory class for creating new instances of classes derived from Transport.
Creates 'transport managers', which are classes derived from class Transport that provide transport properties. TransportFactory handles all initialization required, including evaluation of collision integrals and generating polynomial fits. Transport managers can also be created in other ways.
Definition at line 30 of file TransportFactory.h.
|
private |
The constructor is private; use static method factory() to get a pointer to a factory instance.
The default constructor for this class sets up m_models[], a mapping between the string name for a transport model and the integer name.
Definition at line 49 of file TransportFactory.cpp.
Referenced by TransportFactory::factory().
|
inlinestatic |
Return a pointer to a TransportFactory instance.
TransportFactory is implemented as a 'singleton', which means that at most one instance may be created. The constructor is private. When a TransportFactory instance is required, call static method factory() to return a pointer to the TransportFactory instance.
Definition at line 45 of file TransportFactory.h.
References TransportFactory::s_factory, TransportFactory::transport_mutex, and TransportFactory::TransportFactory().
|
virtual |
Deletes the statically allocated factory instance.
Implements FactoryBase.
Definition at line 99 of file TransportFactory.cpp.
|
static |
Get the name of the transport model corresponding to the specified constant.
model | Integer representing the model name |
Definition at line 106 of file TransportFactory.cpp.
|
virtual |
Make one of several transport models, and return a base class pointer to it.
This method operates at the level of a single transport property as a function of temperature and possibly composition. It's a factory for LTPspecies classes.
trNode | XML node |
name | reference to the name |
tp_ind | TransportPropertyType class |
thermo | Pointer to the ThermoPhase class |
Definition at line 111 of file TransportFactory.cpp.
References Cantera::lowercase().
|
virtual |
Factory function for the construction of new LiquidTranInteraction objects, which are transport models.
This method operates at the level of a single mixture transport property. Individual species transport properties are addressed by the LTPspecies returned by newLTP.
trNode | XML_Node containing the information for the interaction |
tp_ind | TransportPropertyType object |
trParam | reference to the LiquidTransportParams object |
Definition at line 136 of file TransportFactory.cpp.
References LiquidTranInteraction::init(), and TransportParams::thermo.
|
virtual |
Build a new transport manager using a transport manager that may not be the same as in the phase description and return a base class pointer to it.
model | String name for the transport manager |
thermo | ThermoPhase object |
log_level | log level |
ndim | Number of dimensions for fluxes |
Definition at line 197 of file TransportFactory.cpp.
References MultiTransport::init(), Transport::init(), DustyGasTransport::initialize(), Phase::restoreState(), Phase::saveState(), and Transport::setThermo().
Referenced by Cantera::newDefaultTransportMgr(), and Cantera::newTransportMgr().
Build a new transport manager using the default transport manager in the phase description and return a base class pointer to it.
thermo | ThermoPhase object |
log_level | log level |
Definition at line 270 of file TransportFactory.cpp.
References XML_Node::attrib(), XML_Node::child(), XML_Node::hasChild(), and Phase::xml().
Initialize an existing transport manager.
This routine sets up an existing gas-phase transport manager. It calculates the collision integrals and calls the initGas() function to populate the species-dependent data structure.
tr | Pointer to the Transport manager |
thermo | Pointer to the ThermoPhase object |
mode | Chemkin compatible mode or not. This alters the specification of the collision integrals. defaults to no. |
log_level | Defaults to zero, no logging |
Definition at line 280 of file TransportFactory.cpp.
References Transport::init(), and Cantera::warn_deprecated().
Initialize an existing transport manager for liquid phase.
This routine sets up an existing liquid-phase transport manager. It is similar to initTransport except that it uses the LiquidTransportParams class and calls setupLiquidTransport().
tr | Pointer to the Transport manager |
thermo | Pointer to the ThermoPhase object |
log_level | Defaults to zero, no logging |
Definition at line 363 of file TransportFactory.cpp.
References Transport::initLiquid().
Initialize an existing transport manager for solid phase.
This routine sets up an existing solid-phase transport manager. It is similar to initTransport except that it uses the SolidTransportData class and calls setupSolidTransport().
tr | Pointer to the Transport manager |
thermo | Pointer to the ThermoPhase object |
log_level | Defaults to zero, no logging |
Definition at line 373 of file TransportFactory.cpp.
References Transport::initSolid().
|
private |
Read transport property data from a file for a list of species that comprise the phase.
Given a vector of pointers to species XML data bases and a list of species names, this method constructs the LiquidTransport Params object containing the transport data for these species.
It is an error to not find a "transport" XML element within each of the species XML elements listed in the names vector.
db | Reference to a vector of XML_Node pointers containing the species XML nodes. |
log | Reference to an XML log file. (currently unused) |
names | Vector of names of species. On output, tr will contain transport data for each of of these names in the order determined by this vector. |
tr | Reference to the LiquidTransportParams object that will contain the results. |
Definition at line 383 of file TransportFactory.cpp.
References XML_Node::child(), LiquidTransportData::electCond, XML_Node::hasChild(), LiquidTransportData::hydroRadius, LiquidTransportData::ionConductivity, LiquidTransportParams::LTData, LiquidTransportData::mobilityRatio, XML_Node::name(), XML_Node::nChildren(), TransportParams::nsp_, CanteraError::save(), LiquidTransportData::selfDiffusion, LiquidTransportData::speciesDiffusivity, Phase::speciesIndex(), LiquidTransportData::speciesName, LiquidTransportData::thermalCond, TransportParams::thermo, and LiquidTransportData::viscosity.
|
private |
Read transport property data from a file for interactions between species.
Given the XML_Node database for transport interactions defined within the current phase and a list of species names within the phase, this method returns an instance of TransportParams containing the transport data for these species read from the file.
This routine reads interaction parameters between species within the phase.
phaseTran_db | Reference to the transport XML field for the phase |
log | Reference to an XML log file. (currently unused) |
names | Vector of names of species. On output, tr will contain transport data for each of of these names in the order determined by this vector. |
tr | Reference to the LiquidTransportParams object that will contain the results. |
Definition at line 523 of file TransportFactory.cpp.
References XML_Node::attrib(), XML_Node::child(), LiquidTransportParams::compositionDepTypeDefault_, LiquidTransportParams::electCond, XML_Node::hasChild(), LiquidTransportParams::hydroRadius, LiquidTransportParams::ionConductivity, LiquidTransportParams::mobilityRatio, XML_Node::name(), XML_Node::nChildren(), TransportParams::nsp_, LiquidTransportParams::selfDiffusion, LiquidTransportParams::speciesDiffusivity, Phase::speciesIndex(), LiquidTransportParams::thermalCond, TransportParams::thermo, Cantera::VB_MASSAVG, Cantera::VB_MOLEAVG, TransportParams::velocityBasis_, LiquidTransportParams::viscosity, and CanteraError::what().
|
private |
Read transport property data from a file for a solid phase.
Given a phase XML data base, this method constructs the SolidTransportData object containing the transport data for the phase.
transportNode | Reference to XML_Node containing the phase. |
log | Reference to an XML log file. (currently unused) |
phaseName | name of the corresponding phase |
tr | Reference to the SolidTransportData object that will contain the results. |
Definition at line 646 of file TransportFactory.cpp.
References XML_Node::child(), SolidTransportData::defectActivity, SolidTransportData::defectDiffusivity, SolidTransportData::electConductivity, SolidTransportData::ionConductivity, XML_Node::name(), XML_Node::nChildren(), Cantera::showErrors(), SolidTransportData::thermalConductivity, and TransportParams::thermo.
|
private |
Prepare to build a new transport manager for liquids assuming that viscosity transport data is provided in Arrhenius form.
thermo | Pointer to the ThermoPhase object |
log_level | log level |
trParam | LiquidTransportParams structure to be filled up with information |
Definition at line 289 of file TransportFactory.cpp.
References XML_Node::child(), LiquidTransportParams::diff_Dij, XML_Node::hasChild(), TransportParams::log_level, LiquidTransportParams::LTData, ThermoPhase::maxTemp(), ThermoPhase::minTemp(), Phase::molecularWeights(), TransportParams::mw, TransportParams::nsp_, Phase::nSpecies(), LiquidTransportParams::radius_Aij, DenseMatrix::resize(), ThermoPhase::speciesData(), Phase::speciesNames(), LiquidTransportParams::thermalCond_Aij, TransportParams::thermo, TransportParams::tmax, TransportParams::tmin, and Phase::xml().
|
private |
Prepare to build a new transport manager for solids.
thermo | Pointer to the ThermoPhase object |
log_level | log level |
trParam | SolidTransportData structure to be filled up with information |
Definition at line 333 of file TransportFactory.cpp.
References XML_Node::child(), XML_Node::hasChild(), TransportParams::log_level, ThermoPhase::maxTemp(), ThermoPhase::minTemp(), Phase::molecularWeights(), TransportParams::mw, Phase::name(), TransportParams::nsp_, Phase::nSpecies(), TransportParams::thermo, TransportParams::tmax, TransportParams::tmin, and Phase::xml().
|
staticprivate |
Static instance of the factor -> This is the only instance of this object allowed.
Definition at line 154 of file TransportFactory.h.
Referenced by TransportFactory::factory().
|
staticprivate |
Static instance of the mutex used to ensure the proper reading of the transport database.
Definition at line 157 of file TransportFactory.h.
Referenced by TransportFactory::factory().
|
private |
Mapping between between the string name for a transport model and the integer name.
Definition at line 241 of file TransportFactory.h.
|
private |
Inverse mapping of transport models, from integer constant to string.
Definition at line 244 of file TransportFactory.h.
|
private |
Mapping between between the string name for a transport property and the integer name.
Definition at line 248 of file TransportFactory.h.
|
private |
Mapping between between the string name for a species-specific transport property model and the integer name.
Definition at line 252 of file TransportFactory.h.
|
private |
Mapping between between the string name for a liquid mixture transport property model and the integer name.
Definition at line 256 of file TransportFactory.h.