In the Webel Psy
library there are 2nd-level wrappers for lower-level Mathematica CoolProp wrappers for the CoolProp API (which uses Strings to identify psychrometric quantities). The Psys
library wrapper functions have variants for fetching psychrometric and other properties as SI convention Reals (which functions take SI Real convention arguments) and as Mathematica Quantities (which functions take Mathematica Quantity arguments as required):
For example, the Quantity version for mixture volume per unit dry air 'vda':
propHA$Vda[t_Quantity,p_Quantity,r_Real] :=
HAPropsSI["Vda","T",scaleT[t],"P",scaleP[p],"R",r] / unitDensity;
Here scaleT[t_Quantity]
and scaleP[p_Quantity]
convert the given 't' and 'p' Quantity arguments to Reals under SI convention (so magnitudes in Kelvin) compatible with CoolProp.
The convenient unitDensity
variable is equivalent to:
Quantity[1.0,("Kilograms")/("Meters")^3]
.
And the SI Real convention version/variant is:
propHA$SI$Vda[t$SI_Real,p$SI_Real,r_Real] :=
HAPropsSI["Vda","T",t$SI,"P",p$SI,"R",r];
The use of such systematically named "2nd-level wrapper" functions in Psy
has many benefits, including being able to prompt on function names easily in Mathematica and Wolfram Workbench, and easier traceability. It also means that the clients of the functions can be decoupled from CoolProp itself through different library bindings.