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

IdealSolnGasVPSS constant volume heat capacity is implemented incorrectly #1317

Open
speth opened this issue Jun 6, 2022 · 0 comments
Open

Comments

@speth
Copy link
Member

speth commented Jun 6, 2022

Problem description

The values returned by cv_mole for the IdealSolnGasVPSS class (YAML thermo model name ideal-solution-VPSS) are inconsistent with the values of du/dT and T * ds/dT that can be calculated for the phase.

Steps to reproduce

import cantera as ct
p = ct.Solution('test/data/IdealSolidSolnPhaseExample.yaml', 'VpssSolidSolutionExample')
p.TPX = 400, ct.one_atm, (0.2, 0.5, 0.3)
u1 = p.int_energy_mole
s1 = p.entropy_mole
cv1 = p.cv_mole
dT = 0.01
p.TP = p.T + dT, None # note density is always constant
u2 = p.int_energy_mole
s2 = p.entropy_mole
cv2 = p.cv_mole

print('from cv:', 0.5 * (cv1 + cv2))
print('from s:', (s2-s1)/dT * p.T)
print('from u:', (u2-u1)/dT)

Behavior

The three printed values should be approximately equal. Instead:

from cv: 20962.996655728406
from s: 29277.825241200073
from u: 29277.459274418652

It is "interesting" that the difference between the value calculated by cv_mole and the other two is ~8314.4 J/mol, or approximately equal to the gas constant.

System information

  • Cantera version: 2.6.0 or main at 1ab81ac

Additional context

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

This error seems to be nearly identical to the one affecting the Margules phase (#1308), but these classes are only loosely related in terms of their implementations, so I think it will require a separate fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

1 participant