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);
}
Esempio n. 2
0
PDSS* VPSSMgr_IdealGas::createInstallPDSS(size_t k, const XML_Node& speciesNode,
                                          const XML_Node* const phaseNode_ptr)
{
    const XML_Node* ss = speciesNode.findByName("standardState");
    if (ss && ss->attrib("model") != "ideal_gas") {
        throw CanteraError("VPSSMgr_IdealGas::createInstallPDSS",
                           "standardState model for species isn't "
                           "ideal_gas: " + speciesNode["name"]);
    }
    if (m_Vss.size() < k+1) {
        m_Vss.resize(k+1, 0.0);
    }

    shared_ptr<SpeciesThermoInterpType> stit(
        newSpeciesThermoInterpType(speciesNode.child("thermo")));
    stit->validate(speciesNode["name"]);
    m_spthermo->install_STIT(k, stit);

    PDSS* kPDSS = new PDSS_IdealGas(m_vptp_ptr, k, speciesNode,
                                    *phaseNode_ptr, true);

    m_p0 = m_spthermo->refPressure(k);
    return kPDSS;
}
Esempio n. 3
0
FixedChemPotSSTP::FixedChemPotSSTP(const std::string& Ename, doublereal val) :
    chemPot_(0.0)
{
    std::string pname = Ename + "Fixed";
    setID(pname);
    setName(pname);
    setNDim(3);
    addElement(Ename);
    auto sp = make_shared<Species>(pname, parseCompString(Ename + ":1.0"));
    double c[4] = {298.15, val, 0.0, 0.0};
    shared_ptr<SpeciesThermoInterpType> stit(
            newSpeciesThermoInterpType("const_cp", 0.1, 1e30, OneAtm, c));
    sp->thermo = stit;
    addSpecies(sp);
    initThermo();
    m_p0 = OneAtm;
    m_tlast = 298.15;
    setChemicalPotential(val);

    // Create an XML_Node entry for this species
    XML_Node s("species", 0);
    s.addAttribute("name", pname);
    std::string aaS = Ename + ":1";
    s.addChild("atomArray", aaS);
    XML_Node& tt = s.addChild("thermo");
    XML_Node& ss = tt.addChild("Simple");
    ss.addAttribute("Pref", "1 bar");
    ss.addAttribute("Tmax", "5000.");
    ss.addAttribute("Tmin", "100.");
    ss.addChild("t0", "298.15");
    ss.addChild("cp0", "0.0");
    std::string sval = fp2str(val);
    ss.addChild("h", sval);
    ss.addChild("s", "0.0");
    saveSpeciesData(0, &s);
}