void IdealSolidSolnPhase::getGibbs_RT_ref(doublereal* grt) const { _updateThermo(); for (size_t k = 0; k != m_kk; k++) { grt[k] = m_g0_RT[k]; } }
void IdealSolidSolnPhase::getCp_R_ref(doublereal* cpr) const { _updateThermo(); for (size_t k = 0; k != m_kk; k++) { cpr[k] = m_cp0_R[k]; } }
void IdealSolidSolnPhase::getEnthalpy_RT_ref(doublereal* hrt) const { _updateThermo(); for (size_t k = 0; k != m_kk; k++) { hrt[k] = m_h0_RT[k]; } }
void LatticeSolidPhase::getGibbs_RT_ref(doublereal* grt) const { _updateThermo(); for (size_t n = 0; n < m_nlattice; n++) { m_lattice[n]->getGibbs_RT_ref(grt + lkstart_[n]); } }
void SurfPhase:: getEnthalpy_RT(doublereal* hrt) const { _updateThermo(); double rrt = 1.0/(GasConstant*temperature()); scale(m_h0.begin(), m_h0.end(), hrt, rrt); }
void MaskellSolidSolnPhase::getPureGibbs(doublereal* gpure) const { _updateThermo(); for (size_t sp=0; sp < m_kk; ++sp) { gpure[sp] = RT() * m_g0_RT[sp]; } }
void LatticePhase::getGibbs_RT_ref(doublereal* grt) const { _updateThermo(); for (size_t k = 0; k < m_kk; k++) { grt[k] = m_g0_RT[k]; } }
void SurfPhase::getStandardVolumes(doublereal* vol) const { _updateThermo(); for (size_t k = 0; k < m_kk; k++) { vol[k] = 1.0/standardConcentration(k); } }
void IdealSolidSolnPhase::getEntropy_R_ref(doublereal* er) const { _updateThermo(); for (size_t k = 0; k != m_kk; k++) { er[k] = m_s0_R[k]; } }
void IdealSolidSolnPhase::getGibbs_ref(doublereal* g) const { _updateThermo(); double tmp = GasConstant * temperature(); for (size_t k = 0; k != m_kk; k++) { g[k] = tmp * m_g0_RT[k]; } }
doublereal MaskellSolidSolnPhase::enthalpy_mole() const { _updateThermo(); const doublereal h0 = RT() * mean_X(m_h0_RT); const doublereal r = moleFraction(product_species_index); const doublereal fmval = fm(r); return h0 + r * fmval * h_mixing; }
doublereal SurfPhase::enthalpy_mole() const { if (m_n0 <= 0.0) { return 0.0; } _updateThermo(); return mean_X(DATA_PTR(m_h0)); }
void MaskellSolidSolnPhase::getPureGibbs(doublereal* gpure) const { _updateThermo(); const doublereal RT = GasConstant * temperature(); for (size_t sp=0; sp < m_kk; ++sp) { gpure[sp] = RT * m_g0_RT[sp]; } }
doublereal MaskellSolidSolnPhase::entropy_mole() const { _updateThermo(); const doublereal s0 = GasConstant * mean_X(m_s0_R); const doublereal r = moleFraction(product_species_index); const doublereal fmval = fm(r); const doublereal rfm = r * fmval; return s0 + GasConstant * (xlogx(1-rfm) - xlogx(rfm) - xlogx(1-r-rfm) - xlogx((1-fmval)*r) - xlogx(1-r) - xlogx(r)); }
doublereal LatticeSolidPhase::cp_mole() const { _updateThermo(); doublereal sum = 0.0; for (size_t n = 0; n < m_nlattice; n++) { sum += theta_[n] * m_lattice[n]->cp_mole(); } return sum; }
void LatticeSolidPhase::getActivityConcentrations(doublereal* c) const { _updateThermo(); int n; int strt = 0; for (n = 0; n < m_nlattice; n++) { m_lattice[n]->getMoleFractions(c+strt); strt += m_lattice[n]->nSpecies(); } }
void LatticeSolidPhase::getStandardChemPotentials(doublereal* mu0) const { _updateThermo(); size_t strt = 0; for (size_t n = 0; n < m_nlattice; n++) { m_lattice[n]->getStandardChemPotentials(mu0+strt); strt += m_lattice[n]->nSpecies(); } }
doublereal SurfPhase::entropy_mole() const { _updateThermo(); doublereal s = 0.0; for (size_t k = 0; k < m_kk; k++) { s += moleFraction(k) * (m_s0[k] - GasConstant * log(std::max(concentration(k) * size(k)/m_n0, SmallNumber))); } return s; }
void LatticeSolidPhase::getPartialMolarEnthalpies(doublereal* hbar) const { _updateThermo(); size_t strt = 0; for (size_t n = 0; n < m_lattice.size(); n++) { size_t nlsp = m_lattice[n]->nSpecies(); m_lattice[n]->getPartialMolarEnthalpies(hbar + strt); strt += nlsp; } }
doublereal LatticeSolidPhase::intEnergy_mole() const { _updateThermo(); doublereal ndens, sum = 0.0; int n; for (n = 0; n < m_nlattice; n++) { ndens = m_lattice[n]->molarDensity(); sum += ndens * m_lattice[n]->intEnergy_mole(); } return sum/molarDensity(); }
void LatticeSolidPhase::getPartialMolarVolumes(doublereal* vbar) const { _updateThermo(); size_t strt = 0; for (size_t n = 0; n < m_nlattice; n++) { size_t nlsp = m_lattice[n]->nSpecies(); m_lattice[n]->getPartialMolarVolumes(vbar + strt); strt += nlsp; } }
void LatticeSolidPhase::getChemPotentials(doublereal* mu) const { _updateThermo(); size_t strt = 0; for (size_t n = 0; n < m_nlattice; n++) { size_t nlsp = m_lattice[n]->nSpecies(); m_lattice[n]->getChemPotentials(mu+strt); strt += nlsp; } }
void SurfPhase::getChemPotentials(doublereal* mu) const { _updateThermo(); copy(m_mu0.begin(), m_mu0.end(), mu); int k; getActivityConcentrations(DATA_PTR(m_work)); for (k = 0; k < m_kk; k++) { mu[k] += GasConstant * temperature() * (log(m_work[k]) - logStandardConc(k)); } }
void LatticeSolidPhase::modifyOneHf298SS(const size_t k, const doublereal Hf298New) { for (size_t n = 0; n < m_lattice.size(); n++) { if (lkstart_[n+1] < k) { size_t kk = k-lkstart_[n]; MultiSpeciesThermo& l_spthermo = m_lattice[n]->speciesThermo(); l_spthermo.modifyOneHf298(kk, Hf298New); } } invalidateCache(); _updateThermo(); }
void LatticeSolidPhase::getStandardChemPotentials(doublereal* mu0) const { _updateThermo(); int n; int strt = 0; double dratio; for (n = 0; n < m_nlattice; n++) { dratio = m_lattice[n]->molarDensity()/molarDensity(); m_lattice[n]->getStandardChemPotentials(mu0+strt); scale(mu0 + strt, mu0 + strt + m_lattice[n]->nSpecies(), mu0 + strt, dratio); strt += m_lattice[n]->nSpecies(); } }
void LatticeSolidPhase::modifyOneHf298SS(const size_t k, const doublereal Hf298New) { for (size_t n = 0; n < m_nlattice; n++) { if (lkstart_[n+1] < k) { size_t kk = k-lkstart_[n]; SpeciesThermo& l_spthermo = m_lattice[n]->speciesThermo(); l_spthermo.modifyOneHf298(kk, Hf298New); } } m_tlast += 0.0001234; _updateThermo(); }
void MaskellSolidSolnPhase::getChemPotentials(doublereal* mu) const { _updateThermo(); const doublereal r = moleFraction(product_species_index); const doublereal pval = p(r); const doublereal rfm = r * fm(r); const doublereal DgbarDr = pval * h_mixing + RT() * std::log( (std::pow(1 - rfm, pval) * std::pow(rfm, pval) * std::pow(r - rfm, 1 - pval) * r) / (std::pow(1 - r - rfm, 1 + pval) * (1 - r)) ); mu[product_species_index] = RT() * m_g0_RT[product_species_index] + DgbarDr; mu[reactant_species_index] = RT() * m_g0_RT[reactant_species_index] - DgbarDr; }
void LatticeSolidPhase::resetHf298(const size_t k) { if (k != npos) { for (size_t n = 0; n < m_lattice.size(); n++) { if (lkstart_[n+1] < k) { size_t kk = k-lkstart_[n]; m_lattice[n]->speciesThermo().resetHf298(kk); } } } else { for (size_t n = 0; n < m_lattice.size(); n++) { m_lattice[n]->speciesThermo().resetHf298(npos); } } invalidateCache(); _updateThermo(); }
void MaskellSolidSolnPhase::getActivityCoefficients(doublereal* ac) const { _updateThermo(); static const int cacheId = m_cache.getId(); CachedArray cached = m_cache.getArray(cacheId); if (!cached.validate(temperature(), pressure(), stateMFNumber())) { cached.value.resize(2); const doublereal r = moleFraction(product_species_index); const doublereal pval = p(r); const doublereal rfm = r * fm(r); const doublereal A = (std::pow(1 - rfm, pval) * std::pow(rfm, pval) * std::pow(r - rfm, 1 - pval)) / (std::pow(1 - r - rfm, 1 + pval) * (1 - r)); const doublereal B = pval * h_mixing / RT(); cached.value[product_species_index] = A * std::exp(B); cached.value[reactant_species_index] = 1 / (A * r * (1-r) ) * std::exp(-B); } std::copy(cached.value.begin(), cached.value.end(), ac); }
doublereal IdealSolidSolnPhase::logStandardConc(size_t k) const { _updateThermo(); double res; switch (m_formGC) { case 0: res = 0.0; break; case 1: res = log(1.0/m_speciesMolarVolume[k]); break; case 2: res = log(1.0/m_speciesMolarVolume[m_kk-1]); break; default: throw CanteraError("eosType", "Unknown type"); break; } return res; }