How to change Reference state and call Refprop from Mathematica

97 views
Skip to first unread message

Yaykhel

unread,
Jun 12, 2018, 11:42:45 PM6/12/18
to coolprop-users
Dear All, 

I am using CoolProp in Mathematica.

I tried to change the reference sate and was unable to do so.

Can anyone tell me how to do it?


I was trying to call REFPROP as well using "REFPROP::Water". The output is infinity. Can't we call REFPROP from CoolProp in Mathematica?

Thank you in advance.

Best regards,
Yaykhel

Ian Bell

unread,
Jun 12, 2018, 11:59:55 PM6/12/18
to coolpro...@googlegroups.com
That ability in the Mathematica wrapper does not yet exist, but could be added by someone (not me) by following the examples from the high-level interface: https://github.com/CoolProp/CoolProp/blob/master/wrappers/Mathematica/CoolPropMathematica.cpp and adding the reference_state functions.

Yes, you can call REFPROP, but you need to have REFPROP configured in the exactly perfect way.  What operating system are you on?  What version of REFPROP do you use?

--
You received this message because you are subscribed to the Google Groups "coolprop-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-users+unsubscribe@googlegroups.com.
To post to this group, send email to coolprop-users@googlegroups.com.
Visit this group at https://groups.google.com/group/coolprop-users.
For more options, visit https://groups.google.com/d/optout.

Yaykhel

unread,
Jun 13, 2018, 4:41:43 AM6/13/18
to coolprop-users
Hi Ian,


Appreciate your prompt reply.

I am using Windows 7 and REFPROP version 9.1.

How do I configure the REFPROP perfectly?

Thank you.

Best regards,
Yaykhel

Ian Bell

unread,
Jun 13, 2018, 11:34:55 AM6/13/18
to coolpro...@googlegroups.com
I believe you need to copy the files from c:/program files (x86)/refprop into c:/program files/refprop ?  Let me know if that works


--
You received this message because you are subscribed to the Google Groups "coolprop-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-user...@googlegroups.com.
To post to this group, send email to coolpro...@googlegroups.com.

Mohammad Islam

unread,
Jun 13, 2018, 1:29:01 PM6/13/18
to coolpro...@googlegroups.com
Hi  Yaykhel,
Please see the link as follows

http://www.coolprop.org/coolprop/REFPROP.html

Regards,
Mohammad



Yaykhel

unread,
Jun 13, 2018, 8:12:55 PM6/13/18
to coolprop-users
Hi Ian,

Thank you very much. It works. I should have read the instruction carefully. I appreciate your help and support.

I am not very familiar with generating wrapper despite I managed to make for Mathematica following the instructions written on CoolProp page with some struggles.


I will try to add (.cpp file) to change the reference state by following the examples from the high-level interface despite I have no clue. Your further support will be much appreciated.

Right now, I do not need to change the reference state, but it would be better in long term since I have been using CoolProp as the main thermophysical properties in Mathematica.

Hope to meet you soon as well.

Best regards,
Yaykhel
Message has been deleted

Yaykhel

unread,
Jun 13, 2018, 8:16:53 PM6/13/18
to coolprop-users
Hi Mohammad,

Thank you for your suggestion. I found the text on the Path and directory from the link you provided. Ian has also helped me to solve this. It works now.

Best regards,
Yaykhel

Yaykhel

unread,
Nov 12, 2018, 2:39:16 AM11/12/18
to coolprop-users
Hi Ian,

I managed to include the reference change function in Mathematica wrapper.

-----

extern "C" DLLEXPORT int set_reference_stateS( WolframLibraryData libData, mint Argc, MArgument *Args, MArgument Res) {
    if (Argc != 2){ return LIBRARY_FUNCTION_ERROR; }
    char *Fluidstring = MArgument_getUTF8String(Args[0]);
    char *RefStatestring = MArgument_getUTF8String(Args[1]);
    
    // set_reference_stateS version takes all strings, not single-character inputs
CoolProp::set_reference_stateS(Fluidstring,RefStatestring);
// MArgument_setChar(Res, val);
return LIBRARY_NO_ERROR;

-----

I found out that it works only for pure fluid. I will try changing the reference of each fluid of a mixture.

Best regards,


On Wednesday, 13 June 2018 12:59:55 UTC+9, Ian Bell wrote:
That ability in the Mathematica wrapper does not yet exist, but could be added by someone (not me) by following the examples from the high-level interface: https://github.com/CoolProp/CoolProp/blob/master/wrappers/Mathematica/CoolPropMathematica.cpp and adding the reference_state functions.

Yes, you can call REFPROP, but you need to have REFPROP configured in the exactly perfect way.  What operating system are you on?  What version of REFPROP do you use?
On Tue, Jun 12, 2018 at 9:42 PM, Yaykhel <yay...@gmail.com> wrote:
Dear All, 

I am using CoolProp in Mathematica.

I tried to change the reference sate and was unable to do so.

Can anyone tell me how to do it?


I was trying to call REFPROP as well using "REFPROP::Water". The output is infinity. Can't we call REFPROP from CoolProp in Mathematica?

Thank you in advance.

Best regards,
Yaykhel

--
You received this message because you are subscribed to the Google Groups "coolprop-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-user...@googlegroups.com.
To post to this group, send email to coolpro...@googlegroups.com.

Ian Bell

unread,
Nov 12, 2018, 11:21:35 AM11/12/18
to coolpro...@googlegroups.com
Great! Can you please make a pull request with this addition?

Yaykhel

unread,
Nov 29, 2018, 10:59:25 PM11/29/18
to coolprop-users
Hi Ian,

You told me to make a pull request and I did so. But you wrote "I have no idea what is going on with this PR, since it somehow is connected to comments from 2014. Can you open a new proper PR? Please see the nice docs put together by @henningjp : https://github.com/CoolProp/CoolProp/wiki/Contributing:-git-development-workflow".

This is the first time for me to do so. In fact, I don't know how to make a proper pull request.

I can provide you the CoolProp.dll file, the CoolPropMathematica.cpp file and the example.nb file with the updated codes.

Is it ok for you to update the codes in Github? Or should I still make another pull request?

 I also noticed that "Szabolcs" has updated with the memory leak problem together with you yesterday. He has commented on my code in Stackexchange.

Best regards,
Yaykhel

Ian Bell

unread,
Nov 29, 2018, 11:04:17 PM11/29/18
to coolpro...@googlegroups.com
I asked szabolcs to try to help you get your PR into shape that we can merge it.  He seems to be up to speed on how this is done.  Have you read the docs in the link I sent you?

Yaykhel

unread,
Nov 29, 2018, 11:48:11 PM11/29/18
to coolprop-users
Thanks. Yes, I read the document, but haven't finished all. I hope szabolcs could help. If he is very busy, I will try again to make a proper PR in a couple of days.
Reply all
Reply to author
Forward
0 new messages