Skip to main content

The high-speed IAPWS-IF97 package in Rust with Python bindings

Project description

SEUIF97

The version of seuif97 2 is the Python API of the high-speed IAPWS-IF97 package in Rust. It is suitable for computation-intensive calculations, such as heat cycle calculations, simulations of non-stationary processes, real-time process monitoring and optimizations.

Through the high-speed package, the results of the IAPWS-IF97 are accurately produced at about 5-20x speed-up compared to using the powi() of the Rust standard library in the for loop directly when computing the basic equations of Regions 1, 2, and 3.

Acceleration Methods

  • Loop Tiling Method: Unleashes the full power of compiler optimizations, surpassing the performance of the single loop.

  • Recurrence Method for Multi-Polynomial Evaluation: By leveraging the relationship between polynomials and their derivatives, only a single polynomial needs to be computed directly. The remaining values are derived via multiplication or division by the base. This approach eliminates redundant calculations and significantly improves performance.

Input Pairs and Properties

In the package, 36 thermodynamic, transport and further properties can be calculated.

The following 12 input pairs are implemented:

  (p,t) (p,h) (p,s) (p,v) 
  
  (p,x) (t,x) (h,x) (s,x) 

  (t,h) (t,s) (t,v) 

  (h,s)

Functions

The two types of functions are provided in the package.

  1. the input property pairs and the property ID(o_id) to get the value of the specified property

  2. the input property pairs to get one of p,t,h,s,v or x directly

The input property pairs and the property ID

  ??(in1,in2,o_id)
  • the first, second input parameters: the input property pairs
  • the third input parameters: the property ID of the calculated property - o_id
  • the return: the calculated property value of o_id
pt(p,t,o_id)
ph(p,h,o_id)
ps(p,s,o_id)
pv(p,v,o_id)

th(t,h,o_id)
ts(t,s,o_id)
tv(t,v,o_id)

hs(h,s,o_id)

px(p,x,o_id)
tx(p,x,o_id)
hx(h,x,o_id)
sx(s,x,o_id)

The input property pairs

  ??2?(in1,in2)
  • the ? in 2? is the one of p,t,h,s,v or x
pt2h(p, t)  pt2s(p, t)  pt2v(p, t)  pt2x(p, t)
ph2t(p, h)  ph2s(p, h)  ph2v(p, h)  ph2x(p, h)   
ps2t(p, s)  ps2h(p, s)  ps2v(p, s)  ps2x(p, s)  
pv2t(p, v)  pv2h(p, v)  pv2s(p, v)  pv2x(p, v)  

hs2p(h, s)  hs2t(h, s)  hs2v(h, s)  hs2x(h, s)    

th2p(t, h)  th2s(t, h)  th2v(t, h)  th2x(t, h)   
ts2p(t, s)  ts2h(t, s)  ts2v(t, s)  ts2x(t, s)  
tv2p(t, v)  tv2h(t, v)  tv2s(t, v)  tv2x(t, v)  

px2t(p, x)  px2h(p, x)  px2s(p, x)  px2v(p, x)
tx2p(t, x)  tx2h(t, x)  tx2s(t, x)  tx2v(t, x)

hx2p(h, x)  hx2t(h, x)  hx2s(h, x)  hx2v(h, x)
sx2p(s, x)  sx2t(s, x)  sx2h(s, x)  sx2v(s, x)

Example

from seuif97 import *

OH=4

p=16.0
t=535.1
# ??(in1,in2,o_id)
h=pt(p,t,OH)
# ??2?(in1,in2)
s=pt2s(p,t)
print(f"p={p}, t={t} h={h:.3f} s={s:.3f}")

Examples

T-S Diagram

Properties

Property Unit Symbol o_id o_id(i32)
Pressure MPa p OP 0
Temperature °C t OT 1
Density kg/m³ ρ OD 2
Specific Volume m³/kg v OV 3
Specific enthalpy kJ/kg h OH 4
Specific entropy kJ/(kg·K) s OS 5
Specific exergy kJ/kg e OE 6
Specific internal energy kJ/kg u OU 7
Specific isobaric heat capacity kJ/(kg·K) cp OCP 8
Specific isochoric heat capacity kJ/(kg·K) cv OCV 9
Speed of sound m/s w OW 10
Isentropic exponent k OKS 11
Specific Helmholtz free energy kJ/kg f OF 12
Specific Gibbs free energy kJ/kg g OG 13
Compressibility factor z OZ 14
Steam quality x OX 15
Region r OR 16
Isobaric cubic expansion coefficient 1/K ɑv OEC 17
Isothermal compressibility 1/MPa kT OKT 18
Partial derivative (∂V/∂T)p m³/(kg·K) (∂V/∂T)p ODVDT 19
Partial derivative (∂V/∂p)T m³/(kg·MPa) (∂v/∂p)T ODVDP 20
Partial derivative (∂P/∂T)v MPa/K (∂p/∂T)v ODPDT 21
Isothermal throttling coefficient kJ/(kg·MPa) δt OIJTC 22
Joule-Thomson coefficient K/MPa μ OJTC 23
Dynamic viscosity Pa·s η ODV 24
Kinematic viscosity m²/s ν OKV 25
Thermal conductivity W/(m.K) λ OTC 26
Thermal diffusivity m²/s a OTD 27
Prandtl number Pr OPR 28
Surface tension N/m σ OST 29
Static Dielectric Constant ε OSDC 30
Isochoric pressure coefficient 1/K β OPC 31
Isothermal stress coefficient kg/m³ βp OBETAP 32
Fugacity coefficient fi OFI 33
Fugacity MPa f* OFU 34
Relative pressure coefficient 1/K αp OAFLAP 35

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

seuif97-2.3.3.tar.gz (182.4 kB view details)

Uploaded Source

Built Distributions

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

seuif97-2.3.3-cp314-cp314-win_amd64.whl (231.4 kB view details)

Uploaded CPython 3.14Windows x86-64

seuif97-2.3.3-cp314-cp314-manylinux_2_34_x86_64.whl (374.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

seuif97-2.3.3-cp314-cp314-macosx_11_0_arm64.whl (329.7 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

File details

Details for the file seuif97-2.3.3.tar.gz.

File metadata

  • Download URL: seuif97-2.3.3.tar.gz
  • Upload date:
  • Size: 182.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for seuif97-2.3.3.tar.gz
Algorithm Hash digest
SHA256 4dcbfab479458e1558a0823caa80e0572706502e83e30b8ba3c75873ed815a6e
MD5 91390c22b310db3d94fd9366a0430fd7
BLAKE2b-256 c963c78ed1be2bc51f9329a862ef17346bd585262886658760175c805e3c3f4e

See more details on using hashes here.

File details

Details for the file seuif97-2.3.3-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: seuif97-2.3.3-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 231.4 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for seuif97-2.3.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 5dec8a4a51c520d775c48a8daa03def23fb61bf2d1e8f7fdc57cc30d3b2ce319
MD5 6f8f96711b1886fdd962f3a63e0a25bc
BLAKE2b-256 0bbb9455d949a50a26964bc2fefd20eece10b3159df0451b57040c9dcb3c3f85

See more details on using hashes here.

File details

Details for the file seuif97-2.3.3-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for seuif97-2.3.3-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2bd688111967b07c1043606ec8d65ced1ab26eab22705a6a3ce1ab5bfb9d98bd
MD5 5d05ec36bee5c84547010fa6554e2fa3
BLAKE2b-256 143020e14b769e9fa98ee96f1d296e84f8c396de60b7f9a301d0c3e8f70cad0b

See more details on using hashes here.

File details

Details for the file seuif97-2.3.3-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for seuif97-2.3.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1dea438464b69f43dfae58f925a193358e2ba4f6a27ae9a4be0243131594ebb5
MD5 288a89392b035af6708799e486cd8eff
BLAKE2b-256 9317e88752041c82fac5cdd10ad323c65ebfe9b5500a0807f5c73ae992a74089

See more details on using hashes here.

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