1
$\begingroup$

I use the following command

Rhol = LibraryFunctionLoad["CoolProp", 
   "PropsSI", {UTF8String, UTF8String, Real, UTF8String, Real, 
    UTF8String}, Real];Subscript[T, 0]=330;

to obtain fluid/vapor properties:

(*rho*)Subscript[ρ, l] = 
 Rhol["D", "T", Subscript[T, 0], "Q", 0, "Water"]
(*saturation pressure*)Subscript[p, 0] = 
 Rhol["P", "T", Subscript[T, 0], "Q", 1, "Water"]
(*kinematic viscosity*)Subscript[v, e] = 
 Rhol["V", "T", Subscript[T, 0], "Q", 0, "Water"]/Subscript[ρ, l]

With "Water", everything is OK, but for example "Acetone" displays viscosity as an infinity sign.

Does anyone have the same problem and know how to fix it?

$\endgroup$
1
  • $\begingroup$ Be aware that because most people don't have CoolProp readily installed, it might take a while for your question to get answered. $\endgroup$ – J. M.'s torpor Apr 17 '20 at 12:02
1
$\begingroup$

Unfortunately the Mathematica wrappers don't expose any error handling and so this is all you get:

In[7]:= pathToCoolProp = 
  "/Users/jasonb/WolframWorkspaces/CoolProp/build/libCoolProp.dylib";

In[8]:= PropsSI = 
  LibraryFunctionLoad[pathToCoolProp, 
   "PropsSI", {"UTF8String", "UTF8String", Real, "UTF8String", Real, 
    "UTF8String"}, Real];

In[9]:= PropsSI["V", "T", 300., "Q", 0., "Acetone"]

Out[9]= \[Infinity]

But if you use python you get a better message:

enter image description here

It would be interesting to modify the wrapper code to catch errors and return them in a meaningful way, but I'm not sure how to do that. Wrapping this line in a try-catch block doesn't do anything.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.