Esempio n. 1
0
  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);
  }
Esempio n. 2
0
ThermoPhase* newPhase(XML_Node& xmlphase)
{
    string model = xmlphase.child("thermo")["model"];
    unique_ptr<ThermoPhase> t(newThermoPhase(model));
    importPhase(xmlphase, t.get());
    return t.release();
}
Esempio n. 3
0
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);
}
Esempio n. 4
0
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);
}
Esempio n. 7
0
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);
}
Esempio n. 8
0
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);
}
Esempio n. 10
0
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);
}
Esempio n. 11
0
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);
}
Esempio n. 12
0
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);
}
Esempio n. 13
0
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);
}
Esempio n. 14
0
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);
}
Esempio n. 15
0
  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);
  }
Esempio n. 16
0
  /*
   * 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;
  }
Esempio n. 17
0
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;
}
Esempio n. 18
0
  /*
   *  @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);
  }
Esempio n. 19
0
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);
}
Esempio n. 20
0
  /*
   *  @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);
  }
Esempio n. 21
0
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);
}
Esempio n. 22
0
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);
}
Esempio n. 23
0
  /*
   * @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);
  }
Esempio n. 24
0
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);
}
Esempio n. 25
0
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;
}
Esempio n. 26
0
/*
 * @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);
}
Esempio n. 27
0
  /*
   * 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;
  }
Esempio n. 28
0
/*
 *  @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();
    }
}
Esempio n. 29
0
MetalSHEelectrons::MetalSHEelectrons(XML_Node& xmlphase, const std::string& id_)
{
    importPhase(xmlphase, this);
}
Esempio n. 30
0
IdealGasPhase::IdealGasPhase(XML_Node& phaseRef, const std::string& id_) :
    m_p0(-1.0),
    m_logc0(0.0)
{
    importPhase(phaseRef, this);
}