Helmholtz Energy Transformations

264 views
Skip to first unread message

Igor

unread,
Nov 18, 2016, 5:32:56 PM11/18/16
to coolprop-users

Hi Ian,
Hi Everyone,

My question concerns a new features of version 6.1.0. 
If I have understood correctly, the new version contains an opportunity for Helmholtz energy transformations of cubic equations of state for implementing them into complex multi-fluid mixture models. Unfortunately, I haven't found an sample code on the Coolprop website for this new feature. 

 For example, this code uses the multi-fluid mixture models:

In [27]: CP.PropsSI('D','T',300,'P',101325,'HEOS::R32[0.697615]&R125[0.302385]')

In turn, this code uses a one-fluid mixture model, which is typical for cubic equations of state:

In [27]: CP.PropsSI('D','T',300,'P',101325,'SRK::R32[0.697615]&R125[0.302385]')

But how to apply this new feature for the calculation of User-Defined Mixture properties?


Thank you!


Igor. 

Ian Bell

unread,
Nov 20, 2016, 8:24:59 PM11/20/16
to coolpro...@googlegroups.com
1) You probably want to be using the low-level interface: http://www.coolprop.org/dev/coolprop/LowLevelAPI.html instead of the high-level one, especially if you want to get access to critical points.
2) The use of SRK transformation within a multi-fluid model is currently limited to fluids that already have a multiparameter EOS in CoolProp (simply because it is simpler).  But it would be relatively easy to add the ability to add SRK transformations for any fluid for which you knew Tc,pc,acentric .  Is that something you would be interested in?  If so, please file an issue and I will implement that ability.  Internally, there is an ugly hack, but the way you enable a SRK for fluid in the HEOS backend is something like this (add -SRK to the fluid name):

In [1]: import CoolProp.CoolProp as CP


In [2]: CP.PropsSI('D','T',300,'P',101325,'HEOS::R32[0.697615]&R125-SRK[0.302385]')

Out[2]: 2.986434081768588


Best,

Ian


--
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.

Igor

unread,
Nov 21, 2016, 6:21:43 AM11/21/16
to coolprop-users
Hi Ian,

Thanks for the answer!

1. You said that  SRK is currently limited. Is there a such limitation for the PR equation (I would rather use the PR)? 

2. I tried to use your advice (-SRK) in Matlab. But I got:
>> disp([num2str(CoolProp.PropsSI('D','P',5960,'Q',0, 'HEOS::CarbonDioxide[0.513]&n-Decane-SRK[0.487]'))]);
Warning: Initialize failed for backend: "HEOS", fluid: "CarbonDioxide&n-Decane-SRK" fractions "[ 0.5130000000, 0.4870000000 ]";
error: key [n-Decane-SRK] was not found in string_to_index_map in JSONFluidLibrary 
Error using CoolPropMATLAB_wrap
Fatal error.
This scheme does not work for Matlab?

3.I'm trying to compile Coolprop with Python Wrapper. But I'm still in the process ((. I have installed the MSVS2016. Also, I have added in MSVS the C++ and Python compilers. But when I try to compile the file setup.py I get: "No module named Cython". So now I'm thinking how to install the Cython. 
Because of these difficulties, I still can not use your script ECS_fitter.py.  Unfortunately, now I'm stuck.


Igor. 

понедельник, 21 ноября 2016 г., 4:24:59 UTC+3 пользователь Ian Bell написал:
1) You probably want to be using the low-level interface: http://www.coolprop.org/dev/coolprop/LowLevelAPI.html instead of the high-level one, especially if you want to get access to critical points.
2) The use of SRK transformation within a multi-fluid model is currently limited to fluids that already have a multiparameter EOS in CoolProp (simply because it is simpler).  But it would be relatively easy to add the ability to add SRK transformations for any fluid for which you knew Tc,pc,acentric .  Is that something you would be interested in?  If so, please file an issue and I will implement that ability.  Internally, there is an ugly hack, but the way you enable a SRK for fluid in the HEOS backend is something like this (add -SRK to the fluid name):

