Cantera  2.4.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members

Factory class for creating new instances of classes derived from Transport. More...

#include <TransportFactory.h>

Inheritance diagram for TransportFactory:
[legend]
Collaboration diagram for TransportFactory:
[legend]

Public Member Functions

virtual void deleteFactory ()
 Deletes the statically allocated factory instance. More...
 
virtual LTPspeciesnewLTP (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 LiquidTranInteractionnewLTI (const XML_Node &trNode, TransportPropertyType tp_ind, LiquidTransportParams &trParam)
 Factory function for the construction of new LiquidTranInteraction objects, which are transport models. More...
 
virtual TransportnewTransport (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 TransportnewTransport (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 initLiquidTransport (Transport *tr, thermo_t *thermo, int log_level=0)
 Initialize an existing transport manager for liquid phase. More...
 
- Public Member Functions inherited from Factory< Transport >
Transportcreate (std::string name, Args... args)
 Create an object using the object construction function corresponding to "name" and the provided constructor arguments. More...
 
void reg (const std::string &name, std::function< Transport *(Args...)> f)
 Register a new object construction function. More...
 
- Public Member Functions inherited from FactoryBase
virtual ~FactoryBase ()
 destructor More...
 

Static Public Member Functions

static TransportFactoryfactory ()
 Return a pointer to a TransportFactory instance. 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, TransportPropertyTypem_tranPropMap
 Mapping between between the string name for a transport property and the integer name. More...
 
std::map< std::string, LTPTemperatureDependenceTypem_LTRmodelMap
 Mapping between between the string name for a species-specific transport property model and the integer name. More...
 
std::map< std::string, LiquidTranMixingModelm_LTImodelMap
 Mapping between between the string name for a liquid mixture transport property model and the integer name. More...
 
std::map< std::string, bool > m_CK_mode
 Models included in this map are initialized in CK compatibility mode. More...
 

Static Private Attributes

static TransportFactorys_factory = 0
 Static instance of the factor -> This is the only instance of this object allowed. More...
 
static std::mutex 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...
 
- Protected Attributes inherited from Factory< Transport >
std::unordered_map< std::string, std::function< Transport *(Args...)> > m_creators
 
std::unordered_map< std::string, std::string > m_synonyms
 Map of synonyms to canonical names. More...
 
std::unordered_map< std::string, std::string > m_deprecated_names
 Map of deprecated synonyms to canonical names. More...
 

Detailed Description

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 31 of file TransportFactory.h.

Constructor & Destructor Documentation

◆ TransportFactory()

TransportFactory ( )
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 47 of file TransportFactory.cpp.

Referenced by TransportFactory::factory().

Member Function Documentation

◆ factory()

static 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 46 of file TransportFactory.h.

References TransportFactory::s_factory, TransportFactory::transport_mutex, and TransportFactory::TransportFactory().

◆ deleteFactory()

void deleteFactory ( )
virtual

Deletes the statically allocated factory instance.

Implements FactoryBase.

Definition at line 90 of file TransportFactory.cpp.

◆ newLTP()

LTPspecies * newLTP ( const XML_Node trNode,
const std::string &  name,
TransportPropertyType  tp_ind,
thermo_t thermo 
)
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.

Parameters
trNodeXML node
namereference to the name
tp_indTransportPropertyType class
thermoPointer to the ThermoPhase class

Definition at line 97 of file TransportFactory.cpp.

References Cantera::toLowerCopy().

◆ newLTI()

LiquidTranInteraction * newLTI ( const XML_Node trNode,
TransportPropertyType  tp_ind,
LiquidTransportParams trParam 
)
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.

Parameters
trNodeXML_Node containing the information for the interaction
tp_indTransportPropertyType object
trParamreference to the LiquidTransportParams object

Definition at line 125 of file TransportFactory.cpp.

◆ newTransport() [1/2]

Transport * newTransport ( const std::string &  model,
thermo_t thermo,
int  log_level = 0,
int  ndim = 1 
)
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.

Parameters
modelString name for the transport manager
thermoThermoPhase object
log_levellog level
ndimNumber of dimensions for fluxes

Definition at line 180 of file TransportFactory.cpp.

References Transport::init(), DustyGasTransport::initialize(), Phase::restoreState(), Phase::saveState(), and Transport::setThermo().

◆ newTransport() [2/2]

Transport * newTransport ( thermo_t thermo,
int  log_level = 0 
)
virtual

Build a new transport manager using the default transport manager in the phase description and return a base class pointer to it.

Parameters
thermoThermoPhase object
log_levellog level

Definition at line 214 of file TransportFactory.cpp.

References XML_Node::attrib(), XML_Node::child(), XML_Node::hasChild(), and Phase::xml().

◆ initLiquidTransport()

void initLiquidTransport ( Transport tr,
thermo_t thermo,
int  log_level = 0 
)
virtual

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().

Parameters
trPointer to the Transport manager
thermoPointer to the ThermoPhase object
log_levelDefaults to zero, no logging

Definition at line 286 of file TransportFactory.cpp.

References Transport::initLiquid().

◆ initSolidTransport()

void initSolidTransport ( Transport tr,
thermo_t thermo,
int  log_level = 0 
)
privatevirtual

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().

Parameters
trPointer to the Transport manager
thermoPointer to the ThermoPhase object
log_levelDefaults to zero, no logging

Definition at line 296 of file TransportFactory.cpp.

References Transport::initSolid().

◆ getLiquidSpeciesTransportData()

void getLiquidSpeciesTransportData ( const std::vector< const XML_Node *> &  db,
XML_Node log,
const std::vector< std::string > &  names,
LiquidTransportParams tr 
)
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.

Parameters
dbReference to a vector of XML_Node pointers containing the species XML nodes.
logReference to an XML log file. (currently unused)
namesVector of names of species. On output, tr will contain transport data for each of of these names in the order determined by this vector.
trReference to the LiquidTransportParams object that will contain the results.

Definition at line 306 of file TransportFactory.cpp.

References XML_Node::child(), XML_Node::hasChild(), LiquidTransportData::mobilityRatio, XML_Node::name(), XML_Node::nChildren(), TransportParams::nsp_, LiquidTransportData::selfDiffusion, and LiquidTransportData::speciesName.

◆ getLiquidInteractionsTransportData()

void getLiquidInteractionsTransportData ( const XML_Node phaseTran_db,
XML_Node log,
const std::vector< std::string > &  names,
LiquidTransportParams tr 
)
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.

Parameters
phaseTran_dbReference to the transport XML field for the phase
logReference to an XML log file. (currently unused)
namesVector of names of species. On output, tr will contain transport data for each of of these names in the order determined by this vector.
trReference to the LiquidTransportParams object that will contain the results.

Definition at line 426 of file TransportFactory.cpp.

References XML_Node::attrib(), XML_Node::child(), LiquidTransportParams::compositionDepTypeDefault_, XML_Node::hasChild(), LiquidTransportParams::mobilityRatio, XML_Node::name(), XML_Node::nChildren(), TransportParams::nsp_, and LiquidTransportParams::selfDiffusion.

◆ getSolidTransportData()

void getSolidTransportData ( const XML_Node transportNode,
XML_Node log,
const std::string  phaseName,
SolidTransportData tr 
)
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.

Parameters
transportNodeReference to XML_Node containing the phase.
logReference to an XML log file. (currently unused)
phaseNamename of the corresponding phase
trReference to the SolidTransportData object that will contain the results.

Definition at line 543 of file TransportFactory.cpp.

References XML_Node::child(), XML_Node::name(), and XML_Node::nChildren().

◆ setupLiquidTransport()

void setupLiquidTransport ( thermo_t thermo,
int  log_level,
LiquidTransportParams trParam 
)
private

◆ setupSolidTransport()

void setupSolidTransport ( thermo_t thermo,
int  log_level,
SolidTransportData trParam 
)
private

Prepare to build a new transport manager for solids.

Parameters
thermoPointer to the ThermoPhase object
log_levellog level
trParamSolidTransportData structure to be filled up with information

Definition at line 262 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().

Member Data Documentation

◆ s_factory

TransportFactory * s_factory = 0
staticprivate

Static instance of the factor -> This is the only instance of this object allowed.

Definition at line 132 of file TransportFactory.h.

Referenced by TransportFactory::factory().

◆ transport_mutex

std::mutex transport_mutex
staticprivate

Static instance of the mutex used to ensure the proper reading of the transport database.

Definition at line 136 of file TransportFactory.h.

Referenced by TransportFactory::factory().

◆ m_tranPropMap

std::map<std::string, TransportPropertyType> m_tranPropMap
private

Mapping between between the string name for a transport property and the integer name.

Definition at line 224 of file TransportFactory.h.

◆ m_LTRmodelMap

std::map<std::string, LTPTemperatureDependenceType> m_LTRmodelMap
private

Mapping between between the string name for a species-specific transport property model and the integer name.

Definition at line 228 of file TransportFactory.h.

◆ m_LTImodelMap

std::map<std::string, LiquidTranMixingModel> m_LTImodelMap
private

Mapping between between the string name for a liquid mixture transport property model and the integer name.

Definition at line 232 of file TransportFactory.h.

◆ m_CK_mode

std::map<std::string, bool> m_CK_mode
private

Models included in this map are initialized in CK compatibility mode.

Definition at line 235 of file TransportFactory.h.


The documentation for this class was generated from the following files: