Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Python library for calculating properties of Steam and Water

License

NotificationsYou must be signed in to change notification settings

drunsinn/pyXSteam

Repository files navigation

Original Released by Magnus Holmgren for Matlab and Excel:http://xsteam.sourceforge.net and/orhttp://www.x-eng.com

Atthis github repository you can find the/a matlab version.

A .NET implementation is availible thanks to the work of rogerlew here:XSteamNET.

XSteam provides (mostly) accurate steam and water properties from 0 -1000 bar and from 0 - 2000 °C according to theIAPWS release IF-97. Foraccuracy of the functions in different regions see IF-97 Page 4

Also includes thermal conductivity and viscosity, which are not part ofthe IF97 release.

Some effort has been made to include the refined function of more recent releasesand also functions for calculations on heavy water. This includes:

  • IAPWS R4
  • IAPWS R14

Contributors to pyXSteam

In chronological order:

  • IAPWS
  • Magnus Holmgren
  • drunsinn
  • mohit0749
  • gonmolina
  • xjtu-blacksmith

Requirements

There are no requirements for installing pyXSteam with Python 3.6 and up.

Tests require numpy, demos require numpy and matplotlib

Install

runpython3 setup.py install

To run unittests you need two additional packages:pytest andnumpy. After installing both, just run pytest inthe base directory. The tests use some fixed values from the documentation to make sure that every coefficientand formula works as intended.

To test if setup was successful, runpython3 bin/pyXSteamDemo.py. This will require numpy and matplotlib to be installed.

Nomenclature

All Functions follow the same naming schema: First the wanted property,then a underscore_, then the wanted input properties Example:t_ph is temperature as a function of pressure and enthalpy. For a listof valid functions se below:

PropertyDescription
tTemperature (°C or °F)
pPressure (bar or psi)
hEnthalpy (kJ/kg or btu/lb)
vSpecific volume (m3/kg or ft^3/lb)
rhoDensity (kg/m3 or lb/ft^3)
sSpecific entropy (kJ/(kg °C) or btu/(lb °F))
uSpecific internal energy (kJ/kg or btu/lb)
CpSpecific isobaric heat capacity (kJ/(kg °C) or btu/(lb °F))
CvSpecific isochoric heat capacity (kJ/(kg °C) or btu/(lb °F))
wSpeed of sound (m/s or ft/s)
myViscosity (N s/m^2 or lbm/ft/hr)
tcThermal Conductivity (W/(m °C) or btu/(h ft °F))
stSurface Tension (N/m or lb/ft)
xVapor fraction
vxVapor Volume Fraction

Usage

Simple Example:

from pyXSteam.XSteam import XSteamsteamTable = XSteam(XSteam.UNIT_SYSTEM_MKS)print(steamTable.hL_p(220.0))

By using the unitSystem Parameter, you can tell XSteam witch Unit System you are using.

steamTable = XSteam(XSteam.UNIT_SYSTEM_MKS) # m/kg/sec/°C/bar/WsteamTable = XSteam(XSteam.UNIT_SYSTEM_FLS) # ft/lb/sec/°F/psi/btusteamTable = XSteam(XSteam.UNIT_SYSTEM_BARE) # m/kg/sec/K/MPa/W

To enable logging, add the following lines to your code:

import logginglogging.basicConfig(level=logging.INFO)

or alternatively

import logginglogger = logging.getLogger('pyXSteam')logger.setLevel(logging.DEBUG)sh = logging.StreamHandler()sh.setFormatter(logging.Formatter('%(name)s - %(levelname)s - %(message)s'))logger.addHandler(sh)

Available Functions

Temperature

FunctionDescription
tsat_pSaturation temperature
t_phTemperature as a function of pressure and enthalpy
t_psTemperature as a function of pressure and entropy
t_hsTemperature as a function of enthalpy and entropy

Pressure

FunctionDescription
psat_tSaturation pressure
p_hsPressure as a function of h and s.
p_hrhoPressure as a function of h and rho. Very inaccurate for solid water region since it's almost incompressible!
pmelt_tPressure as a function of temperature along the melting curve. Optional parameter to select ice region
psubl_tPressure as a function of temperature along the sublimation curve.

Enthalpy

FunctionDescription
hV_pSaturated vapor enthalpy
hL_pSaturated liquid enthalpy
hV_tSaturated vapor enthalpy
hL_tSaturated liquid enthalpy
h_ptEnthalpy as a function of pressure and temperature
h_psEnthalpy as a function of pressure and entropy
h_pxEnthalpy as a function of pressure and vapor fraction
h_prhoEnthalpy as a function of pressure and density. Observe for low temperatures (liquid) this equation has 2 solutions
h_txEnthalpy as a function of temperature and vapor fraction

Specific volume

FunctionDescription
vV_pSaturated vapor volume
vL_pSaturated liquid volume
vV_tSaturated vapor volume
vL_tSaturated liquid volume
v_ptSpecific volume as a function of pressure and temperature
v_phSpecific volume as a function of pressure and enthalpy
v_psSpecific volume as a function of pressure and entropy

Density

FunctionDescription
rhoV_pSaturated vapor density
rhoL_pSaturated liquid density
rhoV_tSaturated vapor density
rhoL_tSaturated liquid density
rho_ptDensity as a function of pressure and temperature
rho_phDensity as a function of pressure and enthalpy
rho_psDensity as a function of pressure and entropy

Specific entropy

FunctionDescription
sV_pSaturated vapor entropy
sL_pSaturated liquid entropy
sV_tSaturated vapor entropy
sL_tSaturated liquid entropy
s_ptSpecific entropy as a function of pressure and temperature (Returns saturated vapor enthalpy if mixture)
s_phSpecific entropy as a function of pressure and enthalpy

Specific internal energy

FunctionDescription
uV_pSaturated vapor internal energy
uL_pSaturated liquid internal energy
uV_tSaturated vapor internal energy
uL_tSaturated liquid internal energy
u_ptSpecific internal energy as a function of pressure and temperature
u_phSpecific internal energy as a function of pressure and enthalpy
u_psSpecific internal energy as a function of pressure and entropy

Specific isobaric heat capacity

FunctionDescription
CpV_pSaturated vapor heat capacity
CpL_pSaturated liquid heat capacity
CpV_tSaturated vapor heat capacity
CpL_tSaturated liquid heat capacity
Cp_ptSpecific isobaric heat capacity as a function of pressure and temperature
Cp_phSpecific isobaric heat capacity as a function of pressure and enthalpy
Cp_psSpecific isobaric heat capacity as a function of pressure and entropy

Specific isochoric heat capacity

FunctionDescription
CvV_pSaturated vapor isochoric heat capacity
CvL_pSaturated liquid isochoric heat capacity
CvV_tSaturated vapor isochoric heat capacity
CvL_tSaturated liquid isochoric heat capacity
Cv_ptSpecific isochoric heat capacity as a function of pressure and temperature
Cv_phSpecific isochoric heat capacity as a function of pressure and enthalpy
Cv_psSpecific isochoric heat capacity as a function of pressure and entropy

Speed of sound

FunctionDescription
wV_pSaturated vapor speed of sound
wL_pSaturated liquid speed of sound
wV_tSaturated vapor speed of sound
wL_tSaturated liquid speed of sound
w_ptSpeed of sound as a function of pressure and temperature
w_phSpeed of sound as a function of pressure and enthalpy
w_psSpeed of sound as a function of pressure and entropy

Viscosity

FunctionDescription
my_ptViscosity as a function of pressure and temperature
my_phViscosity as a function of pressure and enthalpy
my_psViscosity as a function of pressure and entropy

Thermal Conductivity

FunctionDescription
tcL_pSaturated vapor thermal conductivity
tcV_pSaturated liquid thermal conductivity
tcL_tSaturated vapor thermal conductivity
tcV_tSaturated liquid thermal conductivity
tc_ptThermal conductivity as a function of pressure and temperature
tc_phThermal conductivity as a function of pressure and enthalpy
tc_hsThermal conductivity as a function of enthalpy and entropy

Surface tension

FunctionDescription
st_tSurface tension for two phase water/steam as a function of T
st_pSurface tension for two phase water/steam as a function of p

vapor fraction

FunctionDescription
x_phvapor fraction as a function of pressure and enthalpy
x_psvapor fraction as a function of pressure and entropy

vapor volume fraction

FunctionDescription
vx_phvapor volume fraction as a function of pressure and enthalpy
vx_psvapor volume fraction as a function of pressure and entropy

Pressure along the Melting and Sublimation Curves

FunctionDescription
pmelt_tPressure along the melting curve as a function of temperature
vx_psubl_tpsPressure along the sublimation curve as a function of temperature

Available Functions for Heavy Water

FunctionDescription
my_rhoTViscosity as a function of density and temperature
tc_rhoTThermal conductivity as a function of density and temperature

Development

  • pull requests are always wellcome!
  • code style is enforced by black

About

Python library for calculating properties of Steam and Water

Topics

Resources

License

Stars

Watchers

Forks

Contributors4

  •  
  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp