/************************************************************************** * * GStar_R_calc(); * * This function calculates the standard state Gibbs free energy * for species, kspec, at the solution temperature TKelvin and * solution pressure, Pres. * * * Input * kglob = species global index. * TKelvin = Temperature in Kelvin * pres = pressure is given in units specified by if__ variable. * * * Output * return value = standard state free energy in units of Kelvin. */ double VCS_SPECIES_THERMO::GStar_R_calc(size_t kglob, double TKelvin, double pres) { char yo[] = "VCS_SPECIES_THERMO::GStar_R_calc "; double fe, T; fe = G0_R_calc(kglob, TKelvin); T = TKelvin; if (UseCanteraCalls) { AssertThrowVCS(m_VCS_UnitsFormat == VCS_UNITS_MKS, "Possible inconsistency"); size_t kspec = IndexSpeciesPhase; OwningPhase->setState_TP(TKelvin, pres); fe = OwningPhase->GStar_calc_one(kspec); double R = vcsUtil_gasConstant(m_VCS_UnitsFormat); fe /= R; } else { double pref = SS0_Pref; switch(SSStar_Model) { case VCS_SSSTAR_CONSTANT: break; case VCS_SSSTAR_IDEAL_GAS: fe += T * log( pres/ pref ); break; default: plogf("%sERROR: unknown SSStar model\n", yo); exit(EXIT_FAILURE); } } return fe; }
double VCS_SPECIES_THERMO::GStar_R_calc(size_t kglob, double TKelvin, double pres) { double fe = G0_R_calc(kglob, TKelvin); double T = TKelvin; if (UseCanteraCalls) { if (m_VCS_UnitsFormat != VCS_UNITS_MKS) { throw CanteraError("VCS_SPECIES_THERMO::GStar_R_calc", "Possible inconsistency"); } size_t kspec = IndexSpeciesPhase; OwningPhase->setState_TP(TKelvin, pres); fe = OwningPhase->GStar_calc_one(kspec); double R = vcsUtil_gasConstant(m_VCS_UnitsFormat); fe /= R; } else { double pref = SS0_Pref; switch (SSStar_Model) { case VCS_SSSTAR_CONSTANT: break; case VCS_SSSTAR_IDEAL_GAS: fe += T * log(pres/ pref); break; default: throw CanteraError("VCS_SPECIES_THERMO::GStar_R_calc", "unknown SSStar model"); } } return fe; }