From 0ca788bd69cbc7b8a3e4ae319d6668ce6a96b1a8 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Sat, 12 Aug 2017 00:08:32 -0400 Subject: [PATCH] [Thermo] Look up standard entropy when adding undefined elements --- src/thermo/Phase.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/thermo/Phase.cpp b/src/thermo/Phase.cpp index 2736fb964..de6db6ee7 100644 --- a/src/thermo/Phase.cpp +++ b/src/thermo/Phase.cpp @@ -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()) {