[Thermo] Look up standard entropy when adding undefined elements

This commit is contained in:
Ray Speth 2017-08-12 00:08:32 -04:00
parent c88ddce0d6
commit 0ca788bd69

View file

@ -641,6 +641,18 @@ size_t Phase::addElement(const std::string& symbol, doublereal weight,
weight = getElementWeight(symbol);
}
// Try to look up the standard entropy if not given. Fail silently.
if (entropy298 == ENTROPY298_UNKNOWN) {
try {
XML_Node* db = get_XML_File("elements.xml");
XML_Node* elnode = db->findByAttr("name", symbol);
if (elnode && elnode->hasChild("entropy298")) {
entropy298 = fpValueCheck(elnode->child("entropy298")["value"]);
}
} catch (CanteraError&) {
}
}
// Check for duplicates
auto iter = find(m_elementNames.begin(), m_elementNames.end(), symbol);
if (iter != m_elementNames.end()) {