drunsinn / pyXSteam

Python library for calculating properties of Steam and Water
Other
51 stars 18 forks source link

Wrong limit to compute the enthalpy #4

Closed sbatururimi closed 4 years ago

sbatururimi commented 4 years ago

In the enthalpy computation as a function of pressure and temperature , the pressure is limited to 100 instead of 1000 bars. Could you fix that please? https://github.com/drunsinn/pyXSteam/blob/07cce83feaaa6d6c95a74d822000c0d472d555aa/pyXSteam/RegionSelection.py#L19

elif (T <= 1073.15) and (T > 273.15) and (p <= 100) and (p > 0.000611):
drunsinn commented 4 years ago

Hello, sorry but I can't reproduce your problem. Can you give me a minimal example?

All internal functions like region_pT(p, T) expect the input values to be in ISO units. For the pleasure this would be MPa. I took a look at IAPWS R7-97 (which XSteam this is based on) and the boundary of 100 MPa is correct for selecting the region.

By using the parameter unitSystem while initializing you can select different input systems based on your need. This way the units are converted automatically. The following options are available: steamTable = XSteam(unitSystem=XSteam.UNIT_SYSTEM_MKS) for m/kg/sec/°C/bar/W or steamTable = XSteam(unitSystem=XSteam.UNIT_SYSTEM_FLS) for ft/lb/sec/°F/psi/btu or steamTable = XSteam(unitSystem=XSteam.UNIT_SYSTEM_BARE) for m/kg/sec/K/MPa/W

sbatururimi commented 4 years ago

@drunsinn thank you for your answer, I discovered the problem in my code (nan values sometimes) but I think there is another error in the above conditions according to http://www.iapws.org/relguide/IF97-Rev.pdf that is p should be <= 50 MPA for the first condition:

if (T > 1073.15) and (p <= 50) and (T < 2273.15) and (p > 0.000611):

instead of

if (T > 1073.15) and (p < 10) and (T < 2273.15) and (p > 0.000611):

https://github.com/drunsinn/pyXSteam/blob/07cce83feaaa6d6c95a74d822000c0d472d555aa/pyXSteam/RegionSelection.py#L17

drunsinn commented 4 years ago

Thank you, that is/was definitely an error! I have changed the value and updated the package. Should be fixed with commit a95cb67 PyPi has also been updated already.