Closed yalinli2 closed 4 years ago
Ahh, yeah, I see the problem:
set_thermo
. Future versions of thermo will be more flexible/robust regarding this matter (so for now let's stick with this guideline).<Chemical>.load_free_energies()
to reload the free energy objects. For future versions we won't have to do this, but it'll be a while.This is how the code would look like:
import thermosteam as tmo
chems = tmo.Chemicals(['Water', 'Ethanol', 'CH4', 'HMF', 'Furfural'])
chems.HMF.Hfus = 19.8
chems.Furfural.Hfus = 14370
chems.HMF.copy_missing_slots_from(chems.Furfural)
chems.HMF.load_free_energies()
tmo.settings.set_thermo(chems)
ms_no_HMF = tmo.Stream('ms_no_HMF', units='kmol/hr', T=300, P=101325,
Water=4.649e+04, Ethanol=50, CH4=800, Furfural=0.5)
ms_with_HMF = tmo.Stream('ms_with_HMF', units='kmol/hr', T=300, P=101325,
Water=4.649e+04, Ethanol=50, CH4=800, Furfural=0.5,
HMF=0.5)
print('No HMF: '+str(ms_no_HMF.H))
# No HMF: 2382786.3922599712
print('With HMF: '+str(ms_with_HMF.H))
# With HMF: 2382794.990691943
# Note that this value is slightly higher cause it has HMF
An alternative is to set Hfus to the free energy objects directly (instead of running load_free_energies):
H = chems.HMF.H
H.g.Hfus = H.l.Hfus = 19.8
:)
👏 Aha! I see, thanks!!!
Description For the following code, I'm not sure why having HMF in the stream raises error when calculating enthalpy, especially when I used
copy_missing_slots_from
functionWhat confuses me most, is that in
return H_ref + H_int_T_ref_to_Tm_s + Hfus + Cn_l.integrate_by_T(Tm, T)
, seems likeHfus
is None (I let the function printH_ref
,H_int_T_ref_to_Tm_s
,Hfus
, andCn_l.integrate_by_T(Tm, T)
), but:All chemicals have Hfus
Environment: OS: macOS Catalina 10.15.4 biosteam: v2.12.8 thermosteam: v0.12.16
Thanks!!!