Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect calculation of Gibbs free energy in IdealSolidSolnPhase and BinarySolutionTabulatedThermo #1301

Closed
speth opened this issue May 31, 2022 · 0 comments · Fixed by #1442

Comments

@speth
Copy link
Member

speth commented May 31, 2022

Problem description

Calculations involving the calculation of Gibbs free energy when using the IdealSolidSolnPhase class (YAML name ideal-condensed) or BinarySolutionTabulatedThermo class (YAML name binary-solution-tabulated) give thermodynamically inconsistent results when the solution is not at the reference temperature and/or pressure.

>>> import cantera as ct
>>> p = ct.Solution('lithium_ion_battery.yaml', 'electrolyte')
>>> p.TP = 430, 5*101325
>>> p.gibbs_mole
-24597376.815229505
>>> p.enthalpy_mole - p.T * p.entropy_mole
-24567921.30990614
>>> sum(p.chemical_potentials * p.X)
-24567921.309906136

Since the latter two values are consistent, this suggests that the problem is in the gibbs_mole function itself.

Similar results are obtained for the binary-solution-tabulated model by replacing the phase setup steps with:

p = ct.Solution('lithium_ion_battery.yaml', 'anode')
p.TPX = 300, 10*101325, [0.2, 0.8]

System information

  • Cantera version: 2.6.0 or main at 8fbb4bc

Additional context

This was discovered as part of #1299, which implements Cantera/enhancements#114.

@speth speth changed the title Incorrect calculation of Gibbs free energy in IdealSolidSolnPhase Incorrect calculation of Gibbs free energy in IdealSolidSolnPhase and BinarySolutionTabulatedThermo Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant