Density with cubic-equation (SRK, PR)?

104 views
Skip to first unread message

h-h....@arcor.de

unread,
Dec 12, 2016, 8:48:51 AM12/12/16
to coolprop-users
Hello,

I am still using the version 6.0.0 with much success. Now I wanted to calculate the density of saturated pentane at 25°C with the Peng-Robinson-EoS. The program is:

import CoolProp.CoolProp as CP, json

fake_fluids = [
                   {
                     "CAS": "109-66-0",
                     "Tc": 469.70,
                     "Tc_units": "K",
                     "acentric": 0.252,
                     "aliases": [
                     ],
                     "molemass": 0.07215,
                     "molemass_units": "kg/mol",
                     "name": "NC5H12",
                     "pc": 3370000.0,
                     "pc_units": "Pa"
                   }
               ]
 
CP.add_fluids_as_JSON("PR", json.dumps(fake_fluids))
D = CP.PropsSI('D','T',298.15,'Q',1,'PR::NC5H12')

The value of the calculated density is zero. What I have done wrong? The calculation of the vapor pressure is functioning and right.

Kind regards,
Hans-Herbert

Ian Bell

unread,
Dec 12, 2016, 9:53:01 AM12/12/16
to coolpro...@googlegroups.com
I get 2.04334655608 for the density.  Please upgrade!

import CoolProp
print CoolProp.__version__
print CoolProp.__gitrevision__
-->
6.1.1dev
6ae9e0d3d1093dfbfd09d4687fda1e8cb50a397a

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

h-h....@arcor.de

unread,
Dec 12, 2016, 11:27:22 AM12/12/16
to coolprop-users
Hello Ian,
thank you very much for your help. With the version 6.1.0 I have no problems with the densities.
I would like to calculate the enthalpy of evaporation with the equation of Clausius-Clapeyron. I need for that the derivation of the vapor pressure to the temperature (dPs/dT). Can you help me in the case of the PR-EoS?

Kind reagards, Hans-Herbert .

Ian Bell

unread,
Dec 12, 2016, 8:49:04 PM12/12/16
to coolpro...@googlegroups.com
How about this:

import CoolProp.CoolProp as CP, json

fake_fluids = [
                   {
                     "CAS": "109-66-0",
                     "Tc": 469.70,
                     "Tc_units": "K",
                     "acentric": 0.252,
                     "aliases": [
                     ],
                     "molemass": 0.07215,
                     "molemass_units": "kg/mol",
                     "name": "NC5H12",
                     "pc": 3370000.0,
                     "pc_units": "Pa"
                   }
               ]
 
CP.add_fluids_as_JSON("PR", json.dumps(fake_fluids))

AS = CP.AbstractState('PR','NC5H12')
for T in [180, 200, 300]:
  AS.update(CP.QT_INPUTS, 0, T)
  hfg = AS.first_saturation_deriv(CP.iP, CP.iT)*T*(1/AS.saturated_vapor_keyed_output(CP.iDmolar)-1/AS.saturated_liquid_keyed_output(CP.iDmolar))
  hfg_HEOS = CP.PropsSI("Hmolar",'T',T,'Q',1,'n-Propane')-CP.PropsSI("Hmolar",'T',T,'Q',0,'n-Propane')
  print(T, hfg, hfg_HEOS)

which yields 

(180, 31352.081662011413, 20914.95842204848)
(200, 30558.22105770095, 20111.93137525096)
(300, 26328.861195352918, 14659.562634606435)

Clearly cubics are not great for this problem because their volume predictions are quite poor.

Regards,
Ian

--

h-h....@arcor.de

unread,
Dec 13, 2016, 7:40:23 AM12/13/16
to coolprop-users
Hello Ian,
thank you very much for your program code to calculate the derivation of the vapor pressure. I used the version 6.1.0 and, sorry, I got the following error message:

Traceback (most recent call last):
  File "C:\For\Reaktion\Heating_Value\Cubic_tst.py", line 24, in <module>
    hfg = AS.first_saturation_deriv(CP.iP, CP.iT)*T*(1/AS.saturated_vapor_keyed_output(CP.iDmolar)-1/AS.saturated_liquid_keyed_output(CP.iDmolar))
  File "CoolProp\AbstractState.pyx", line 419, in CoolProp.CoolProp.AbstractState.first_saturation_deriv (CoolProp\CoolProp.cpp:31936)
  File "CoolProp\AbstractState.pyx", line 421, in CoolProp.CoolProp.AbstractState.first_saturation_deriv (CoolProp\CoolProp.cpp:31832)
ValueError: No alpha0 derivatives are available

Please use pentane and not propane. The enthalpy of evaporation have then no remarkably difference.

Kind regards,
Hans-Herbert



Am Montag, 12. Dezember 2016 14:48:51 UTC+1 schrieb h-h....@arcor.de:

Ian Bell

