# Category : Miscellaneous Language Source Code

Archive : LIBRY51.ZIP

Filename : LIBRY8.DOC

.pa

THERMODYNAMIC PROPERTIES

These thermodynamic property procedures are all derived from tabular data,

curve-fits, or first principles. All of the thermodynamic properties of steam

are consistent with Maxwell's relationships. This is not the case with the

work of some other programmers that I have seen; and it is CRUCIAL for

accurate, consistent thermodynamic analyses.

All of the steam properties are based on the Tables of Keenan, Keyes, Hill,

and Moore (published in 1969 by John Wyley and Sons). These are particularly

well suited to computerizing (which is something that I can't say about other

steam tables). I also have ASME and NBS steam properties; but because of the

inconsiderate way in which these regressions were done, these properties are

slower than a heard of snails crawling up Pike's Peak in a hailstorm and of

insufficiently greater accuracy to be worth the price in CPU time (I've never

heard of a steam plant operating at 120,000 psia feedwater pressure). All of

the steam properties are accurate to five or so figures or the limit of single

precision which is as accurate as the tables.

All of the moist air properties are based on the ASHRAE tables and are at

least as accurate as the tabulated values (in some cases like absolute

humidity they are more accurate than the tables). Note that wet-bulb

temperature is assumed to be the same as the adiabatic saturation temperature.

All quantities are in standard, useful units (not to be confused with Silly

Inane units).

.pa

QUICK LIST OF THERMODYNAMIC SUBROUTINES

CHNGP0... change air pressure

CPFOFT... constant pressure specific heat of saturated liquid water

CPGOFT... constant pressure specific heat of saturated vapor water

DVFOFT... dynamic viscosity of saturated liquid water

DVGOFT... dynamic viscosity of saturated vapor water

FCPM..... constant pressure specific heat of moist air

FDWA..... diffusion coefficient for water into air

FHTWB.... enthalpy of moist air from wet-bulb

FKM...... thermal conductivity of moist air

FMUM..... dynamic viscosity of moist air

FPSAT.... saturation pressure of steam

FPVDWB... partial pres. of water vapor in moist air from dry- and wet-bulb

FPWSAT... saturation partial pressure of water vapor in air

FRHDWB... relative humidity from dry- and wet-bulb

FRHOL.... density of liquid water at 1 atm.

FRHOM.... density of moist air

FSTW..... surface tension of water

FTDBHW... dry-bulb from enthalpy and humidity

FTDPDW... dew-point from dry- and wet-bulb

FTDWBW... dry-bulb from wet-bulb and humidity

FTDWRH... dry-bulb from wet-bulb and relative humidity

FTSAT.... saturation temperature of steam

FTWBH.... wet-bulb from enthalpy

FTWDBP... wet-bulb from dry-bulb and dew-point

FTWDRH... wet-bulb from dry-bulb and relative humidity

FTWSAT... saturation temperature from partial pressure

FWBDBW... wet-bulb from dry-bulb and humidity

FWDBRH... humidity from dry-bulb and relative humidity

FWDWB.... humidity from dry- and wet-bulb

FWSAT.... saturation humidity

STATE.... 2-character state indicator

TKFOFT... thermal conductivity of saturated liquid water

TKGOFT... thermal conductivity of saturated vapor water

TOFPH.... temperature etc. from pressure and enthalpy

TOFPS.... temperature etc. from pressure and entropy

TV2PHS... pressure, enthalpy, and entropy from temperature and volume

VOFTP.... volume from temperature and pressure

.pa

NAME: CHNGP0 (note zero "0" not oh "O")

PURPOSE: change air pressure

TYPE: subroutine (far external)

SYNTAX: CALL CHNGP0(P)

INPUT: P (REAL*4) pressure in psia

OUTPUT: none

NAME: CPFOFT

PURPOSE: constant pressure specific heat of saturated liquid water

TYPE: REAL*4 function (far external)

SYNTAX: CP=CPFOFT(T)

INPUT: T (REAL*4) temperature [F]

OUTPUT: CP (REAL*4) constant pressure specific heat [Btu/lbm/F]

NAME: CPGOFT

PURPOSE: constant pressure specific heat of saturated vapor water

TYPE: REAL*4 function (far external)

SYNTAX: CP=CPFOFT(T)

INPUT: T (REAL*4) temperature [F]

OUTPUT: CP (REAL*4) constant pressure specific heat [Btu/lbm/F]

NAME: DVFOFT

PURPOSE: dynamic viscosity of saturated liquid water

TYPE: REAL*4 function (far external)

SYNTAX: DV=DVFOFT(T)

INPUT: T (REAL*4) temperature [F]

OUTPUT: DV (REAL*4) dynamic viscosity [lbm/ft/hr]

NAME: DVGOFT

PURPOSE: dynamic viscosity of saturated vapor water

TYPE: REAL*4 function (far external)

SYNTAX: DV=DVGOFT(T)

INPUT: T (REAL*4) temperature [F]

OUTPUT: DV (REAL*4) dynamic viscosity [lbm/ft/hr]

NAME: FCPM

PURPOSE: constant pressure specific heat of moist air

TYPE: REAL*4 function (far external)

SYNTAX: CP=FCPM(T,W)

INPUT: T (REAL*4) temperature [F]

W (REAL*4) absolute humidity []

OUTPUT: CP (REAL*4) constant pressure specific heat [Btu/lbm/F]

NAME: FDWA

PURPOSE: diffusion coefficient for water into air

TYPE: REAL*4 function (far external)

SYNTAX: D=FDWA(T)

INPUT: T (REAL*4) temperature [F]

OUTPUT: D (REAL*4) diffusion coefficient [sq.ft/hr]

NAME: FHTWB

PURPOSE: enthalpy of moist air from wet-bulb

TYPE: REAL*4 function (far external)

SYNTAX: H=FHTWB(TWB)

INPUT: TWB (REAL*4) wet-bulb temperature [F]

OUTPUT: H (REAL*4) enthalpy [Btu/lbm-dry-air]

NAME: FKM

PURPOSE: thermal conductivity of moist air

TYPE: REAL*4 function (far external)

SYNTAX: TK=FKM(T,W)

INPUT: T (REAL*4) temperature [F]

W (REAL*4) absolute humidity []

OUTPUT: TK (REAL*4) thermal conductivity [Btu/hr/ft]

NAME: FMUM

PURPOSE: dynamic viscosity of moist air

TYPE: REAL*4 function (far external)

SYNTAX: DV=FMUM(T,W)

INPUT: T (REAL*4) temperature [F]

W (REAL*4) absolute humidity []

OUTPUT: DV (REAL*4) dynamic viscosity [lbm/ft/hr]

NAME: FPSAT

PURPOSE: saturation pressure of steam

TYPE: REAL*4 function (far external)

SYNTAX: PSAT=FPSAT(TSAT)

INPUT: TSAT (REAL*4) saturation temperature [F]

OUTPUT: PSAT (REAL*4) saturation pressure [psia]

NAME: FPVDWB

PURPOSE: partial pres. of water vap in moist air from dry- and wet-bulb

TYPE: REAL*4 function (far external)

SYNTAX: PV=FPVDWB(TDB,TWB)

INPUT: TDB (REAL*4) dry-bulb temperature [F]

TWB (REAL*4) wet-bulb temperature [F]

OUTPUT: PV (REAL*4) partial pressure [psia]

NAME: FPWSAT

PURPOSE: saturation partial pressure of water vapor in air

TYPE: REAL*4 function (far external)

SYNTAX: PW=FPWSAT(T)

INPUT: T (REAL*4) temperature [F]

OUTPUT: PW (REAL*4) saturation partial pressure [psia]

NAME: FRHDWB

PURPOSE: relative humidity from dry- and wet-bulb

TYPE: REAL*4 function (far external)

SYNTAX: RH=FRHDWB(TDB,TWB)

INPUT: TDB (REAL*4) dry-bulb temperature [F]

TWB (REAL*4) wet-bulb temperature [F]

OUTPUT: RH (REAL*4) relative humidity [%]

NAME: FRHOL

PURPOSE: density of liquid water at 1 atm.

TYPE: REAL*4 function (far external)

SYNTAX: D=FRHOL(T)

OUTPUT: D (REAL*4) density [lbm/cu.ft]

NAME: FRHOM

PURPOSE: density of moist air

TYPE: REAL*4 function (far external)

SYNTAX: D=FRHOM(P,TDB,W)

INPUT: P (REAL*4) pressure [psia]

TDB (REAL*4) dry-bulb temperature [F]

W (REAL*4) absolute humidity []

OUTPUT: D (REAL*4) density [lbm/cu.ft]

NAME: FSTW

PURPOSE: surface tension of water

TYPE: REAL*4 function (far external)

SYNTAX: S=FSTW(T)

INPUT: T (REAL*4) temperature [F]

OUTPUT: S (REAL*4) surface tension [lbf/ft]

NAME: FTDBHW

PURPOSE: dry-bulb from enthalpy and humidity

TYPE: REAL*4 function (far external)

SYNTAX: TDB=FTDBHW(H,W)

W (REAL*4) absolute humidity []

OUTPUT: TDB (REAL*4) dry-bulb temperature [F]

NAME: FTDPDW

PURPOSE: dew-point from dry- and wet-bulb

TYPE: REAL*4 function (far external)

SYNTAX: TDP=FTDPDW(TDB,TWB)

INPUT: TDB (REAL*4) dry-bulb temperature [F]

TWB (REAL*4) wet-bulb temperature [F]

OUTPUT: TDP (REAL*4) dew-point temperature [F]

NAME: FTDWBW

PURPOSE: dry-bulb from wet-bulb and humidity

TYPE: REAL*4 function (far external)

SYNTAX: TDB=FTDWBW(TWB,W)

INPUT: TWB (REAL*4) wet-bulb temperature [F]

W (REAL*4) absolute humidity []

OUTPUT: TDB (REAL*4) dry-bulb temperature [F]

NAME: FTDWRH

PURPOSE: dry-bulb from wet-bulb and relative humidity

TYPE: REAL*4 function (far external)

SYNTAX: TDB=FTDWRH(TWB,RH)

INPUT: TWB (REAL*4) wet-bulb temperature [F]

RH (REAL*4) relative humidity [%]

OUTPUT: TDB (REAL*4) dry-bulb temperature [F]

NAME: FTSAT

PURPOSE: saturation temperature of steam

TYPE: REAL*4 function (far external)

SYNTAX: TSAT=FTSAT(PSAT)

INPUT: PSAT (REAL*4) saturation pressure [psia]

OUTPUT: TSAT (REAL*4) saturation temperature [F]

NAME: FTWBH

PURPOSE: wet-bulb from enthalpy

TYPE: REAL*4 function (far external)

SYNTAX: TWB=FTWBH(H)

INPUT: H (REAL*4) enthalpy [Btu/lbm-dry-air]

OUTPUT: TWB (REAL*4) wet-bulb temperature [F]

NAME: FTWDBP

PURPOSE: wet-bulb from dry-bulb and dew-point

TYPE: REAL*4 function (far external)

SYNTAX: TWB=FTWDBP(TDB,TDP)

INPUT: TDB (REAL*4) dry-bulb temperature [F]

TDP (REAL*4) dew-point temperature [F]

OUTPUT: TWB (REAL*4) wet-bulb temperature [F]

NAME: FTWDRH

PURPOSE: wet-bulb from dry-bulb and relative humidity

TYPE: REAL*4 function (far external)

SYNTAX: TWB=FTWDRH(TDB,RH)

INPUT: TDB (REAL*4) dry-bulb temperature [F]

RH (REAL*4) relative humidity [%]

OUTPUT: TWB (REAL*4) wet-bulb temperature [F]

NAME: FTWSAT

PURPOSE: saturation temperature from partial pressure

TYPE: REAL*4 function (far external)

SYNTAX: TWS=FTWSAT(PWS)

INPUT: PWS (REAL*4) saturation partial pressure [psia]

OUTPUT: TWS (REAL*4) saturation temperature [F]

NAME: FWBDBW

PURPOSE: wet-bulb from dry-bulb and humidity

TYPE: REAL*4 function (far external)

SYNTAX: TWB=FWBDBW(TDB,W)

INPUT: TDB (REAL*4) dry-bulb temperature [F]

W (REAL*4) absolute humidity []

OUTPUT: TWB (REAL*4) wet-bulb temperature [F]

NAME: FWDBRH

PURPOSE: absolute humidity from dry-bulb and relative humidity

TYPE: REAL*4 function (far external)

SYNTAX: W=FWDBRH(TDB,RH)

INPUT: TDB (REAL*4) dry-bulb temperature [F]

RH (REAL*4) relative humidity [%]

OUTPUT: W (REAL*4) absolute humidity []

NAME: FWDWB

PURPOSE: humidity from dry- and wet-bulb

TYPE: REAL*4 function (far external)

SYNTAX: W=FWDWB(TDB,TWB)

INPUT: TDB (REAL*4) dry-bulb temperature [F]

TWB (REAL*4) wet-bulb temperature [F]

OUTPUT: W (REAL*4) absolute humidity []

NAME: FWSAT

PURPOSE: saturation humidity

TYPE: REAL*4 function (far external)

SYNTAX: WSAT=FWSAT(T)

INPUT: T (REAL*4) temperature [F]

OUTPUT: WSAT (REAL*4) saturation absolute humidity []

NAME: STATE

PURPOSE: 2-character state indicator

TYPE: CHARACTER*2 function (far external)

SYNTAX: ST=STATE(T,X)

INPUT: T (REAL*4) temperature [F]

X (REAL*4) quality []

OUTPUT: ST (CHARACTER*2) state (ie. CL,,SL, LV, SV, SH, SC)

NAME: TKFOFT

PURPOSE: thermal conductivity of saturated liquid water

TYPE: REAL*4 function (far external)

SYNTAX: TK=TKFOFT(T)

INPUT: T (REAL*4) temperature [F]

OUTPUT: TK (REAL*4) thermal conductivity [Btu/hr/ft]

NAME: TKGOFT

PURPOSE: thermal conductivity of saturated vapor water

TYPE: REAL*4 function (far external)

SYNTAX: TK=TKGOFT(T)

INPUT: T (REAL*4) temperature [F]

OUTPUT: TK (REAL*4) thermal conductivity [Btu/hr/ft]

NAME: TOFPH

PURPOSE: temperature etc. from pressure and enthalpy

TYPE: REAL*4 function (far external)

SYNTAX: CALL TOFPH(T,P,V,X,H,S)

INPUT: P (REAL*4) pressure [psia]

H (REAL*4) enthalpy [Btu/lbm]

OUTPUT: T (REAL*4) temperature [F]

V (REAL*4) specific volume [cu.ft/lbm]

X (REAL*4) quality []

S (REAL*4) entropy [Btu/lbm/R]

NAME: TOFPS

PURPOSE: temperature etc. from pressure and entropy

TYPE: REAL*4 function (far external)

SYNTAX: CALL TOFPS(T,P,V,X,H,S)

INPUT: P (REAL*4) pressure [psia]

S (REAL*4) entropy [Btu/lbm/R]

OUTPUT: T (REAL*4) temperature [F]

V (REAL*4) specific volume [cu.ft/lbm]

X (REAL*4) quality []

H (REAL*4) enthalpy [Btu/lbm]

NAME: TV2PHS

PURPOSE: pressure, enthalpy, and entropy from temperature and volume

TYPE: REAL*4 function (far external)

SYNTAX: CALL TV2PHS(T,V,P,H,S)

INPUT: T (REAL*4) temperature [F]

V (REAL*4) specific volume [cu.ft/lbm]

OUTPUT: P (REAL*4) pressure [psia]

H (REAL*4) enthalpy [Btu/lbm]

S (REAL*4) entropy [Btu/lbm/R]

NAME: VOFTP

PURPOSE: volume from temperature and pressure

TYPE: REAL*4 function (far external)

SYNTAX: CALL VOFTP(T,P,V,X,H,S,IOPT)

INPUT: T (REAL*4) temperature [F]

P (REAL*4) pressure [psia]

IOPT (INTEGER*2) option

IOPT=1 find saturated liquid properties

IOPT=2 find saturated vapor properties

IOPT=3 find properties outside vapor dome

IOPT=4 forces compressed liquid

IOPT=5 forces superheated vapor

OUTPUT: V (REAL*4) specific volume [cu.ft/lbm]

X (REAL*4) quality []

H (REAL*4) enthalpy [Btu/lbm]

S (REAL*4) entropy [Btu/lbm/R]

.ad LIBRY8A.DOC