19 PDSS_ConstVol::PDSS_ConstVol()
23 void PDSS_ConstVol::setParametersFromXML(
const XML_Node& speciesNode)
25 PDSS::setParametersFromXML(speciesNode);
29 throw CanteraError(
"PDSS_ConstVol::setParametersFromXML",
30 "no standardState Node for species '{}'",
33 if (ss->
attrib(
"model") !=
"constant_incompressible") {
34 throw CanteraError(
"PDSS_ConstVol::setParametersFromXML",
35 "standardState model for species '{}' isn't "
36 "'constant_incompressible'", speciesNode.
name());
39 setMolarVolume(
getFloat(*ss,
"molarVolume",
"toSI"));
42 void PDSS_ConstVol::initThermo()
45 if (m_input.hasKey(
"molar-volume")) {
46 setMolarVolume(m_input.convert(
"molar-volume",
"m^3/kmol"));
48 m_minTemp = m_spthermo->minTemp();
49 m_maxTemp = m_spthermo->maxTemp();
50 m_p0 = m_spthermo->refPressure();
51 m_V0 = m_constMolarVolume;
52 m_Vss = m_constMolarVolume;
55 doublereal PDSS_ConstVol::intEnergy_mole()
const
57 doublereal pV = (m_pres * m_Vss);
61 doublereal PDSS_ConstVol::cv_mole()
const
63 return (cp_mole() - m_V0);
66 void PDSS_ConstVol::setPressure(doublereal p)
69 doublereal del_pRT = (m_pres - m_p0) / (
GasConstant * m_temp);
70 m_hss_RT = m_h0_RT + del_pRT * m_Vss;
71 m_gss_RT = m_hss_RT - m_sss_R;
74 void PDSS_ConstVol::setTemperature(doublereal temp)
77 m_spthermo->updatePropertiesTemp(temp, &m_cp0_R, &m_h0_RT, &m_s0_R);
78 m_g0_RT = m_h0_RT - m_s0_R;
80 doublereal del_pRT = (m_pres - m_p0) / (
GasConstant * m_temp);
82 m_hss_RT = m_h0_RT + del_pRT * m_Vss;
85 m_gss_RT = m_hss_RT - m_sss_R;
88 void PDSS_ConstVol::setState_TP(doublereal temp, doublereal pres)
94 void PDSS_ConstVol::setState_TR(doublereal temp, doublereal rho)
96 doublereal rhoStored = m_mw / m_constMolarVolume;
97 if (fabs(rhoStored - rho) / (rhoStored + rho) > 1.0E-4) {
99 "Inconsistent supplied rho");
101 setTemperature(temp);
104 doublereal PDSS_ConstVol::satPressure(doublereal t)
Declarations for the class PDSS_ConstVol (pressure dependent standard state) which handles calculatio...
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
Base class for exceptions thrown by Cantera classes.
Class XML_Node is a tree-based representation of the contents of an XML file.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
std::string name() const
Returns the name of the XML node.
const XML_Node * findByName(const std::string &nm, int depth=100000) const
This routine carries out a recursive search for an XML node based on the name of the node.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
const double GasConstant
Universal Gas Constant [J/kmol/K].
Namespace for the Cantera kernel.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.