void MolarityIonicVPSSTP::initThermo()
{
    GibbsExcessVPSSTP::initThermo();
    initLengths();

    // Go find the list of cations and anions
    cationList_.clear();
    anionList_.clear();
    passThroughList_.clear();
    for (size_t k = 0; k < m_kk; k++) {
        double ch = m_speciesCharge[k];
        if (ch > 0.0) {
            cationList_.push_back(k);
        } else if (ch < 0.0) {
            anionList_.push_back(k);
        } else {
            passThroughList_.push_back(k);
        }
    }
    numPBSpecies_ = cationList_.size() + anionList_.size() - 1;
    neutralPBindexStart = numPBSpecies_;
    PBType_ = PBTYPE_MULTICATIONANION;
    if (anionList_.size() == 1) {
        PBType_ = PBTYPE_SINGLEANION;
    } else if (cationList_.size() == 1) {
        PBType_ = PBTYPE_SINGLECATION;
    }
    if (anionList_.size() == 0 && cationList_.size() == 0) {
        PBType_ = PBTYPE_PASSTHROUGH;
    }
}
void MolalityVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id_)
{
    initLengths();

    // The solvent defaults to species 0
    setSolvent(0);
    VPStandardStateTP::initThermoXML(phaseNode, id_);
}
Example #3
0
/*
 * initThermoXML()                (virtual from ThermoPhase)
 *   Import and initialize a ThermoPhase object
 *
 * @param phaseNode This object must be the phase node of a
 *             complete XML tree
 *             description of the phase, including all of the
 *             species data. In other words while "phase" must
 *             point to an XML phase object, it must have
 *             sibling nodes "speciesData" that describe
 *             the species in the phase.
 * @param id   ID of the phase. If nonnull, a check is done
 *             to see if phaseNode is pointing to the phase
 *             with the correct id.
 */
void MolalityVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id)
{

    initLengths();
    /*
     * The solvent defaults to species 0
     */
    setSolvent(0);

    VPStandardStateTP::initThermoXML(phaseNode, id);
}
Example #4
0
  /*
   * Perform initializations after all species have been
   * added.
   */
  void VPStandardStateTP::initThermo() {
    initLengths();
    ThermoPhase::initThermo();
    m_VPSS_ptr->initThermo();
    for (int k = 0; k < m_kk; k++) {
      PDSS *kPDSS = m_PDSS_storage[k];
      if (kPDSS) {
	kPDSS->initThermo();
      }
    }
  }
void MolalityVPSSTP::initThermo()
{
    initLengths();
    VPStandardStateTP::initThermo();

    // The solvent defaults to species 0
    setSolvent(0);

    // Find the Cl- species
    m_indexCLM = findCLMIndex();
}
Example #6
0
void LatticeSolidPhase::initThermo()
{
    initLengths();
    size_t nsp, loc = 0;
    for (size_t n = 0; n < m_nlattice; n++) {
        nsp = m_lattice[n]->nSpecies();
        lkstart_[n] = loc;
        for (size_t k = 0; k < nsp; k++) {
            m_x[loc] =m_lattice[n]->moleFraction(k) / (double) m_nlattice;
            loc++;
        }
        lkstart_[n+1] = loc;
    }
    setMoleFractions(DATA_PTR(m_x));
    ThermoPhase::initThermo();
}
void MixedSolventElectrolyte::initThermo()
{
    initLengths();
    MolarityIonicVPSSTP::initThermo();
}
Example #8
0
void VPSSMgr_General::initThermo()
{
    initLengths();
}
Example #9
0
void MargulesVPSSTP::initThermo()
{
    initLengths();
    GibbsExcessVPSSTP::initThermo();
}
Example #10
0
 /*
  * @internal Initialize. This method is provided to allow
  * subclasses to perform any initialization required after all
  * species have been added. For example, it might be used to
  * resize internal work arrays that must have an entry for
  * each species.  The base class implementation does nothing,
  * and subclasses that do not require initialization do not
  * need to overload this method.  When importing a CTML phase
  * description, this method is called just prior to returning
  * from function importPhase.
  *
  * @see importCTML.cpp
  */
 void GibbsExcessVPSSTP::initThermo() {
   initLengths();
   VPStandardStateTP::initThermo();
   getMoleFractions(DATA_PTR(moleFractions_));
 }
