functor¶
-
thermosteam.
functor
(f=None, var=None)[source]¶ Decorate a function of temperature, or both temperature and pressure as a Functor subclass.
- Parameters
Notes
The functor decorator checks the signature of the function to find the names of the parameters that should be stored as data.
Examples
Create a functor of temperature that returns the vapor pressure in Pascal:
>>> # Describe the return value with `var`. >>> # Thermosteam's chemical units of measure are always assumed. >>> @functor(var='Psat') ... def Antoine(T, a, b, c): ... return 10.0**(a - b / (T + c)) >>> f = Antoine(a=10.116, b=1687.5, c=-42.98) >>> f Functor: Antoine(T, P=None) -> Psat [Pa] a: 10.116 b: 1687.5 c: -42.98 >>> f(T=373.15) 101047.25357066597