In [1]: import CoolProp.CoolProp as CP


In [2]: CP.PropsSI('D','T',300,'P',101325,'HEOS::R32[0.697615]&R125-SRK[0.302385]')

Out[2]: 2.986434081768588


Best,

Ian

On Fri, Nov 18, 2016 at 3:32 PM, 'Igor' via coolprop-users <coolpro...@googlegroups.com> wrote:

Hi Ian,
Hi Everyone,

My question concerns a new features of version 6.1.0. 
If I have understood correctly, the new version contains an opportunity for Helmholtz energy transformations of cubic equations of state for implementing them into complex multi-fluid mixture models. Unfortunately, I haven't found an sample code on the Coolprop website for this new feature. 

 For example, this code uses the multi-fluid mixture models:

In [27]: CP.PropsSI('D','T',300,'P',101325,'HEOS::R32[0.697615]&R125[0.302385]')

In turn, this code uses a one-fluid mixture model, which is typical for cubic equations of state:

In [27]: CP.PropsSI('D','T',300,'P',101325,'SRK::R32[0.697615]&R125[0.302385]')

But how to apply this new feature for the calculation of User-Defined Mixture properties?


Thank you!


Igor. 

--
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 21, 2016, 10:02:06 AM11/21/16
to coolpro...@googlegroups.com
On Mon, Nov 21, 2016 at 4:21 AM, 'Igor' via coolprop-users <coolpro...@googlegroups.com> wrote:
Hi Ian,

Thanks for the answer!

1. You said that  SRK is currently limited. Is there a such limitation for the PR equation (I would rather use the PR)? 
 
In principle, no, when you are talking about integrating cubics into multi-fluid models.  The derivatives are just much simpler for the SRK than for PR, which is why I implemented SRK instead of PR.  But, I was thinking this morning that you could actually pretty easily implement the generalized solutions for the pure fluids.  So I will see about doing that.  I think it might actually end up being super easy...  But we shall see.  The limitations I mention pertain to the one-fluid cubic models.  There are currently no ideal-gas Helmholtz energies implemented, which means no enthalpies, entropies, etc.


2. I tried to use your advice (-SRK) in Matlab. But I got:
>> disp([num2str(CoolProp.PropsSI('D','P',5960,'Q',0, 'HEOS::CarbonDioxide[0.513]&n-Decane-SRK[0.487]'))]);
Warning: Initialize failed for backend: "HEOS", fluid: "CarbonDioxide&n-Decane-SRK" fractions "[ 0.5130000000, 0.4870000000 ]";
error: key [n-Decane-SRK] was not found in string_to_index_map in JSONFluidLibrary 
Error using CoolPropMATLAB_wrap
Fatal error.
This scheme does not work for Matlab?

I bet that is an error in how I parse the fluid name.  I'm willing to bet that CarbonDioxide-SRK would work, but n-Decane-SRK doesn't.  Please file an issue and I will fix it.
 

