Webel: Psy/MPsy: Psychrometrics for Mathematica: The CoolProp "wrappers" of the Psy library in fact wrap lower-level wrappers (bindings) for CoolProp for Mathematica

Webel IT Australia promotes the amazing Mathematica tool and the powerful Wolfram Language and offers professional Mathematica services for computational computing and data analysis. Our Mathematica tips, issue tracking, and wishlist is offered here most constructively to help improve the tool and language and support the Mathematica user community.
DISCLAIMER: Wolfram Research does not officially endorse analysis by Webel IT Australia.
Icon class
icon_class
far fa-sticky-note
icon_class_computed
far fa-sticky-note
Note kind
Policy level
Keywords

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.

Relates to
Related notes
Related notes (backlinks)
Related snippets (extracts)
Visit also
Visit also (backlinks)
External links