chmarti1 / PYroMat

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

Custom units ignored by igmix #39

Closed danieljuschus closed 2 years ago

danieljuschus commented 2 years ago

In 2.1.10,

import pyromat as pm
pm.config["unit_molar"] = "mol"
o2 = pm.get("ig.O2")
o2.mw()

yields 0.032 kg/mol, which is correct. However:

air = pm.get("ig.air")
air.mw()

yields 28964 which is the correct numerical value, but seems to be in units of g/kmol. This is even more confusing, because pm.config["unit_mass"] indicates kg as the unit used.

So far I've been using 2.0.12, where this wasn't a problem. Just now, I upgraded to the latest version of pyromat, and this problem appeared.

chmarti1 commented 2 years ago

Confirmed. You've found a bug that seems to be restricted to the mw() method of the igmix class that appeared when I rewrote most of the igmix class in the last update. The new code incorrectly applies the molar conversion to the numerator instead of the denominator of the molecular weight property. I'm finalizing version 2.2.0 for release now. I'll fold this fix in with those changes.