3.I'm trying to compile Coolprop with Python Wrapper. But I'm still in the process ((. I have installed the MSVS2016. Also, I have added in MSVS the C++ and Python compilers. But when I try to compile the file setup.py I get: "No module named Cython". So now I'm thinking how to install the Cython. 
Because of these difficulties, I still can not use your script ECS_fitter.py.  Unfortunately, now I'm stuck.

If you want to compile CoolProp for python 2.7 on windows, you need 2008 compiler, if you want to compile for python 3.5, you need 2015 (I think).  Newer versions are NOT backwards compatible.  But if all you want to do is to run the ECS fitter script, better to just pip install CoolProp for your distribution (http://www.coolprop.org/coolprop/wrappers/Python/index.html#automatic-installation).  In general, I recommend the anaconda python distribution, it includes lots of useful things like cython: https://www.continuum.io/downloads.

Best,
Ian
 
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.

Igor

unread,
Nov 21, 2016, 1:59:37 PM11/21/16
to coolprop-users
Hi Ian,

I have a small question.
Should I install a pip program if I'm going to install the anaconda?


Igor. 

суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Ian Bell

unread,
Nov 21, 2016, 3:11:26 PM11/21/16
to coolpro...@googlegroups.com

Nope, anaconda includes pip, so no need to install it specially


--

Igor

unread,
Nov 21, 2016, 5:32:11 PM11/21/16
to coolprop-users
Hi Ian,

CoolProp is successfully installed! Thank you very much!!!

1. I tried to run the script. There is a small error:
  File "C:/Users/admin/........../BELL/ECS_fitter.py", line 105
    print p[::-1]
          ^
SyntaxError: Missing parentheses in call to 'print'

I'm sorry, I'm not friends with Syntax yet. How to fix it?

2. To use this script with a new substance (2-butanol) I have to add this substance (using JSON scheme) and recompile CoolProp. This is the right way? 

3. Is it possible for the newly added substances to use cubic EOS, transform them  into HEOS and add them into the multifluid mixture model?

Thank you!


Best,
Igor.

суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Ian Bell

unread,
Nov 22, 2016, 1:15:53 AM11/22/16
to coolpro...@googlegroups.com
1. Hmm, that's because that script was written for python 2.7, and the print command turned into a print function in python 3.  So just make those changes, and the script should run.  I pushed an updated version of the script and it runs on my computer, hopefully it would on yours too!

2. Yes, or wait for me to implement this issue: https://github.com/CoolProp/CoolProp/issues/1345 .  I plan to do it over our holiday (in the next few days).  It should take me an hour or two at most.

3. Not yet, but I will implement this ability.  See also: https://github.com/CoolProp/CoolProp/issues/1346

--

Igor

unread,
Nov 22, 2016, 7:11:20 AM11/22/16
to coolprop-users
Hi Ian,

Thank you for the new version of the script! Everything works well!

1. This script uses only data for saturated liquid viscosity? (I have only 8 points. Other data at atmospheric pressure.)

2. If you add 2-butanol into CoolProp, I will be very grateful. I not quite understand it at this moment. 

3. After adding a new features the Coolprop must be recompiled. Can you give a short explanation? I have to repeat the automatic installation (pip install Coolprop)?

My interest in the transformation of cubic equations because my generalized equations (for n-alkanes and cyclic hydrocarbons) are not suitable for the calculation of phase equilibria of reservoir fluids. For example, for these model mixtures (CO2 + C14) or (CO2 + C5 + C18) results are bad. My hope is that the approach with inclusion of cubic equations in the multifluid mixture model will give a better results for such asymmetric mixtures. 

Best,
Igor. 

суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Igor

unread,
Nov 30, 2016, 5:18:47 PM11/30/16
to coolprop-users
Hi Ian,
Hi Everyone,

I want to add a new substance as a cubic equation and use it in multifluid model.
I tried to use the new features recently added to Coolprop ( https://github.com/CoolProp/CoolProp/issues/1346) using this code:

import CoolProp.CoolProp as CP, json

C18 = [
   ....:                   {
   ....:                     "CAS": "593-45-3",
   ....:                     "Tc": 748.16,
   ....:                     "Tc_units": "K",
   ....:                     "acentric": 0.812,
   ....:                     "aliases": [
   ....:                     ],
   ....:                     "molemass": 0.255,
   ....:                     "molemass_units": "kg/mol",
   ....:                     "name": "C18",
   ....:                     "pc": 1301358.0,
   ....:                     "pc_units": "Pa"
   ....:                   }
   ....:               ]
   ....:

CP.add_fluids_as_JSON("PR", json.dumps(C18))

from __future__ import print_function

import CoolProp

AS = CoolProp.AbstractState('HEOS','Methane&C18-PR')
Traceback (most recent call last):

  File "<ipython-input-6-b29fd1ff51fa>", line 1, in <module>
    AS = CoolProp.AbstractState('HEOS','Methane&C18-PR')

  File "CoolProp\AbstractState.pyx", line 32, in CoolProp.CoolProp.AbstractState.__cinit__ (CoolProp\CoolProp.cpp:11137)

ValueError: key [C18-PR] was not found in string_to_index_map in JSONFluidLibrary


But there were problems. Explain, please, what did I do wrong?

Thank you!


Igor.


суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Ian Bell

unread,
Dec 1, 2016, 1:33:45 AM12/1/16
to coolpro...@googlegroups.com
Sounds like you don't have the most up-to-date version of CoolProp.  Recommended is to do the following at the command line as recommended by http://www.coolprop.org/coolprop/wrappers/Python/index.html#automatic-installation :

pip install -vvv --pre --trusted-host www.coolprop.dreamhosters.com --find-links http://www.coolprop.dreamhosters.com/binaries/Python/ -U --force-reinstall CoolProp

Then, you should do something like:

from __future__ import print_function

import CoolProp, json
import CoolProp.CoolProp as CP
CP.set_debug_level(100)

C18 = [
   {
      "CAS": "593-45-3",
      "Tc": 748.16,
      "Tc_units": "K",
      "acentric": 0.812,
      "aliases": [],
      "molemass": 0.255,
      "molemass_units": "kg/mol",
      "name": "C18",
      "pc": 1301358.0,
      "pc_units": "Pa"
   }
]

CP.add_fluids_as_JSON("PR", json.dumps(C18))
CP.apply_simple_mixing_rule(C18[0]['CAS'], CP.get_fluid_param_string("Methane","CAS"), 'Lorentz-Berthelot')
AS = CoolProp.AbstractState('HEOS','Methane&C18-PengRobinson')
AS.set_mole_fractions([0.3,0.7])
AS.update(CP.PQ_INPUTS, 101325, 0)
print(AS.T())

In general it is MUCH more useful if you provide a script that can be copy-pasted and run directly.

FYI, the core problem with your example is that -PR is not the suffix for the use of Peng-Robinson, -PengRobinson is

P.S. The updated cubic docs should show up here in the next few hours: http://www.coolprop.org/dev/coolprop/Cubics.html

Best,
Ian


--
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 coolpro...@googlegroups.com.

Ian Bell

unread,
Dec 1, 2016, 2:27:58 AM12/1/16
to coolpro...@googlegroups.com

Igor

unread,
Dec 1, 2016, 12:25:04 PM12/1/16
to coolprop-users
Hi Ian,

Thank you! Everything is working!

Igor. 

суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Ian Bell

unread,
Dec 1, 2016, 12:27:54 PM12/1/16
to coolpro...@googlegroups.com
Good to hear!  I will fix the runtime loading of fluids in the coming days

--
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.

Igor

unread,
Dec 1, 2016, 3:03:41 PM12/1/16
to coolprop-users
Hi Ian,

I have some questions:

1. When adding a cubic equation in multifluid model only the Lorentz-Berthelot mixing rule is available? I mean, is it possible to change the values of the binary coefficients (gamma_v, gamma_t and so on) in mixing rule in this situation?

2. Are there restrictions on the number of components in the mixture?

Igor. 

суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Ian Bell

unread,
Dec 1, 2016, 3:07:12 PM12/1/16
to coolpro...@googlegroups.com
1. See http://www.coolprop.org/dev/fluid_properties/Mixtures.html#using-your-own-interaction-parameters .  The Lorentz-Berthelot thing is just to put a placeholder in the interaction parameter library internal to CoolProp so that the AbstractState can be instantiated.  Then you can modify the interaction parameters.
2. Nope

--

Igor

unread,
Dec 2, 2016, 10:14:23 AM12/2/16
to coolprop-users
Hi Ian,

I saw that you have added the ability to include a new substances (https://github.com/CoolProp/CoolProp/issues/1345). Is there any explanation on the website how to do it?
Or maybe you have an example?

Thank you!


Igor. 

суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Ian Bell

unread,
Dec 2, 2016, 10:39:54 AM12/2/16
to coolpro...@googlegroups.com
I can add an example to the docs, but the basic idea is to add a fluid like you do for the cubics.  You send the JSON definition for the fluid into the add_fluids_as_JSON function add_fluids_as_JSON("HEOS", JSON_string).  

--

Igor

unread,
Dec 2, 2016, 12:51:25 PM12/2/16
to coolprop-users
Hi Ian,

There are complete fluid schema for cubic equations on the website. 
But I do not quite understand how to add a HEOS for anyone substance. Is there an example of a .json file for the HEOS fluids?


Igor. 

суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Ian Bell

unread,
Dec 2, 2016, 3:54:32 PM12/2/16
to coolpro...@googlegroups.com
Yes, check out the dev/fluids folder.  Those are the fluids that get loaded into CoolProp.

--

Igor

unread,
Dec 2, 2016, 5:27:55 PM12/2/16
to coolprop-users
Hi Ian,

To my shame, I was unable to add a new substance (2-butanol) in your script ECS_fitter.py. I'm getting a different error. For example: NameError: name 'false' is not defined; NameError: name 'true' is not defined. Of course, this is due to lack of experience in working with Coolprop and Python.
I can not do it without your help. At this moment, I can only work with your exact examples of scripts, unfortunately.


Igor. 

суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Igor

unread,
Dec 3, 2016, 5:50:07 PM12/3/16
to coolprop-users
Hi Ian,

I tried to run this script:

from __future__ import print_function
import CoolProp, json
import CoolProp.CoolProp as CP
CP.set_debug_level(100)

C14 = [
   {
      "CAS": "629-59-4",
      "Tc": 692.547,
      "Tc_units": "K",
      "acentric": 0.6555,
      "aliases": [],
      "molemass": 0.198388,
      "molemass_units": "kg/mol",
      "name": "C14",
      "pc": 1614000.0,
      "pc_units": "Pa"
   }
]

CP.add_fluids_as_JSON("PR", json.dumps(C14))
CP.apply_simple_mixing_rule(C14[0]['CAS'], CP.get_fluid_param_string("Methane","CAS"), 'Lorentz-Berthelot')
CP.apply_simple_mixing_rule(C14[0]['CAS'], CP.get_fluid_param_string("n-Butane","CAS"), 'Lorentz-Berthelot')
CP.apply_simple_mixing_rule(C14[0]['CAS'], CP.get_fluid_param_string("n-Heptane","CAS"), 'Lorentz-Berthelot')
CP.apply_simple_mixing_rule(C14[0]['CAS'], CP.get_fluid_param_string("n-Decane","CAS"), 'Lorentz-Berthelot')
AS = CoolProp.AbstractState('HEOS','Methane&n-Butane&n-Heptane&n-Decane&C14-PengRobinson')
AS.set_mole_fractions([0.7998,0.1396,0.0404,0.0141,0.0061])
#AS.update(CP.PQ_INPUTS, 300000, 1)
#print(AS.T())
AS.update(CP.QT_INPUTS, 0, 100)
print(AS.p())

But I got an error: ValueError: Could not match the binary pair [106-97-8,74-82-8] - for now this is an error.
This refers to the methane / butane pair. But this pair is already exists in Coolprop. I can not understand my mistake here.


Igor. 

суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Ian Bell

unread,
Dec 3, 2016, 6:14:04 PM12/3/16
to coolpro...@googlegroups.com
You need to do some sort of mixture instantiation first which will cause the default parameters to populate the binary interaction library, and then you can do your calls to add your parameters.  This works for me:

from __future__ import print_function
import CoolProp, json
import CoolProp.CoolProp as CP
CP.set_debug_level(100)

C14 = [
   {
      "CAS": "629-59-4",
      "Tc": 692.547,
      "Tc_units": "K",
      "acentric": 0.6555,
      "aliases": [],
      "molemass": 0.198388,
      "molemass_units": "kg/mol",
      "name": "C14",
      "pc": 1614000.0,
      "pc_units": "Pa"
   }
]

CP.add_fluids_as_JSON("PR", json.dumps(C14))
CP.set_config_bool(CP.OVERWRITE_BINARY_INTERACTION, True)
# print("BIP loaded:", CP.get_global_param_string("mixture_binary_pairs_list"))
AS = CoolProp.AbstractState('HEOS','Methane&n-Butane&n-Heptane&n-Decane') # populates the library with default values
for fluid in ['Methane','n-Butane','n-Heptane','n-Decane']:
   _CAS = CP.get_fluid_param_string(fluid, "CAS")
   print(fluid, _CAS)
   CP.apply_simple_mixing_rule(C14[0]['CAS'], _CAS, 'Lorentz-Berthelot')
   
AS = CoolProp.AbstractState('HEOS','Methane&n-Butane&n-Heptane&n-Decane&C14-PengRobinson')
AS.set_mole_fractions([0.7998,0.1396,0.0404,0.0141,0.0061])
#AS.update(CP.PQ_INPUTS, 300000, 1)
#print(AS.T())
AS.update(CP.QT_INPUTS, 0, 100)
print(AS.p())

--

Igor

unread,
Dec 3, 2016, 7:11:23 PM12/3/16
to coolprop-users
Hi Ian,

Thank you very much!

Your example works.

Thanks for the help!

суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Ian Bell

unread,
Dec 3, 2016, 8:21:51 PM12/3/16
to coolpro...@googlegroups.com
Good to hear!

--
Message has been deleted
Message has been deleted

Igor

unread,
Dec 5, 2016, 8:29:58 AM12/5/16
to coolprop-users
Hi Ian,

I'm sorry to trouble you!
I still have a problems with the addition of a new substance with HEOS at runtime.
What changes should be made to your script  ECS_fitter.py for adding 2-butanol at runtime? 


Igor. 

Ian Bell

unread,
Dec 8, 2016, 10:13:14 AM12/8/16
to coolpro...@googlegroups.com
Sorry I haven't responded yet, I will provide an email this evening...

Ian

--

Ian Bell

unread,
Dec 8, 2016, 10:19:39 PM12/8/16
to coolpro...@googlegroups.com
See https://github.com/CoolProp/CoolProp/pull/1371

I added some new docs, they will be up at http://www.coolprop.org/dev/coolprop/HighLevelAPI.html quite soon.  You'll want the "Adding Fluids" section.

On Thu, Dec 8, 2016 at 8:12 AM, Ian Bell <ian.h...@gmail.com> wrote:
Sorry I haven't responded yet, I will provide an email this evening...

Ian
On Mon, Dec 5, 2016 at 6:29 AM, 'Igor' via coolprop-users <coolprop-users@googlegroups.com> wrote:
Hi Ian,

I'm sorry to trouble you!
I still have a problems with the addition of a new substance with HEOS at runtime.
What changes should be made to your script  ECS_fitter.py for adding 2-butanol at runtime? 


Igor. 

суббота, 19 ноября 2016 г., 1:32:56 UTC+3 пользователь Igor написал:

Hi Ian,
Hi Everyone,

My question concerns a new features of version 6.1.0. 
If I have understood correctly, the new version contains an opportunity for Helmholtz energy transformations of cubic equations of state for implementing them into complex multi-fluid mixture models. Unfortunately, I haven't found an sample code on the Coolprop website for this new feature. 

 For example, this code uses the multi-fluid mixture models:

In [27]: CP.PropsSI('D','T',300,'P',101325,'HEOS::R32[0.697615]&R125[0.302385]')

In turn, this code uses a one-fluid mixture model, which is typical for cubic equations of state:

In [27]: CP.PropsSI('D','T',300,'P',101325,'SRK::R32[0.697615]&R125[0.302385]')

But how to apply this new feature for the calculation of User-Defined Mixture properties?


Thank you!


Igor. 

--
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 coolpro...@googlegroups.com.

Igor

unread,
Dec 15, 2016, 11:49:55 AM12/15/16
to coolprop-users
Hi Ian,

Thanks for the explanation!

I have some questions for you:

1. I tried to use a script binary_fitter.py. It refers to your paper "Automatic ftting of binary interaction parameters for multi-fuid Helmholts -energy-explicit mixture Models".
But I got this message: NameError: name 'xrange' is not defined. What is the problem here?

2. And a small question about the cubic equations. I can not find on the website an example of how to calculate the density (or other single-phase property) for the mixture. I found only VLE-calculations, the critical point and the phase envelops for cubic EOS. Could you give an example or link?

Thank you!

Ian Bell

unread,
Dec 15, 2016, 9:38:21 PM12/15/16
to coolpro...@googlegroups.com
1. Probably you are using python 3.x instead of python 2.7 that I used to write the fitter.  I can updated that tomorrow at work and send you the python 3.x compatible version.  

2. Calculating densities is JUST like for the HEOS model.  Example:

CP.PropsSI("D","P",101325,"T",298,"SRK::Propane")

or

AS = CP.AbstractState("SRK", "Propane"); 
AS.update(CP.PT_INPUTS, 101325, 300); 
print(AS.rhomolar())

--
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.

Igor

unread,
Dec 16, 2016, 5:39:41 AM12/16/16
to coolprop-users
Hi Ian,

Thank you very much!!!

Igor

unread,
Dec 20, 2016, 11:57:24 AM12/20/16
to coolprop-users
Hi Ian,

I decided to install Anakonda2 with Python 2.7 instead of Python 3.x to use your script (binary_fitter.py) unchanged. Perhaps it is more correct way for using your script.
But installing Coolprop by usual way (pip install CoolProp), I got a problems.
Therefore, I have a question - How to install CoolProp correctly just for a given version of Python 2.7?

Thank you!


Igor. 

Ian Bell

unread,
Dec 20, 2016, 5:14:00 PM12/20/16
to coolpro...@googlegroups.com
I guess you got my other email from work, so hopefully you got everything working...

--

Igor

unread,
Dec 21, 2016, 2:37:54 PM12/21/16
to coolprop-users
Hi Ian,

Sorry to bother you again!

I have a questions about the cubic equation:

1. I use this to calculate the dew point pressure:
 
PR = CoolProp.AbstractState('PR','Methane&Ethane&n-Butane&Toluene&n-Octane&C16') 
PR.set_mole_fractions([0.7472, 0.1097, 0.0442, 0.0272, 0.0387, 0.033])
PR.update(CP.QT_INPUTS, 0, 150)
print(PR.p())

But how to calculate the bubble point pressure?

2. How to set the interaction parameters? This refers to the two-component mixture http://www.coolprop.org/dev/coolprop/Cubics.html#interaction-parameters
   But how to do it right for the multicomponent mixture?

Ian Bell

unread,
Dec 21, 2016, 8:32:04 PM12/21/16
to coolpro...@googlegroups.com
You actually did a bubble point calculation, since you provided a Q of 0.  If you wanted a dewpoint calculation, you would give a Q of 1.

If you need to set other binary interaction parameters, call the binary interaction parameter function for each binary pair that you want to modify.  If you have many components, that means potentially many calls.  If you like the default values for a given binary pair, no need to set them.

--

Igor

unread,
Dec 22, 2016, 1:26:39 PM12/22/16
to coolprop-users
OK, Thank you!
Reply all
Reply to author
Forward
0 new messages