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

Discrepancy in results mp1.py when calculating g via state() vs using g(). #104

Open
jranalli opened this issue Dec 17, 2024 · 0 comments
Open
Labels

Comments

@jranalli
Copy link
Collaborator

Some of the mp1 tests are failing when calculating g using the subst.state() function, but do fine when calculating subst.g(). The value returned by g() is consistent with the theoretical h-Ts value.

It happens to be for the test case in the multiphase region. I can see that you note in there # Gibbs energy is constant across an equilibrium phase transition. I think it would just boil down to a decision about how you'd really want that value to be produced. I have no opinion, because I am not well versed on the underlying theory here. The only thing I would have strong feelings about is that subst.state()['g'] should match subst.g().

Also of note this only fails for R-134 in the test code but passes for water, but that's only because of level of the tolerances. There is a small variance in the actual water data as well. In both cases the discrepancy is quite small though.

Code to demonstrate:

import pyromat as pm
subst = pm.get('mp.C2H2F4')
state = subst.state(p=5, x=0.5)
state['g']
# -89.32931659
state['h']-state['T']*state['s']
# -89.30886541
subst.g(p=5, x=0.5)
# -89.30886541
@jranalli jranalli changed the title Accuracy issue in mp1.py when calculating g via state. Discrepancy in results mp1.py when calculating g via state() vs using g(). Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant