Exemplo n.º 1
0
//====================================================================================================================
FixedChemPotSSTP::FixedChemPotSSTP(std::string Ename, doublereal val) :
    SingleSpeciesTP(),
    chemPot_(0.0)
{

    std::string pname = Ename + "Fixed";
    setID(pname);
    setName(pname);
    setNDim(3);
    addUniqueElement(Ename, -12345.);
    freezeElements();
    vector_fp ecomp(nElements(), 0.0);
    ecomp[0] = 1.0;
    double chrg = 0.0;
    SpeciesThermo* spth = new SimpleThermo();
    setSpeciesThermo(spth);
    addUniqueSpecies(pname, &ecomp[0], chrg, 0.0);
    double c[4];
    c[0] = 298.15;
    c[1] = val;
    c[2] = 0.0;
    c[3] = 0.0;
    m_spthermo->install(pname, 0, SIMPLE, c, 0.0, 1.0E30, OneAtm);
    freezeSpecies();
    initThermo();
    m_p0 = OneAtm;
    m_tlast = 298.15;
    setChemicalPotential(val);

    // Create an XML_Node entry for this species
    XML_Node* s = new XML_Node("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);
    delete s;
    s = 0;
}
Exemplo n.º 2
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);
}