chmarti1 / PYroMat

PYroMat thermodynamic properties in Python
http://pyromat.org
Other
71 stars 13 forks source link

Sometimes state() can return NaN while leaving -1 in the quality array, which can be confusing. #47

Open jranalli opened 2 years ago

jranalli commented 2 years ago

One of our old documented bugs that was deemed to be a fix that should be handled later. Just migrating it here in github for better workflow now that 2.2 was released.

TestCode

w = pm.get('mp.H2O')

h = [1694.095, 4372, 4373]  # kJ/kg
p = [5, 100, 1000]  # bar
ans = w.state(h=h, p=p)  # expect ans['x'] = [0.5, -1, np.nan]

Former reply: The “right” way to handle this is to have _argparse maintain a separate index array that points to all out-of-bounds indices while it’s working. Then, at the final step, it should force NaN on all of those indices to all results. The tidiest way to do this would be to modify the _argparse structure so that there is only one return line and to modify _hybrid1 to return an out-of-bounds index list. I'm willing to do that, but I’d like to leave it for a later revision.