unread,
Dec 13, 2016, 9:19:21 AM12/13/16
to coolpro...@googlegroups.com
I've added the a alpha0 derivatives, so you will need to use the development version.  

And yes, of course, I should have used pentane instead of propane :)

Ian

--

h-h....@arcor.de

unread,
Dec 19, 2016, 2:54:39 PM12/19/16
to coolprop-users
Hello Ian,

I think there is perhaps an error in the computation with the cubic equation. At T= 298.15 K (standard state) and the fluid n-octane the PR-eos has the vapor pressure p = 0.019888 bar. That is right. But the volum of the gas-phase is v" = 108.871 m^3/kg, what is wrong. The right value is v" = 10,8872 m^3/kg. The same happens with the SRK-eos. Please check this.

Kind regards,
Hans-Herbert.

Am Montag, 12. Dezember 2016 14:48:51 UTC+1 schrieb h-h....@arcor.de:

Ian Bell

unread,
Dec 19, 2016, 11:01:12 PM12/19/16
to coolpro...@googlegroups.com
It is a cubic equation of state after all...  Do the saturation pressures come out correctly?

--

Ian Bell

unread,
Dec 19, 2016, 11:07:10 PM12/19/16
to coolpro...@googlegroups.com
I think there is something wrong in your code.  Please try with the most up-to-date version of the code:

import CoolProp
print(CoolProp.CoolProp.get_global_param_string('version'))
print(CoolProp.CoolProp.get_global_param_string('gitrevision'))
print(1/CoolProp.CoolProp.PropsSI('Dmass','T',298.15,'Q',0,'PR::n-Octane'))
print(1/CoolProp.CoolProp.PropsSI('Dmass','T',298.15,'Q',1,'PR::n-Octane'))

print(1/CoolProp.CoolProp.PropsSI('Dmass','T',298.15,'Q',0,'SRK::n-Octane'))
print(1/CoolProp.CoolProp.PropsSI('Dmass','T',298.15,'Q',1,'SRK::n-Octane'))

yields

6.1.1dev
6ae9e0d3d1093dfbfd09d4687fda1e8cb50a397a
0.00147995436812
0.00166451223678
11.820036647

which seems totally fine

To post to this group, send email to coolpro...@googlegroups.com.

h-h....@arcor.de

unread,
Dec 20, 2016, 8:26:50 AM12/20/16
to coolprop-users
Hello Ian,

thank you for your answer and your own test. Where can I get the version 6.1.1 dev ? Here
was the last modification in Okt. 2016.

Kind regards, Hans-Herbert


Am Montag, 12. Dezember 2016 14:48:51 UTC+1 schrieb h-h....@arcor.de:

Ian Bell

unread,
Dec 20, 2016, 11:33:27 AM12/20/16
to coolpro...@googlegroups.com

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

h-h....@arcor.de

unread,
Dec 28, 2016, 9:11:49 AM12/28/16
to coolprop-users
Hello Ian,
I have installed CoolProp 6.1.1dev with pip. For the temperature T = 298,15 K in the saturated state the values of the both densities of the fluid n-Perntane are D' = 639.59 kg/m^3 and D" = 2.0491 kg/m^3. These values are right. But for n-Octane i get the values D' = 67.517 kg/m^3 and D" = 9.1852e-3 kg/m^3. These values need the factor 10 to be right.
Regards, Hans-Herbert


Am Montag, 12. Dezember 2016 14:48:51 UTC+1 schrieb h-h....@arcor.de:

Ian Bell

unread,
Jan 2, 2017, 2:43:27 PM1/2/17
to coolpro...@googlegroups.com
I cannot replicate this behavior.  Please provide a complete script with its associated output.  For example, for me, 

import CoolProp.CoolProp as CP, CoolProp
print(CoolProp.__version__)
print(CoolProp.__gitrevision__)

print(CP.PropsSI('D','T',298.15,'Q',0,'SRK::n-Octane'))
print(CP.PropsSI('D','T',298.15,'Q',1,'SRK::n-Octane'))

yields

6.1.1dev
f0ca4fc35ad2f5e3eec66bc03f756c21524ffb12
600.776598636
0.0846021065639

which seems totally fine.

--

h-h....@arcor.de

unread,
Jan 3, 2017, 6:50:13 AM1/3/17
to coolprop-users
Hello Ian,
thank you for your help. It was my error. The molemass of the fluid n-octane was wrong. I wrote in the program M=0.011423 instead of 0.11423 kg/mol.

Regards, Hans-Herbert

Am Montag, 12. Dezember 2016 14:48:51 UTC+1 schrieb h-h....@arcor.de:

Ian Bell

unread,
Jan 3, 2017, 9:04:00 AM1/3/17
to coolpro...@googlegroups.com
Good, I suspected it was something like that. So all is well...

--
Reply all
Reply to author
Forward
0 new messages