Esempio n. 1
0
//====================================================================================================================
void VPSSMgr_General::_updateRefStateThermo() const
{
    if (m_useTmpRefStateStorage) {
        for (size_t k = 0; k < m_kk; k++) {
            PDSS* kPDSS = m_PDSS_ptrs[k];
            kPDSS->setState_TP(m_tlast, m_plast);
            m_h0_RT[k] = kPDSS->enthalpy_RT_ref();
            m_s0_R[k]  = kPDSS->entropy_R_ref();
            m_g0_RT[k] = m_h0_RT[k] - m_s0_R[k];
            m_cp0_R[k] = kPDSS->cp_R_ref();
            m_V0[k]    = kPDSS->molarVolume_ref();
        }
    }
}
Esempio n. 2
0
/*!
 *  Returns the vector of the
 *  gibbs function of the reference state at the current temperature
 *  of the solution and the reference pressure for the species.
 *  units = J/kmol
 *
 * @param g   Output vector contain the Gibbs free energies
 *            of the reference state of the species
 *            length = m_kk, units = J/kmol.
 */
void VPSSMgr_General::getGibbs_ref(doublereal* g) const
{
    doublereal _rt = GasConstant * m_tlast;
    if (m_useTmpRefStateStorage) {
        std::copy(m_g0_RT.begin(), m_g0_RT.end(), g);
        scale(g, g+m_kk, g, _rt);
    } else {
        for (size_t k = 0; k < m_kk; k++) {
            PDSS* kPDSS = m_PDSS_ptrs[k];
            kPDSS->setState_TP(m_tlast, m_plast);
            double h0_RT = kPDSS->enthalpy_RT_ref();
            double s0_R  = kPDSS->entropy_R_ref();
            g[k] = _rt * (h0_RT - s0_R);
        }
    }
}