[Input] Store phase definition parameters in the ThermoPhase object

This commit is contained in:
Ray Speth 2019-01-11 18:54:06 -05:00
parent 59b0f64e26
commit 96124f8455
3 changed files with 36 additions and 2 deletions

View file

@ -1427,10 +1427,17 @@ public:
* required after all species have been added. For example, it might be used
* to resize internal work arrays that must have an entry for each species.
* The base class implementation does nothing, and subclasses that do not
* require initialization do not need to overload this method. When
* importing a CTML phase description, this method is called from
* require initialization do not need to overload this method. Derived
* classes which do override this function should call their parent class's
* implementation of this function as their last action.
*
* When importing a CTML phase description, this method is called from
* initThermoXML(), which is called from importPhase(), just prior to
* returning from function importPhase().
*
* When importing from an AnyMap phase desciption (or from a YAML file),
* this method is responsible for setting model parameters from the data
* stored in #m_input.
*/
virtual void initThermo();
@ -1454,6 +1461,13 @@ public:
virtual void getParameters(int& n, doublereal* const c) const {
}
//! Set equation of state parameters from an AnyMap phase description
void setParameters(const AnyMap& phaseNode);
//! Access input data associated with the phase description
const AnyMap& input() const;
AnyMap& input();
//! Set equation of state parameter values from XML entries.
/*!
* This method is called by function importPhase() when processing a phase
@ -1606,6 +1620,10 @@ protected:
*/
MultiSpeciesThermo m_spthermo;
//! Data supplied via setParameters. When first set, this may include
//! parameters used by different phase models when initThermo() is called.
AnyMap m_input;
//! Vector of pointers to the species databases.
/*!
* This is used to access data needed to construct the transport manager and

View file

@ -498,6 +498,7 @@ void setupPhase(ThermoPhase& thermo, const AnyMap& phaseNode,
addSpecies(thermo, AnyValue("all"), rootNode["species"]);
}
thermo.setParameters(phaseNode);
thermo.initThermo();
if (phaseNode.hasKey("state")) {

View file

@ -750,6 +750,21 @@ const std::vector<const XML_Node*> & ThermoPhase::speciesData() const
return m_speciesData;
}
void ThermoPhase::setParameters(const AnyMap& phaseNode)
{
m_input = phaseNode;
}
const AnyMap& ThermoPhase::input() const
{
return m_input;
}
AnyMap& ThermoPhase::input()
{
return m_input;
}
void ThermoPhase::setStateFromXML(const XML_Node& state)
{
string comp = getChildValue(state,"moleFractions");