Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving density for a pure component #33

Closed
dhkblaszyk opened this issue Jan 21, 2021 · 2 comments
Closed

Retrieving density for a pure component #33

dhkblaszyk opened this issue Jan 21, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@dhkblaszyk
Copy link

I would like to retrieve component properties for pure components (later to be expanded to mixtures). Below is a sample of the code I am using. For water I get pretty close, but for dextrose the value is way off. Anyone has a suggestion what I am doing wrong here?

import thermosteam as tmo

# define the chemicals object
chemicals = tmo.Chemicals(['Dextrose'])

# A Thermo object is built with an iterable of Chemicals or their IDs.
# Default mixture, thermodynamic equilibrium models are selected.
thermo = tmo.Thermo(chemicals)

# now set the thermo package
tmo.settings.set_thermo(thermo)

#now create a stream
s1 = tmo.Stream('feed', Dextrose=1, units='kg/hr')
s1.T = 273.15 + 25

s1.rho # Density [kg/m^3]

1088.3618978529837

Expected answer is 1600 according to https://www.chemsrc.com/en/cas/50-99-7_895097.html.

Am I correct to assume that thermosteam is using the chemicals package under the hood? Anyway for me to simplify this code? Having to create a stream to retrieve the density seems to be overkill.

@yoelcortes yoelcortes added the enhancement New feature or request label Jan 21, 2021
@yoelcortes
Copy link
Member

yoelcortes commented Jan 21, 2021

Thanks for the report! Please "pip install thermosteam==0.23.9" for the enhancements.

I added new methods in the Chemical object to leverage it's functionality. In particular, rho (density), Cp (specific heat capacity), alpha (thermal diffusivity), nu (kinematic viscosity), Pr (Prandtl number) and get_property methods for retrieving properties in different units of measure. Please checkout the documentation for examples.

As for the actual value of dextrose density, I added the density of the solid in thermosteam. Note in your code, streams default to the liquid phase, so what you're actually retrieving is the density of the liquid phase from generalized corrections correlations (https://chemicals.readthedocs.io/en/latest/chemicals.volume.html).

>>> from thermosteam import *
>>> Dextrose = Chemical('Dextrose')
>>> Dextrose.rho('s', 300, 101325) # New method
1600.0
>>> Dextrose.get_property('rho', 'g/cm3', 's', 300., 101325) # New method
1.600
>>> Dextrose.V.s # All models available for the solid
TPDependentModelHandle(T, P) -> V.s [m^3/mol]
[0] Constant
>>> Dextrose.V.l # Empirical correlations based on key chemical properties (not too useful for dextrose)
TPDependentModelHandle(T, P) -> V.l [m^3/mol]
[0] Yen Woods saturation
[1] Rackett
[2] Yamada Gunn
[3] Bhirud normal
[4] Townsend Hales
[5] COSTALD compressed

You can phase='s' in the stream, or phase='s' when you create the chemical to force thermosteam to only use solid phase models. Also, if no good model is available, you can define your own models too:

import thermosteam as tmo
from thermosteam.functional import rho_to_V
Dextrose = Chemical('Dextrose')
molar_volume = rho_to_V(1600, Dextrose.MW)
Dextrose.V.s.add_model(molar_volume, top_priority=True)

Feel free to close the issue if everything is working fine,
Thanks!

@dhkblaszyk
Copy link
Author

Thank you Yoel. It is working perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants