Skip to main content

A metapackage combining several computational tools based on Chemical, Biochemical, and Engineering Thermodynamics (5th edition) by Stan Sandler

Project description

Sandlertools

A metapackage of utilities from Sandler's 5th ed.

Sandlertools combines several packages that implement computational tools based on Chemical, Biochemical, and Engineering Thermodynamics (5th edition) by Stan Sandler (Wiley, USA). It should be used for educational purposes only.

Installation

Sandlertools is available via pip:

pip install sandlertools

This will install the following packages and wire their CLI's into sandlertools.

  • sandlerprops -- pure component properties database
  • sandlersteam -- steam tables
  • sandlercubics -- real-gas cubic equations of state
  • sandlercorrespondingstates -- corresponding-states chart reads
  • sandlermisc -- miscellaneous utilities

Usage

Command-line

The general structure of a sandlertools command is

$ sandlertools [<global-options>] <tool> [<tool-options>]

Currently available tools are

  • props: Pure-component property lookup
  • cubic: Cubic equations of state
  • steam: Steam-tables
  • cs: Corresponding states
$ sandlertools --help
usage: sandlertools [-h] [-b | --banner | --no-banner] [--logging-level {None,info,debug,warning}] [-l LOG] <command> ...

Sandler Tools: A collection of computational tools based on Chemical, Biochemical, and Engineering Thermodynamics (5th edition) by Stan Sandler

options:
  -h, --help            show this help message and exit
  -b, --banner, --no-banner
                        toggle banner message
  --logging-level {None,info,debug,warning}
                        Logging level for messages written to diagnostic log
  -l LOG, --log LOG     File to which diagnostic log messages are written

subcommands:
  <command>
    props               query and manipulate thermophysical property data
    cubic               query and manipulate cubic equation of state calculations
    steam               work with steam tables and properties of water/steam
    cs                  work with corresponding states calculations

sandlertools props

Below is an example of using sandlertools props to look up pure-component properties for benzene. We also show what happens if you try to look up a compound that is not in the database.

$ sandlertools props show benzene
Properties of benzene (index 343):
  No        : 343
  Formula   : C6H6
  Name      : benzene
  Molwt     :  78.114    g/mol
  Tfp       :  278.7     K
  Tb        :  353.2     K
  Tc        :  562.2     K
  Pc        :  48.90     bar
  Vc        :  259.000   m3/mol
  Zc        :  0.271
  Omega     :  0.212
  Dipm      : 0
  CpA       : -33.92     J/mol-K
  CpB       :  0.4739    J/mol-K2
  CpC       : -3.0170e-04 J/mol-K3
  CpD       :  7.1300e-08 J/mol-K4
  dHf       :  82980.0   J/mol
  dGf       :  129700.0  J/mol
  Eq        : 1
  VpA       : -6.98273
  VpB       :  1.33213
  VpC       : -2.62863
  VpD       : -3.33399
  Tmin      :  288.0     K
  Tmax      :  562.2     K
  Lden      :  0.885
  Tden      :  289.0
$ sandlertools props find nitrosamine
nitrosamine not found.  Here are similars:
nitromethane
bromine
difluoroamine
nitrous oxide
n-eicosane
dipropylamine
n-propyl amine
nitrogen
isopropyl amine
nitric oxide

sandlertools cubic

Below are examples of using sandlertools cubic to perform volumetric calculations for benzene using the Peng-Robinson, Van der Waals, and Ideal Gas equations of state.

$ sandlertools cubic state -T 800 -P 1.5 -n benzene -eos pr   
EOS  = pr
T    = 800.00 K
P    = 1.50 MPa
Z    = 0.97
v    = 0.004282 m3/mol
Hdep = -916.34 J/mol
Sdep = -0.86 J/mol-K
Tc    = 562.20 K
Pc    = 4.89 MPa
omega = 0.212
$ sandlertools cubic state -T 800 -P 1.5 -n benzene -eos vdw  
EOS  = vdw
T    = 800.00 K
P    = 1.50 MPa
Z    = 0.96
v    = 0.004268 m3/mol
Hdep = -691.82 J/mol
Sdep = -0.24 J/mol-K
Tc = 562.20 K
Pc = 4.89 MPa
$ sandlertools cubic state -T 800 -P 1.5 -n benzene -eos ideal
EOS = ideal
T   = 800.00 K
P   = 1.50 MPa
v   = 0.004434 m3/mol

sandlertools steam

Below is an example of using sandlertools steam to look up/interpolate properties in the steam tables.

$ sandlertools steam state -TC 404 -P 1.5
THERMODYNAMIC STATE OF UNSATURATED STEAM/WATER:
TC =  404.0 C =  677.1 K
P  =  1.50 MPa =  15.00 bar
u  =  2958.06 kJ/kg =  53290.3 J/mol
v  =  0.205216 m3/kg =  0.00369702 m3/mol
s  =  7.28203 kJ/kg-K =  131.188 J/mol-K
h  =  3264.54 kJ/kg =  58811.6 J/mol
$ sandlertools steam state --T 213 --x 0.5
THERMODYNAMIC STATE OF SATURATED STEAM/WATER:
TC =  213.0 C =  486.1 K
P  =  2.02 MPa =  20.25 bar
u  =  1754.78 kJ/kg =  31612.8 J/mol
v  =  0.0499079 m3/kg =  0.000899105 m3/mol
s  =  4.39471 kJ/kg-K =  79.1719 J/mol-K
h  =  1855.59 kJ/kg =  33428.9 J/mol
x  =  0.50 kg vapor/kg
uL =  909.096 kJ/kg =  16377.6 J/mol
uV =  2600.46 kJ/kg =  46848 J/mol
vL =  0.0011778 m3/kg =  2.12184e-05 m3/mol
vV =  0.098638 m3/kg =  0.00177699 m3/mol
sL =  2.45276 kJ/kg-K =  44.1872 J/mol-K
sV =  6.33666 kJ/kg-K =  114.157 J/mol-K
hL =  911.476 kJ/kg =  16420.5 J/mol
hV =  2799.7 kJ/kg =  50437.4 J/mol

sandlertools cs

Below is an example of using sandlertools cs to perform a volumetric state calculation on methane using Corresponding States.

$ sandlertools cs state -T 500 -P 15.5 -n methane
T    =  500.00 K
P    =  15.50 mpa
Tr   =  2.63
Pr   =  3.37
v    =  0.000260 m3/mol
Z    =  0.97
Hdep = -645.27 J/mol = -0.81 cal/mol-K
Sdep = -1.30 J/mol-K = -0.31 cal/mol-K

sandlertools cs can also perform change-of-state calculations, as demonstrated below:

sandlertools cs delta -T1 350 -P1 7.5 -T2 400 -P2 15.5 -n methane --show-states        
State 1:
T    =  350.00 K
P    =  7.50 mpa
Tr   =  1.84
Pr   =  1.63
v    =  0.000369 m3/mol
Z    =  0.95
Hdep = -621.37 J/mol = -0.78 cal/mol-K
Sdep = -1.55 J/mol-K = -0.37 cal/mol-K

State 2:
T    =  400.00 K
P    =  15.50 mpa
Tr   =  2.10
Pr   =  3.37
v    =  0.000204 m3/mol
Z    =  0.95
Hdep = -1043.59 J/mol = -1.31 cal/mol-K
Sdep = -2.30 J/mol-K = -0.55 cal/mol-K

Property differences:
Delta H = 1572.03 J/mol
Delta S = -1.47 J/mol-K
Delta U = 1177.09 J/mol

Constants used for calculations:
Tc  = 190.40 K
Pc  = 4.60 MPa
CpA = 19.25 J/mol-K
CpB = 5.213e-02 J/mol-K^2
CpC = 1.197e-05 J/mol-K^3
CpD = -1.132e-08 J/mol-K^4

API

sandlertools exposes several classes, objects, and functions from its component packages:

PropertiesDatabase

PropertiesDatabase is the pure-component properties database class from the sandlerprops.properties module.

