/** * Install a NASA9 polynomial thermodynamic property * parameterization for species k into a SpeciesThermo instance. * This is called by method installThermoForSpecies if a NASA9 * block is found in the XML input. */ static void installNasa9ThermoFromXML(std::string speciesName, SpeciesThermo& sp, int k, const std::vector<XML_Node*>& tp) { const XML_Node * fptr = tp[0]; int nRegTmp = tp.size(); int nRegions = 0; vector_fp cPoly; Nasa9Poly1 *np_ptr = 0; std::vector<Nasa9Poly1 *> regionPtrs; doublereal tmin, tmax, pref = OneAtm; // Loop over all of the possible temperature regions for (int i = 0; i < nRegTmp; i++) { fptr = tp[i]; if (fptr) { if (fptr->name() == "NASA9") { if (fptr->hasChild("floatArray")) { tmin = fpValue((*fptr)["Tmin"]); tmax = fpValue((*fptr)["Tmax"]); if ((*fptr).hasAttrib("P0")) { pref = fpValue((*fptr)["P0"]); } if ((*fptr).hasAttrib("Pref")) { pref = fpValue((*fptr)["Pref"]); } getFloatArray(fptr->child("floatArray"), cPoly, false); if (cPoly.size() != 9) { throw CanteraError("installNasa9ThermoFromXML", "Expected 9 coeff polynomial"); } np_ptr = new Nasa9Poly1(k, tmin, tmax, pref, DATA_PTR(cPoly)); regionPtrs.push_back(np_ptr); nRegions++; } } } } if (nRegions == 0) { throw UnknownSpeciesThermoModel("installThermoForSpecies", speciesName, " " ); } else if (nRegions == 1) { sp.install_STIT(np_ptr); } else { Nasa9PolyMultiTempRegion* npMulti_ptr = new Nasa9PolyMultiTempRegion(regionPtrs); sp.install_STIT(npMulti_ptr); } }
void SpeciesThermoFactory::installThermoForSpecies (size_t k, const XML_Node& speciesNode, ThermoPhase* th_ptr, SpeciesThermo& spthermo, const XML_Node* phaseNode_ptr) const { SpeciesThermoInterpType* stit = newSpeciesThermoInterpType(speciesNode); stit->validate(speciesNode["name"]); stit->setIndex(k); spthermo.install_STIT(stit); }
void SpeciesThermoFactory::installThermoForSpecies (size_t k, const XML_Node& speciesNode, ThermoPhase* th_ptr, SpeciesThermo& spthermo, const XML_Node* phaseNode_ptr) const { shared_ptr<SpeciesThermoInterpType> stit( newSpeciesThermoInterpType(speciesNode.child("thermo"))); stit->validate(speciesNode["name"]); spthermo.install_STIT(k, stit); }