Example #11
0
 /*
  * @internal Initialize. This method is provided to allow
  * subclasses to perform any initialization required after all
  * species have been added. For example, it might be used to
  * resize internal work arrays that must have an entry for
  * each species.  The base class implementation does nothing,
  * and subclasses that do not require initialization do not
  * need to overload this method.  When importing a CTML phase
  * description, this method is called just prior to returning
  * from function importPhase.
  *
  * @see importCTML.cpp
  */
 void MargulesVPSSTP::initThermo() {
   initLengths();
   PseudoBinaryVPSSTP::initThermo();
 }
Example #12
0
 /*
  * @internal Initialize. This method is provided to allow
  * subclasses to perform any initialization required after all
  * species have been added. For example, it might be used to
  * resize internal work arrays that must have an entry for
  * each species.  The base class implementation does nothing,
  * and subclasses that do not require initialization do not
  * need to overload this method.  When importing a CTML phase
  * description, this method is called just prior to returning
  * from function importPhase.
  *
  * @see importCTML.cpp
  */
 void PseudoBinaryVPSSTP::initThermo() {
   initLengths();
   GibbsExcessVPSSTP::initThermo();
 }
void IdealSolidSolnPhase::initThermoXML(XML_Node& phaseNode, const std::string& id_)
{
    if (id_.size() > 0 && phaseNode.id() != id_) {
        throw CanteraError("IdealSolidSolnPhase::initThermoXML",
                           "phasenode and Id are incompatible");
    }

    /*
     * Check on the thermo field. Must have:
     * <thermo model="IdealSolidSolution" />
     */
    if (phaseNode.hasChild("thermo")) {
        XML_Node& thNode = phaseNode.child("thermo");
        string mString = thNode.attrib("model");
        if (lowercase(mString) != "idealsolidsolution") {
            throw CanteraError("IdealSolidSolnPhase::initThermoXML",
                               "Unknown thermo model: " + mString);
        }
    } else {
        throw CanteraError("IdealSolidSolnPhase::initThermoXML",
                           "Unspecified thermo model");
    }

    /*
     * Form of the standard concentrations. Must have one of:
     *
     *     <standardConc model="unity" />
     *     <standardConc model="molar_volume" />
     *     <standardConc model="solvent_volume" />
     */
    if (phaseNode.hasChild("standardConc")) {
        XML_Node& scNode = phaseNode.child("standardConc");
        string formStringa = scNode.attrib("model");
        string formString = lowercase(formStringa);
        if (formString == "unity") {
            m_formGC = 0;
        } else if (formString == "molar_volume") {
            m_formGC = 1;
        } else if (formString == "solvent_volume") {
            m_formGC = 2;
        } else {
            throw CanteraError("IdealSolidSolnPhase::initThermoXML",
                               "Unknown standardConc model: " + formStringa);
        }
    } else {
        throw CanteraError("IdealSolidSolnPhase::initThermoXML",
                           "Unspecified standardConc model");
    }

    /*
     * Initialize all of the lengths now that we know how many species
     * there are in the phase.
     */
    initLengths();
    /*
     * Now go get the molar volumes
     */
    XML_Node& speciesList = phaseNode.child("speciesArray");
    XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"],
                                         &phaseNode.root());

    for (size_t k = 0; k < m_kk; k++) {
        XML_Node* s = speciesDB->findByAttr("name", speciesName(k));
        XML_Node* ss = s->findByName("standardState");
        m_speciesMolarVolume[k] = getFloat(*ss, "molarVolume", "toSI");
    }

    /*
     * Call the base initThermo, which handles setting the initial
     * state.
     */
    ThermoPhase::initThermoXML(phaseNode, id_);
}
Example #14
0
void VPSSMgr::initThermo()
{
    initLengths();
}
void RedlichKisterVPSSTP::initThermo()
{
    initLengths();
    GibbsExcessVPSSTP::initThermo();
}
void MixtureFugacityTP::initThermo()
{
    initLengths();
    ThermoPhase::initThermo();
}
Example #17
0
 /*
  * Perform initializations after all species have been
  * added.
  */
 void IdealSolnGasVPSS::initThermo() {
   initLengths();
   VPStandardStateTP::initThermo();
 }