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

Problem with IAPWS97 #78

Open
bemoore99 opened this issue Feb 5, 2025 · 4 comments
Open

Problem with IAPWS97 #78

bemoore99 opened this issue Feb 5, 2025 · 4 comments

Comments

@bemoore99
Copy link

I have been validating the IAPWS97 code against data published by IAPWS for the purpose of validating computer code implementation. Data is in this report

The International Association for the Properties of Water and Steam
Lucerne, Switzerland
August 2007
Revised Release on the IAPWS Industrial Formulation 1997
for the Thermodynamic Properties of Water and Steam
(The revision only relates to the extension of region 5 to 50 MPa)
The International Association for the Properties of Water and Steam

The routine iapws.IAPWS97 does not return the values published in Table 18 of this report (it does return essentially identical values for other similar tables). I checked the data in Table 18 against other commercial implementation of this code, and that software produced erros as well. However, the implementation on the IAPWS website at this link reproduced Table 18 - http://twt.mpei.ac.ru/mcs/worksheets/iapws/IAPWS-IF97-Region2.xmcd.

I'm wondering if there was some error in the publication which has been addressed by subsequent errata which is not addressed in your code.

@jjgomera
Copy link
Owner

jjgomera commented Feb 5, 2025

Hi,
That table is calculated for a different correlation specific for the metastable-vapor region, so, you need use it to get the corrected values in table, in fact, that table is used in testing of library

https://github.com/jjgomera/iapws/blob/master/test.py#L568

If you use the input values in IAPWS97 class, you dont get the values of the table, you get the values of the stable phase at that conditions, the liqpuid phase, to get the metastable-vapor properties you must use directly the specific correlation

@bemoore99
Copy link
Author

bemoore99 commented Feb 6, 2025 via email

@jjgomera
Copy link
Owner

jjgomera commented Feb 6, 2025

Hi, Bernie,

Juan,

Thanks for the prompt reply. Here is an example of how I am using the iapws
code

# Define pressure (MPa) and temperature (°C)
P = 5.0
T = 300 + 273.15  # Temperature in °C
x = iapws.IAPWS97(T=T, P = P)

My interpretation of the documentation is that this IAPWS97 class can
accept combinations of P, T, X etc. and then internally will determine
which region the input falls into and then will use the appropriate code
for the applicable region. Under this assumption the results from all the
other data tables are correctly reproduced. Is this correct use of the
class, and it so is this meta-stable region an exception. I have not gone
through the code for this class but will do so. if not, then do I need to
write code which evaluates the T and P input value and then selects which
Region to use for the calculations

Your right, metastable states are not added in IAPWS97, you must use it directly to get properties in that metastable state

In [1]: from iapws.iapws97 import _Region2_meta

In [2]: st = _Region2_meta(450, 1)

In [3]: st
Out[3]: 
{'T': 450,
 'P': 1,
 'v': 0.1925165400597291,
 'h': 2768.811151116923,
 's': 6.566603768617397,
 'cp': 2.7634926495107943,
 'cv': 1.958307301714166,
 'w': 498.40810066232143,
 'alfav': 0.0031881982400282847,
 'kt': 1.0936423860609599,
 'region': 2,
 'x': 1}

@bemoore99
Copy link
Author

bemoore99 commented Feb 7, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants