matplotlib

Previous topic

Plots Package

This Page

State Module

class CoolProp.State.State

State(Fluid, dict StateDict, phase=None)

A class that contains all the code that represents a thermodynamic state

The motivation for this class is that it is useful to be able to define the state once using whatever state inputs you like and then be able to calculate other thermodynamic properties with the minimum of computational work.

Let’s suppose that you have inputs of pressure and temperature and you want to calculate the enthalpy and pressure. Since the Equations of State are all explicit in temperature and density, each time you call something like:

h = Props('H','T',T','P',P,Fluid)
s = Props('S','T',T','P',P,Fluid)

the solver is used to carry out the T-P flash calculation. And if you wanted entropy as well you could either intermediately calculate T, rho and then use T, rho in the EOS in a manner like:

rho = Props('D','T',T','P',P,Fluid)
h = Props('H','T',T','D',rho,Fluid)
s = Props('S','T',T','D',rho,Fluid)

Instead in this class all that is handled internally. So the call to update sets the internal variables in the most computationally efficient way possible

Parameters:
  • string (phase,) –
  • dictionary (StateDict,) – The state of the fluid - passed to the update function
  • string – The phase of the fluid, it it is known. One of Gas,``Liquid``,``Supercritical``,``TwoPhase``
Fluid
Phase(self) → long

Returns an integer flag for the phase of the fluid, where the flag value is one of iLiquid, iSupercritical, iGas, iTwoPhase

These constants are defined in the phase_constants module, and are imported into this module

Prandtl

The Prandtl number (cp*mu/k) [-]

Props(self, long iOutput) → double
Q

The quality [-]

T

The temperature [K]

Tsat

The saturation temperature (dew) for the given pressure, in [K]

__reduce__(self)
__str__

Return a string representation of the state

copy(self) → State

Make a copy of this State class

cp

The specific heat at constant pressure [kJ/kg/K]

cv

The specific heat at constant volume [kJ/kg/K]

dpdT
get_MM(self) → double

Get the mole mass [kg/kmol] or [g/mol]

get_Q(self) → double

Get the quality [-]

get_T(self) → double

Get the temperature [K]

get_Tsat(self, double Q=1)

Get the saturation temperature, in [K]

Returns None if pressure is not within the two-phase pressure range

get_cond(self) → double

Get the thermal conductivity, in [kW/m/K]

get_cp(self) → double

Get the specific heat at constant pressure [kJ/kg/K]

get_cp0(self) → double

Get the specific heat at constant pressure for the ideal gas [kJ/kg/K]

get_cv(self) → double

Get the specific heat at constant volume [kJ/kg/K]

get_dpdT(self) → double
get_h(self) → double

Get the specific enthalpy [kJ/kg]

get_p(self) → double

Get the pressure [kPa]

get_rho(self) → double

Get the density [kg/m^3]

get_s(self) → double

Get the specific enthalpy [kJ/kg/K]

get_speed_sound(self) → double

Get the speed of sound [m/s]

get_subcooling(self)

Get the amount of subcooling below the saturation temperature corresponding to the pressure, in [K]

Returns None if pressure is not within the two-phase pressure range

get_superheat(self)

Get the amount of superheat above the saturation temperature corresponding to the pressure, in [K]

Returns None if pressure is not within the two-phase pressure range

get_u(self) → double

Get the specific internal energy [kJ/kg]

get_visc(self) → double

Get the viscosity, in [Pa-s]

h

The specific enthalpy [kJ/kg]

is_CPFluid
k

The thermal conductivity, in [kW/m/K]

p

The pressure [kPa]

phase
rho

The density [kg/m^3]

s

The specific enthalpy [kJ/kg/K]

set_Fluid

State.set_Fluid(signatures, args, kwargs, defaults)

speed_test(self, int N)
subcooling

The amount of subcooling below the saturation temperature corresponding to the pressure, in [K]

Returns None if pressure is not within the two-phase pressure range

superheat

The amount of superheat above the saturation temperature corresponding to the pressure, in [K]

Returns None if pressure is not within the two-phase pressure range

u

The internal energy [kJ/kg]

update(self, dict params)

Parameters params, dictionary

A dictionary of terms to be updated, with keys equal to single-char inputs to the Props function, for instance dict(T=298, P = 101.325) would be one standard atmosphere
update_Trho(self, double T, double rho)

Just use the temperature and density directly for speed

Parameters:
  • T (float) – Temperature [K]
  • rho (float) – Density [kg/m^3]
update_ph(self, double p, double h)

Use the pressure and enthalpy directly

Parameters:
  • p (float) – Pressure (absolute) [kPa]
  • h (float) – Enthalpy [kJ/kg]
visc

The viscosity, in [Pa-s]