Cantera
3.1.0a1
|
A container class for chemically-reacting solutions. More...
#include <Solution.h>
A container class for chemically-reacting solutions.
The Solution class collects all objects needed to describe a chemically-reacting solution. Instances can be created to represent any type of solution – a mixture of gases, a liquid solution, or a solid solution, for example.
Solution objects only define a small number of methods of their own, and are provided so that a single object can be used to access thermodynamic, kinetic, and transport properties of a solution:
The most common way to instantiate Solution objects is by using a phase definition, species and reactions defined in an input file:
Definition at line 43 of file Solution.h.
Public Member Functions | |
Solution (const Solution &)=delete | |
Solution & | operator= (const Solution &)=delete |
string | name () const |
Return the name of this Solution object. More... | |
void | setName (const string &name) |
Set the name of this Solution object. More... | |
virtual void | setThermo (shared_ptr< ThermoPhase > thermo) |
Set the ThermoPhase object. More... | |
virtual void | setKinetics (shared_ptr< Kinetics > kinetics) |
Set the Kinetics object. More... | |
virtual void | setTransport (shared_ptr< Transport > transport) |
Set the Transport object directly. More... | |
void | setTransportModel (const string &model="") |
Set the Transport object by name. More... | |
shared_ptr< ThermoPhase > | thermo () |
Accessor for the ThermoPhase pointer. More... | |
shared_ptr< Kinetics > | kinetics () |
Accessor for the Kinetics pointer. More... | |
shared_ptr< Transport > | transport () |
Accessor for the Transport pointer. More... | |
void | addAdjacent (shared_ptr< Solution > adjacent) |
Add a phase adjacent to this phase. More... | |
shared_ptr< Solution > | adjacent (size_t i) |
Get the Solution object for an adjacent phase by index. More... | |
shared_ptr< Solution > | adjacent (const string &name) |
Get the Solution object for an adjacent phase by name. More... | |
size_t | nAdjacent () const |
Get the number of adjacent phases. More... | |
AnyMap | parameters (bool withInput=false) const |
const AnyMap & | header () const |
Access input data associated with header definition. More... | |
AnyMap & | header () |
const string | source () const |
Retrieve source used for object creation; usually an input file name. More... | |
void | setSource (const string &source) |
Overwrite source (only required if object is not created using newSolution) More... | |
void | holdExternalHandle (const string &name, shared_ptr< ExternalHandle > handle) |
Store a handle to a wrapper for this Solution object from an external language interface (for example, a Python Solution object) More... | |
shared_ptr< ExternalHandle > | getExternalHandle (const string &name) const |
Get the handle for a wrapper for this Solution object from an external language interface. More... | |
void | registerChangedCallback (void *id, const function< void()> &callback) |
Register a function to be called if any of the Solution's thermo, kinetics, or transport objects is replaced. More... | |
void | removeChangedCallback (void *id) |
Remove the callback function associated with the specified object. More... | |
Static Public Member Functions | |
static shared_ptr< Solution > | create () |
Create an empty Solution object. More... | |
Protected Attributes | |
shared_ptr< ThermoPhase > | m_thermo |
ThermoPhase manager. More... | |
shared_ptr< Kinetics > | m_kinetics |
Kinetics manager. More... | |
shared_ptr< Transport > | m_transport |
Transport manager. More... | |
vector< shared_ptr< Solution > > | m_adjacent |
Adjacent phases, for access by index. More... | |
map< string, shared_ptr< Solution > > | m_adjacentByName |
Adjacent phases, for access by name. More... | |
AnyMap | m_header |
Additional input fields; usually from a YAML input file. More... | |
map< string, shared_ptr< ExternalHandle > > | m_externalHandles |
Wrappers for this Solution object in extension languages, for evaluation of user-defined reaction rates. More... | |
map< void *, function< void()> > | m_changeCallbacks |
Callback functions that are invoked when the therm, kinetics, or transport members of the Solution are replaced. More... | |
|
inlinestatic |
Create an empty Solution object.
Definition at line 54 of file Solution.h.
string name | ( | ) | const |
Return the name of this Solution object.
Definition at line 25 of file Solution.cpp.
void setName | ( | const string & | name | ) |
Set the name of this Solution object.
Definition at line 34 of file Solution.cpp.
|
virtual |
|
virtual |
|
virtual |
Set the Transport object directly.
Definition at line 63 of file Solution.cpp.
void setTransportModel | ( | const string & | model = "" | ) |
Set the Transport object by name.
model | name of transport model; if omitted, the default model is used |
Definition at line 73 of file Solution.cpp.
|
inline |
Accessor for the ThermoPhase pointer.
Definition at line 79 of file Solution.h.
|
inline |
Accessor for the Kinetics pointer.
Definition at line 84 of file Solution.h.
|
inline |
Accessor for the Transport pointer.
Definition at line 89 of file Solution.h.
void addAdjacent | ( | shared_ptr< Solution > | adjacent | ) |
Add a phase adjacent to this phase.
Usually this means a higher-dimensional phase that participates in reactions in this phase.
Definition at line 85 of file Solution.cpp.
|
inline |
Get the Solution object for an adjacent phase by index.
Definition at line 98 of file Solution.h.
|
inline |
Get the Solution object for an adjacent phase by name.
Definition at line 103 of file Solution.h.
|
inline |
Get the number of adjacent phases.
Definition at line 108 of file Solution.h.
const AnyMap & header | ( | ) | const |
Access input data associated with header definition.
Definition at line 137 of file Solution.cpp.
const string source | ( | ) | const |
Retrieve source used for object creation; usually an input file name.
Definition at line 147 of file Solution.cpp.
void setSource | ( | const string & | source | ) |
Overwrite source (only required if object is not created using newSolution)
Definition at line 152 of file Solution.cpp.
void holdExternalHandle | ( | const string & | name, |
shared_ptr< ExternalHandle > | handle | ||
) |
Store a handle to a wrapper for this Solution object from an external language interface (for example, a Python Solution object)
Definition at line 157 of file Solution.cpp.
shared_ptr< ExternalHandle > getExternalHandle | ( | const string & | name | ) | const |
Get the handle for a wrapper for this Solution object from an external language interface.
Returns a null pointer if the requested handle does not exist.
Definition at line 163 of file Solution.cpp.
void registerChangedCallback | ( | void * | id, |
const function< void()> & | callback | ||
) |
Register a function to be called if any of the Solution's thermo, kinetics, or transport objects is replaced.
id | A unique ID corresponding to the object affected by the callback. Typically, this is a pointer to an object that also holds a reference to the Solution object. |
callback | The callback function to be called after any component of the Solution is replaced. When the callback becomes invalid (for example, the corresponding object is being deleted, the removeChangedCallback() method must be invoked. |
Definition at line 172 of file Solution.cpp.
void removeChangedCallback | ( | void * | id | ) |
Remove the callback function associated with the specified object.
Definition at line 177 of file Solution.cpp.
|
protected |
ThermoPhase manager.
Definition at line 150 of file Solution.h.
|
protected |
Kinetics manager.
Definition at line 151 of file Solution.h.
|
protected |
Transport manager.
Definition at line 152 of file Solution.h.
|
protected |
Adjacent phases, for access by index.
Definition at line 155 of file Solution.h.
|
protected |
Adjacent phases, for access by name.
Definition at line 158 of file Solution.h.
|
protected |
Additional input fields; usually from a YAML input file.
Definition at line 160 of file Solution.h.
|
protected |
Wrappers for this Solution object in extension languages, for evaluation of user-defined reaction rates.
Definition at line 164 of file Solution.h.
|
protected |
Callback functions that are invoked when the therm, kinetics, or transport members of the Solution are replaced.
Definition at line 168 of file Solution.h.