void RedlichKisterVPSSTP::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const { s_update_dlnActCoeff_dT(); for (size_t k = 0; k < m_kk; k++) { d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k]; } }
void MixedSolventElectrolyte::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const { s_update_dlnActCoeff_dT(); for (size_t k = 0; k < m_kk; k++) { d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k]; } }
void RedlichKisterVPSSTP::getPartialMolarEntropies(doublereal* sbar) const { /* * Get the nondimensional standard state entropies */ getEntropy_R(sbar); double T = temperature(); /* * Update the activity coefficients, This also update the * internally stored molalities. */ s_update_lnActCoeff(); s_update_dlnActCoeff_dT(); for (size_t k = 0; k < m_kk; k++) { double xx = std::max(moleFractions_[k], SmallNumber); sbar[k] += - lnActCoeff_Scaled_[k] -log(xx) - T * dlnActCoeffdT_Scaled_[k]; } /* * dimensionalize it. */ for (size_t k = 0; k < m_kk; k++) { sbar[k] *= GasConstant; } }
void MixedSolventElectrolyte::getPartialMolarEnthalpies(doublereal* hbar) const { /* * Get the nondimensional standard state enthalpies */ getEnthalpy_RT(hbar); /* * dimensionalize it. */ double T = temperature(); double RT = GasConstant * T; for (size_t k = 0; k < m_kk; k++) { hbar[k] *= RT; } /* * Update the activity coefficients, This also update the * internally stored molalities. */ s_update_lnActCoeff(); s_update_dlnActCoeff_dT(); double RTT = RT * T; for (size_t k = 0; k < m_kk; k++) { hbar[k] -= RTT * dlnActCoeffdT_Scaled_[k]; } }
void MargulesVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const { double T = temperature(); s_update_dlnActCoeff_dT(); for (size_t iK = 0; iK < m_kk; iK++) { dlnActCoeffds[iK] = 0.0; } for (size_t i = 0; i < numBinaryInteractions_; i++) { size_t iA = m_pSpecies_A_ij[i]; size_t iB = m_pSpecies_B_ij[i]; double XA = moleFractions_[iA]; double XB = moleFractions_[iB]; double dXA = dXds[iA]; double dXB = dXds[iB]; double g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT(); double g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT(); const doublereal g02g1XB = g0 + 2*g1*XB; const doublereal g2XAdXB = 2*g1*XA*dXB; const doublereal all = (-XB * dXA - XA *dXB) * g02g1XB - XB *g2XAdXB; for (size_t iK = 0; iK < m_kk; iK++) { dlnActCoeffds[iK] += all + dlnActCoeffdT_Scaled_[iK]*dTds; } dlnActCoeffds[iA] += dXB * g02g1XB; dlnActCoeffds[iB] += dXA * g02g1XB + g2XAdXB; } }
void MargulesVPSSTP::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const { s_update_dlnActCoeff_dT(); for (size_t k = 0; k < m_kk; k++) { dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k]; } }
void RedlichKisterVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const { s_update_dlnActCoeff_dT(); s_update_dlnActCoeff_dX_(); for (size_t k = 0; k < m_kk; k++) { dlnActCoeffds[k] = dlnActCoeffdT_Scaled_[k] * dTds; for (size_t l = 0; l < m_kk; l++) { dlnActCoeffds[k] += dlnActCoeff_dX_(k, l) * dXds[l]; } } }
void MargulesVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const { // Get the nondimensional standard state enthalpies getEnthalpy_RT(hbar); // dimensionalize it. for (size_t k = 0; k < m_kk; k++) { hbar[k] *= RT(); } // Update the activity coefficients, This also update the internally stored // molalities. s_update_lnActCoeff(); s_update_dlnActCoeff_dT(); for (size_t k = 0; k < m_kk; k++) { hbar[k] -= RT() * temperature() * dlnActCoeffdT_Scaled_[k]; } }
void RedlichKisterVPSSTP::getPartialMolarCp(doublereal* cpbar) const { getCp_R(cpbar); double T = temperature(); // Update the activity coefficients, This also update the internally stored // molalities. s_update_lnActCoeff(); s_update_dlnActCoeff_dT(); for (size_t k = 0; k < m_kk; k++) { cpbar[k] -= 2 * T * dlnActCoeffdT_Scaled_[k] + T * T * d2lnActCoeffdT2_Scaled_[k]; } // dimensionalize it. for (size_t k = 0; k < m_kk; k++) { cpbar[k] *= GasConstant; } }
void MixedSolventElectrolyte::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const { int delAK, delBK; double XA, XB, g0, g1, dXA, dXB; double T = temperature(); double RT = GasConstant*T; //fvo_zero_dbl_1(dlnActCoeff, m_kk); s_update_dlnActCoeff_dT(); for (size_t iK = 0; iK < m_kk; iK++) { dlnActCoeffds[iK] = 0.0; for (size_t i = 0; i < numBinaryInteractions_; i++) { size_t iA = m_pSpecies_A_ij[i]; size_t iB = m_pSpecies_B_ij[i]; delAK = 0; delBK = 0; if (iA==iK) { delAK = 1; } else if (iB==iK) { delBK = 1; } XA = moleFractions_[iA]; XB = moleFractions_[iB]; dXA = dXds[iA]; dXB = dXds[iB]; g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT; g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT; dlnActCoeffds[iK] += ((delBK-XB)*dXA + (delAK-XA)*dXB)*(g0+2*g1*XB) + (delBK-XB)*2*g1*XA*dXB + dlnActCoeffdT_Scaled_[iK]*dTds; } } }
void RedlichKisterVPSSTP::getPartialMolarCp(doublereal* cpbar) const { /* * Get the nondimensional standard state entropies */ getCp_R(cpbar); double T = temperature(); /* * Update the activity coefficients, This also update the * internally stored molalities. */ s_update_lnActCoeff(); s_update_dlnActCoeff_dT(); for (size_t k = 0; k < m_kk; k++) { cpbar[k] -= 2 * T * dlnActCoeffdT_Scaled_[k] + T * T * d2lnActCoeffdT2_Scaled_[k]; } /* * dimensionalize it. */ for (size_t k = 0; k < m_kk; k++) { cpbar[k] *= GasConstant; } }