>>> from sandlertools import PropertiesDatabase # equivalent to from sandlerprops.properties import PropertiesDatabase
>>> P = PropertiesDatabase()
>>> m = P.get_compound('methane')
>>> m.Molwt
16.043
>>> P.U.Molwt
'g/mol'
>>> m.Tc
190.4
>>> P.U.Tc
'K'
>>> e = P.get_compound('ethanz')
ethanz not found.  Here are similars:
ethane
methane
ethanol
methanol
ethyl amine
ethylene
methylal
methyl amine
ethylbenzene
nitromethane

SandlerSteamState

SandlerSteamState is the State class from the sandlersteam.state module.

>>> from sandlertools import SandlerSteamState as State # equivalent to from sandlersteam.state import State
>>> state1 = State(TC=100.0, P=0.1)
>>> state1.h.item()  # enthalpy in kJ/kg as a np.float64
2676.2
>>> state1.u.item()  # internal energy in kJ/kg
2506.7
>>> state1.v.item()  # volume in m3/kg
1.6958
>>> state1.s.item()  # entropy in kJ/kg-K
7.3614

IdealGasEOS, GeneralizedVDWEOS, and PengRobinsonEOS

>>> from sandlertools import PengRobsinsonEOS
>>> from sandlertools import PropertiesDatabase
>>> db = ProperitesDatabase()
>>> m = db.get_compound('methane')
>>> s1 = PengRobinsonEOS(Tc=m.Tc, Pc=m.Pc/10, omega=m.Omega)
>>> s1.T = 400
>>> s1.P = 0.5
>>> s1.v.item()  # it is a np float
0.0066279171348771915

CorrespondingStatesChartReader

CorrespondingStatesChartReader is the chart-reader class from the sandlercorrespondingstates.charts module.

>>> from sandlertools import CorrespondingStatesChartReader, GasConstant, PropertiesDatabase
>>> db = PropertiesDatabase()
>>> component = db.get_compound('methane')
>>> cs = CorrespondingStatesChartReader()
>>> Rpv = GasConstant("bar", "m3")
>>> result = cs.dimensionalized_lookup(T=400, P=0.5, Tc=component.Tc, Pc=component.Pc/10, R_pv=Rpv)
>>> print(result.report())
T  =  400.00 K
P  =  7.50 mpa
Tc =  190.40 K
Pc =  4.60 mpa
Tr =  2.10
Pr =  1.63
v  =  0.000435 m3/mol
Z  =  0.98
Hdep = -438.15 J/mol = -0.55 cal/mol-K
Sdep = -1.13 J/mol-K = -0.27 cal/mol-K

Miscellaneous

The GasConstant class is from the sandlermisc.gas_constant module. The DeltaH_IG and DeltaS_IG functions are from the sandlermisc.thermals module.

Release History

  • 0.2.0
    • updated readme
  • 0.1.0
    • Initial release

Meta

Cameron F. Abrams – cfa22@drexel.edu

Distributed under the MIT license. See LICENSE for more information.

https://github.com/cameronabrams

Contributing

  1. Fork it (https://github.com/cameronabrams/sandlertools/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sandlertools-0.2.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sandlertools-0.2.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file sandlertools-0.2.0.tar.gz.

File metadata

  • Download URL: sandlertools-0.2.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sandlertools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 36890e052ae8628999319e8d668442984f84a3a14fc847c72bb9e04321510bd6
MD5 8647e913849f086e05e5891ec3a528bc
BLAKE2b-256 9eb3702e4d85fc35291c86698fc0c06aae2ba631e55d08008680d1fe3461d6f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for sandlertools-0.2.0.tar.gz:

Publisher: release.yaml on cameronabrams/sandlertools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sandlertools-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sandlertools-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sandlertools-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0226262706e62754f14da3fc3bd3f1d36a2de83aff14821394653e38c325fd54
MD5 b2d057d0dd409945928dae4e3b12c3f8
BLAKE2b-256 44276c278d2640e6ab8e8969342646ce9443a471bf446b2c3b46331dedf28e7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sandlertools-0.2.0-py3-none-any.whl:

Publisher: release.yaml on cameronabrams/sandlertools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page