wigging / chemics

A Python package for chemical engineering
https://chemics.readthedocs.io
MIT License
169 stars 15 forks source link

ValueError: Gas viscosity for NH3 is not available. #28

Closed defencedog closed 1 year ago

defencedog commented 1 year ago

chemic_gasrho.zip Need to update database I suppose

File /data/data/com.termux/files/usr/lib/python3.9/site-packages/chemics/gas_viscosity.py:147, in mu_gas(formula, temp, cas, full)
    144     return mu
    146 else:
--> 147     raise ValueError(f'Gas viscosity for {formula} is not available.')
ValueError: Gas viscosity for NH3 is not available.
wigging commented 1 year ago

Use H3N instead of NH3 for ammonia.

import chemics as cm
mu = cm.mu_gas('H3N', 900)
print('mu is', mu)

This prints the following:

mu is 319.14247215113517
defencedog commented 1 year ago

Thanks, So Chemical names are alphabetically arranged? Should I write ClH instead of HCl ?

wigging commented 1 year ago

Yes, it looks like most of the chemical formulas in the Yaw's data are alphabetically listed. So for HCl you should use cm.mu_gas('ClH', 900). You can look up formulas in PubChem to see their alternate spelling. Another approach is to use the CAS number, but chemics only uses this if there are similar formulas in the database. I should fix it such that if the CAS number is given, then it overrides the formula. That way you could just provide the CAS number without the formula.

defencedog commented 1 year ago

The gas viscosity is also pressure dependant but the function only takes temperature as input. Please elaborate.

wigging commented 1 year ago

The mu_gas() function is only temperature dependent because it is calculated from coefficients in Yaws’ Critical Property Data for Chemical Engineers and Chemists. See the Chemics documentation for more information about the function.