BioSTEAMDevelopmentGroup / thermosteam

BioSTEAM's Premier Thermodynamic Engine
Other
57 stars 12 forks source link

Volume calculation #10

Closed yalinli2 closed 4 years ago

yalinli2 commented 4 years ago

Description I think there might be problems with how thermosteam calculates stream volumes. I found this when trying to calculate concentration of certain compounds in kg/L, then realize that volume/density is off.

For example, run the following codes:

from biorefineries.cornstover.system import H301
stream = H301.outs[0]
print('Temperature of H301 output is ' + str(stream.T) + ' K \n')

stream_density_kgL = round(stream.F_mass/(stream.F_vol*1000), 3)
print('Density of H301 output at ' + str(stream.T) + ' K is ' + str(stream_density_kgL) + ' kg/L \n')
stream.show(N=100, composition=True, flow='kg/hr')

import thermosteam as tmo
thermo = tmo.Chemicals(['Water'])
tmo.settings.set_thermo(thermo)
s1 = tmo.Stream('s1', Water=1000, units='kg/hr', T=298.15)
s2 = s1.copy()
s2.T = 321.15

s1_density_kgL = round(s1.F_mass/(s1.F_vol*1000), 3)
s2_density_kgL = round(s2.F_mass/(s2.F_vol*1000), 3)
print('\n')
print('Density of water at ' + str(s1.T) + ' K is ' + str(s1_density_kgL) + ' kg/L \n')
print('Density of water at ' + str(s2.T) + ' K is ' + str(s2_density_kgL) + ' kg/L')

My output:

Screen Shot 2020-04-06 at 8 35 00 PM

My questions:

  1. The stream (output of H301) is ~70% water in liquid phase with the rest being solids (i.e., minimum organic solvents), why the density is only 0.153 kg/L?
  2. In the case of water density at 298.15 and 321.15 K, why density of water increases? Shouldn't it decrease when it's above 4°C?

Environment python: v3.7.6 OS: macOS Catalina 10.15.3 biosteam: v2.11.0 thermosteam: v.0.9.0 biorefineries: v2.8.0

Thanks!!!

yoelcortes commented 4 years ago
  1. The density is so small because the phase of NH3 is locked as a gas. To fix this, you could remove the line that locks NH3 as a gas in your "chemicals.py" script. You would also have to make sure to add key properties that are missing

  2. Some volume models work better for some liquids than with others (e.g. polar vs non-polar). For water in particular, I believe the best one to use is "Campbell_Thodos":

    >>> from thermosteam import Chemical, functional as fn
    >>> Water = Chemical('Water')
    >>> Water.V.l
    TPDependentModelHandle(T, P) -> V.l [m^3/mol]
    [0] VDI_PPDS
    [1] Yen_Woods
    [2] Rackett
    [3] Yamada_Gunn
    [4] Bhirud_Normal
    [5] Townsend_Hales
    [6] Rackett
    [7] SNM0
    [8] Campbell_Thodos
    [9] CRC_inorganic_liquid_constant
    [10] Rackett
    [11] Costald
    [12] Costald_Compressed
    >>> Water.V.l.models.rotate(-8) # switch model to Campbell_Thodos
    >>> V_298 = Water.V('l', 298.15, 101325)
    >>> fn.V_to_rho(V_298, Water.MW)
    999.2786185445884
    >>> V_350 = Water.V('l', 350, 101325)
    >>> fn.V_to_rho(V_350, Water.MW)
    966.0898522462588
yalinli2 commented 4 years ago

Oh wow I never thought 0.4% of NH3 could make such a big difference, thanks a bunch!!!

yoelcortes commented 4 years ago

Quick update: There were some problems with the VDI_PPDS method. But its fixed now. Its actually a pretty good method for water too.

yalinli2 commented 4 years ago

Ah I see, yes indeed it's giving good results now, thanks!!!