Hi Everyone,
I am attempting to use CoolProp 6.4.1 to supply density and viscosity for calculations I am performing in MATLAB. Generally, I am providing pressure and enthalpy inputs. I have conducted these calculations using CoolProp 4.2.5 over the last several years, but would like to migrate to the newest version of CoolProp. I am usually using TTSE backend.
For several reasons, using the Python wrapper via MATLAB is not practical for me in this case, so I am preferring to directly access the low level interface through the DLL. I have begun with the example in the documentation here:
http://www.coolprop.org/coolprop/wrappers/MATLAB/index.html and made some minor modifications for my circumstances. (See attached, ml_test1.m). I am working in Windows 11, but have also successfully tested in Linux (Ubuntu 18.04).
This is working very well to start, and I am thrilled with the simplicity and performance of this solution. However, I am running into two difficulties:
- Obtaining properties for user defined mixtures. I am struggling to determine whether this is possible and which syntax to use. I have been attempting to get properties for user-defined mixture by trying multiple variations of the following code.
backend = 'HEOS';
fluid =
'Methane[0.5]&Ethane[0.5]';
[handle, sh] = calllib('coolprop','AbstractState_factory',backend,fluid,ierr,herr,buffer_size);
In every case, the properties returned from subsequent calls are 0 value (i.e., vectors of the proper length with all values equal to 0).
[outputs(1,1), so1] = calllib('coolprop','get_param_index','T');
[outputs(2,1), so2] = calllib('coolprop','get_param_index','P');
[outputs(3,1), so3] = calllib('coolprop','get_param_index','D');
[outputs(4,1), so4] = calllib('coolprop','get_param_index','VISCOSITY');
[outputs(5,1), so5] = calllib('coolprop','get_param_index','SPEED_OF_SOUND');
As a test, I have provided a known bogus input for fluid (e.g., fluid='spolied_milk') and I get the same result. So I am suspecting that the error is with the syntax with which I am defining the mixtures. So my question is how to properly specify user defined fluids in this circumstance?
- Using REFPROP as the backend in this configuration?
Is this possible by setting backend='REFPROP'? If so, is there are recommendation on which version of REFPROP to use?
I can provide more details if needed.
Thank you,
Mike