You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In following example file CAS is retrieved when chemics throws ValueError indicating unavailablity of said chemical in the database or it requires additional information (CAS reference)
import chemics as cm
formula = input("Chemical Formula e.g CH4, H3N, ClH = ")
press = float(input("Process pressure kPaA = "))
temp = float(input("Process temperature degC = "))
p = press*1000 # Absolute pressure [Pa]
tk = temp+273.15 # temperature of gas [K]
def out_():
mw = gas.molecular_weight
rho = gas.density()
cp = gas.heat_capacity()
k = gas.thermal_conductivity()
mu = gas.viscosity() / 1000
print(f'\n{formula} gas properites:')
print(f'molecular weight {mw:.2f} g/mol')
print(f'density {rho:.3f} kg/m³')
print(f'heat capacity {cp:.3f} J/(mol⋅K)')
print(f'thermal conductivity {k:.3f} W/(m⋅K)')
print(f'viscosity {mu:.3f} cP')
print('Note: in SI units 1 cP = 10⁻³ Pa⋅s = 1 mPa⋅s')
try:
gas = cm.Gas(formula, tk, p)
out_()
except Exception as error:
print(f'\n{error}')
try:
import cirpy as cir
name = input('Write gas full-name or formula = ')
cas_ = cir.resolve(name, 'cas')
if type(cas_)==list: # multiple cas retrieved
print('Possible CAS:', *cas_, sep='\n- ')
cas_f = input("Write proper CAS = ")
else:
print(f'\nPossible CAS: {cas_}')
cas_f = cas_
gas = cm.Gas(formula, tk, p, cas_number=cas_f)
out_()
except Exception as error:
print(f'\n{error}')
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
As per author request I am starting this thread
In following example file CAS is retrieved when
chemics
throwsValueError
indicating unavailablity of said chemical in the database or it requires additional information (CAS reference)Beta Was this translation helpful? Give feedback.
All reactions