SurfPhase::SurfPhase(std::string infile, std::string id) : ThermoPhase(), m_n0(0.0), m_logn0(0.0), m_tmin(0.0), m_tmax(0.0), m_press(OneAtm), m_tlast(0.0) { XML_Node* root = get_XML_File(infile); if (id == "-") id = ""; XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id, root); if (!xphase) { throw CanteraError("SurfPhase::SurfPhase", "Couldn't find phase name in file:" + id); } // Check the model name to ensure we have compatibility const XML_Node& th = xphase->child("thermo"); string model = th["model"]; if (model != "Surface" && model != "Edge") { throw CanteraError("SurfPhase::SurfPhase", "thermo model attribute must be Surface or Edge"); } importPhase(*xphase, this); }
ThermoPhase* newPhase(XML_Node& xmlphase) { string model = xmlphase.child("thermo")["model"]; unique_ptr<ThermoPhase> t(newThermoPhase(model)); importPhase(xmlphase, t.get()); return t.release(); }
MetalSHEelectrons::MetalSHEelectrons(const std::string& infile, std::string id_) : SingleSpeciesTP(), xdef_(0) { XML_Node* root; if (infile == "MetalSHEelectrons_default.xml") { xdef_ = MetalSHEelectrons::makeDefaultXMLTree(); root = xdef_; } else { root = get_XML_File(infile); } if (id_ == "-") { id_ = ""; } XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id_, root); if (!xphase) { throw CanteraError("MetalSHEelectrons::MetalSHEelectrons", "Couldn't find phase name in file:" + id_); } // Check the model name to ensure we have compatibility const XML_Node& th = xphase->child("thermo"); std::string model = th["model"]; if (model != "MetalSHEelectrons") { throw CanteraError("MetalSHEelectrons::MetalSHEelectrons", "thermo model attribute must be MetalSHEelectrons"); } importPhase(*xphase, this); }
MargulesVPSSTP::MargulesVPSSTP(XML_Node& phaseRoot, const std::string& id_) : numBinaryInteractions_(0), formMargules_(0), formTempModel_(0) { importPhase(phaseRoot, this); }
MixedSolventElectrolyte::MixedSolventElectrolyte(XML_Node& phaseRoot, const std::string& id_) : numBinaryInteractions_(0), formMargules_(0), formTempModel_(0) { importPhase(*findXMLPhase(&phaseRoot, id_), this); }
RedlichKisterVPSSTP::RedlichKisterVPSSTP(XML_Node& phaseRoot, const std::string& id_) : numBinaryInteractions_(0), formRedlichKister_(0), formTempModel_(0) { importPhase(phaseRoot, this); }
WaterSSTP::WaterSSTP(XML_Node& phaseRoot, const std::string& id) : m_mw(0.0), EW_Offset(0.0), SW_Offset(0.0), m_ready(false), m_allowGasPhase(false) { importPhase(phaseRoot, this); }
MolarityIonicVPSSTP::MolarityIonicVPSSTP(XML_Node& phaseRoot, const std::string& id_) : PBType_(PBTYPE_PASSTHROUGH), numPBSpecies_(m_kk), indexSpecialSpecies_(npos), neutralPBindexStart(0) { importPhase(phaseRoot, this); }
void ThermoPhase::initThermoFile(const std::string& inputFile, const std::string& id) { XML_Node* fxml = get_XML_File(inputFile); XML_Node* fxml_phase = findXMLPhase(fxml, id); if (!fxml_phase) { throw CanteraError("ThermoPhase::initThermoFile", "ERROR: Can not find phase named {} in file" " named {}", id, inputFile); } importPhase(*fxml_phase, this); }
IdealSolidSolnPhase::IdealSolidSolnPhase(XML_Node& root, const std::string& id_, int formGC) : m_formGC(formGC), m_Pref(OneAtm), m_Pcurrent(OneAtm) { if (formGC < 0 || formGC > 2) { throw CanteraError(" IdealSolidSolnPhase Constructor", " Illegal value of formGC"); } importPhase(root, this); }
MolarityIonicVPSSTP::MolarityIonicVPSSTP(XML_Node& phaseRoot, const std::string& id_) : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), numPBSpecies_(m_kk), indexSpecialSpecies_(npos), numCationSpecies_(0), numAnionSpecies_(0), numPassThroughSpecies_(0), neutralPBindexStart(0) { importPhase(*findXMLPhase(&phaseRoot, id_), this); }
StoichSubstanceSSTP::StoichSubstanceSSTP(XML_Node& xmlphase, const std::string& id_) { if (id_ != "" && id_ != xmlphase["id"]) { throw CanteraError("StoichSubstanceSSTP::StoichSubstanceSSTP", "id's don't match"); } std::string model = xmlphase.child("thermo")["model"]; if (model != "StoichSubstance" && model != "StoichSubstanceSSTP") { throw CanteraError("StoichSubstanceSSTP::StoichSubstanceSSTP", "thermo model attribute must be StoichSubstance"); } importPhase(xmlphase, this); }
electrodeElectron::electrodeElectron(XML_Node& xmlphase, const std::string& id_) : StoichSubstanceSSTP() { if (id_ != "" && id_ != xmlphase["id"]) { throw CanteraError("electrodeElectron::electrodeElectron", "id's don't match"); } if (xmlphase.child("thermo")["model"] != "electrodeElectron") { throw CanteraError("electrodeElectron::electrodeElectron", "thermo model attribute must be electrodeElectron"); } importPhase(xmlphase, this); }
SurfPhase::SurfPhase(XML_Node& xmlphase) : ThermoPhase(), m_n0(0.0), m_logn0(0.0), m_press(OneAtm) { const XML_Node& th = xmlphase.child("thermo"); string model = th["model"]; if (model != "Surface" && model != "Edge") { throw CanteraError("SurfPhase::SurfPhase", "thermo model attribute must be Surface or Edge"); } importPhase(xmlphase, this); }
IdealSolnGasVPSS::IdealSolnGasVPSS(std::string infile, std::string id) : VPStandardStateTP(), m_idealGas(0), m_formGC(0) { XML_Node* root = get_XML_File(infile); if (id == "-") id = ""; XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id, root); if (!xphase) { throw CanteraError("newPhase", "Couldn't find phase named \"" + id + "\" in file, " + infile); } importPhase(*xphase, this); }
/* * Create a new ThermoPhase object and initializes it according to * the XML tree database. This routine first looks up the * identity of the model for the solution thermodynamics in the * model attribute of the thermo child of the xml phase * node. Then, it does a string lookup on the model to figure out * what ThermoPhase derived class is assigned. It creates a new * instance of that class, and then calls importPhase() to * populate that class with the correct parameters from the XML * tree. */ ThermoPhase* newPhase(XML_Node& xmlphase) { const XML_Node& th = xmlphase.child("thermo"); string model = th["model"]; ThermoPhase* t = newThermoPhase(model); #ifdef WITH_ELECTROLYTES if (model == "HMW") { HMWSoln* p = (HMWSoln*)t; p->constructPhaseXML(xmlphase,""); } else #endif importPhase(xmlphase, t); return t; }
ThermoPhase* newPhase(XML_Node& xmlphase) { string model = xmlphase.child("thermo")["model"]; ThermoPhase* t = newThermoPhase(model); if (model == "singing cows") { throw CanteraError("ThermoPhase::newPhase", "Cows don't sing"); } else if (model == "HMW") { HMWSoln* p = dynamic_cast<HMWSoln*>(t); p->constructPhaseXML(xmlphase,""); } else if (model == "IonsFromNeutralMolecule") { IonsFromNeutralVPSSTP* p = dynamic_cast<IonsFromNeutralVPSSTP*>(t); p->constructPhaseXML(xmlphase,""); } else { importPhase(xmlphase, t); } return t; }
/* * @param phaseRef XML node pointing to a StoichSubstanceSSTP description * @param id Id of the phase. */ StoichSubstanceSSTP::StoichSubstanceSSTP(XML_Node& xmlphase, std::string id) : SingleSpeciesTP() { if (id != "") { std::string idxml = xmlphase["id"]; if (id != idxml) { throw CanteraError("StoichSubstanceSSTP::StoichSubstanceSSTP", "id's don't match"); } } const XML_Node& th = xmlphase.child("thermo"); std::string model = th["model"]; if (model != "StoichSubstance" && model != "StoichSubstanceSSTP") { throw CanteraError("StoichSubstanceSSTP::StoichSubstanceSSTP", "thermo model attribute must be StoichSubstance"); } importPhase(xmlphase, this); }
MineralEQ3::MineralEQ3(XML_Node& xmlphase, const std::string& id_) : StoichSubstanceSSTP() { if (id_ != "") { std::string idxml = xmlphase["id"]; if (id_ != idxml) { throw CanteraError("MineralEQ3::MineralEQ3", "id's don't match"); } } const XML_Node& th = xmlphase.child("thermo"); std::string model = th["model"]; if (model != "StoichSubstance" && model != "MineralEQ3") { throw CanteraError("MineralEQ3::MineralEQ3", "thermo model attribute must be StoichSubstance"); } importPhase(xmlphase, this); }
/* * @param phaseRef XML node pointing to a electrodeElectron description * @param id Id of the phase. */ electrodeElectron::electrodeElectron(XML_Node& xmlphase, std::string id) : StoichSubstanceSSTP() { if (id != "") { std::string idxml = xmlphase["id"]; if (id != idxml) { throw CanteraError("electrodeElectron::electrodeElectron", "id's don't match"); } } const XML_Node& th = xmlphase.child("thermo"); std::string model = th["model"]; if (model != "electrodeElectron") { throw CanteraError("electrodeElectron::electrodeElectron", "thermo model attribute must be electrodeElectron"); } importPhase(xmlphase, this); }
MetalSHEelectrons::MetalSHEelectrons(XML_Node& xmlphase, const std::string& id_) : SingleSpeciesTP(), xdef_(0) { if (id_ != "") { std::string idxml = xmlphase["id"]; if (id_ != idxml) { throw CanteraError("MetalSHEelectrons::MetalSHEelectrons", "id's don't match"); } } const XML_Node& th = xmlphase.child("thermo"); std::string model = th["model"]; if (model != "MetalSHEelectrons") { throw CanteraError("MetalSHEelectrons::MetalSHEelectrons", "thermo model attribute must be MetalSHEelectrons"); } importPhase(xmlphase, this); }
StoichSubstanceSSTP::StoichSubstanceSSTP(const std::string& infile, std::string id_) { XML_Node* root = get_XML_File(infile); if (id_ == "-") { id_ = ""; } XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id_, root); if (!xphase) { throw CanteraError("StoichSubstanceSSTP::StoichSubstanceSSTP", "Couldn't find phase name in file:" + id_); } // Check the model name to ensure we have compatibility std::string model = xphase->child("thermo")["model"]; if (model != "StoichSubstance" && model != "StoichSubstanceSSTP") { throw CanteraError("StoichSubstanceSSTP::StoichSubstanceSSTP", "thermo model attribute must be StoichSubstance"); } importPhase(*xphase, this); }
/* * @param infile name of the input file * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ electrodeElectron::electrodeElectron(std::string infile, std::string id) : StoichSubstanceSSTP() { XML_Node* root = get_XML_File(infile); if (id == "-") id = ""; XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id, root); if (!xphase) { throw CanteraError("electrodeElectron::electrodeElectron", "Couldn't find phase name in file:" + id); } // Check the model name to ensure we have compatibility const XML_Node& th = xphase->child("thermo"); std::string model = th["model"]; if (model != "electrodeElectron") { throw CanteraError("electrodeElectron::electrodeElectron", "thermo model attribute must be electrodeElectron"); } importPhase(*xphase, this); }
IdealMolalSoln::IdealMolalSoln(XML_Node& root, const std::string& id_) : MolalityVPSSTP(), m_formGC(2), IMS_typeCutoff_(0), IMS_X_o_cutoff_(0.2), IMS_gamma_o_min_(0.00001), IMS_gamma_k_min_(10.0), IMS_slopefCut_(0.6), IMS_slopegCut_(0.0), IMS_cCut_(.05), IMS_dfCut_(0.0), IMS_efCut_(0.0), IMS_afCut_(0.0), IMS_bfCut_(0.0), IMS_dgCut_(0.0), IMS_egCut_(0.0), IMS_agCut_(0.0), IMS_bgCut_(0.0) { importPhase(root, this); }
bool buildSolutionFromXML(XML_Node& root, const std::string& id, const std::string& nm, ThermoPhase* th, Kinetics* kin) { XML_Node* x = get_XML_NameID(nm, string("#")+id, &root); if (!x) { return false; } // Fill in the ThermoPhase object by querying the const XML_Node tree // located at x. importPhase(*x, th); // Create a vector of ThermoPhase pointers of length 1 having the current th // ThermoPhase as the entry. std::vector<ThermoPhase*> phases{th}; // Fill in the kinetics object k, by querying the const XML_Node tree // located by x. The source terms and eventually the source term vector will // be constructed from the list of ThermoPhases in the vector, phases. importKinetics(*x, phases, kin); return true; }
/* * @param infile name of the input file * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ FixedChemPotSSTP::FixedChemPotSSTP(std::string infile, std::string id) : SingleSpeciesTP(), chemPot_(0.0) { XML_Node* root = get_XML_File(infile); if (id == "-") { id = ""; } XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id, root); if (!xphase) { throw CanteraError("FixedChemPotSSTP::FixedChemPotSSTP", "Couldn't find phase name in file:" + id); } // Check the model name to ensure we have compatibility const XML_Node& th = xphase->child("thermo"); std::string model = th["model"]; if (model != "StoichSubstance" && model != "StoichSubstanceSSTP" && model != "FixedChemPot") { throw CanteraError("FixedChemPotSSTP::FixedChemPotSSTP", "thermo model attribute must be FixedChemPot or StoichSubstance"); } importPhase(*xphase, this); }
/* * Create a new ThermoPhase object and initializes it according to * the XML tree database. This routine first looks up the * identity of the model for the solution thermodynamics in the * model attribute of the thermo child of the xml phase * node. Then, it does a string lookup on the model to figure out * what ThermoPhase derived class is assigned. It creates a new * instance of that class, and then calls importPhase() to * populate that class with the correct parameters from the XML * tree. */ ThermoPhase* newPhase(XML_Node& xmlphase) { const XML_Node& th = xmlphase.child("thermo"); string model = th["model"]; ThermoPhase* t = newThermoPhase(model); if (model == "singing cows") { throw CanteraError(" newPhase", "Cows don't sing"); } #ifdef WITH_ELECTROLYTES else if (model == "HMW") { HMWSoln* p = dynamic_cast<HMWSoln*>(t); p->constructPhaseXML(xmlphase,""); } #endif #ifdef WITH_IDEAL_SOLUTIONS else if (model == "IonsFromNeutralMolecule") { IonsFromNeutralVPSSTP* p = dynamic_cast<IonsFromNeutralVPSSTP*>(t); p->constructPhaseXML(xmlphase,""); } #endif else { importPhase(xmlphase, t); } return t; }
/* * @param phaseRef XML node pointing to a FixedChemPotSSTP description * @param id Id of the phase. */ FixedChemPotSSTP::FixedChemPotSSTP(XML_Node& xmlphase, std::string id) : SingleSpeciesTP(), chemPot_(0.0) { if (id != "") { std::string idxml = xmlphase["id"]; if (id != idxml) { throw CanteraError("FixedChemPotSSTP::FixedChemPotSSTP", "id's don't match"); } } const XML_Node& th = xmlphase.child("thermo"); std::string model = th["model"]; if (model != "StoichSubstance" && model != "StoichSubstanceSSTP" && model != "FixedChemPotSSTP") { throw CanteraError("FixedChemPotSSTP::FixedChemPotSSTP", "thermo model attribute must be StoichSubstance or FixedChemPot"); } importPhase(xmlphase, this); if (model == "StoichSubstance" || model == "StoichSubstanceSSTP") { _updateThermo(); chemPot_ = (m_h0_RT[0] - m_s0_R[0]) * GasConstant * temperature(); } }
MetalSHEelectrons::MetalSHEelectrons(XML_Node& xmlphase, const std::string& id_) { importPhase(xmlphase, this); }
IdealGasPhase::IdealGasPhase(XML_Node& phaseRef, const std::string& id_) : m_p0(-1.0), m_logc0(0.0) { importPhase(phaseRef, this); }