Internal energy outputs not agreeing with thermo textbook table

108 views
Skip to first unread message

gpsimms

unread,
Jan 23, 2018, 6:12:03 PM1/23/18
to coolprop-users
I think this must be a stupid question, but, here we are.

I am trying to show some undergrads in a thermo class how to use coolprops, and as an example, I just was going to have them look up internal energies of some molecules using coolprops and then check them against the tables in their books.

Here is an example of a call in MATLAB:

>> CoolProp.PropsSI('U','T',400,'P',101325,'CarbonMonoxide')/1000*28
ans =
   1.2040e+04

/1000*28 is to change J/kg to kJ/kmol.

...but in the tables the internal energy for CO at 400 K should be  10,046 kJ/kmol.  

Here is the same call fro CO at 300K:

>> CoolProp.PropsSI('U','T',300,'P',101325,'CarbonMonoxide')/1000*28
ans =
   9.9486e+03

The table value for 300K is 6229 kJ/kmol.  Now, I can see the difference of the two are in agreement. 12040 - 9949 = 2092 kJ/kmol, and the table values are 8319 - 6229 = 2090 kJ/kmol.

Now, for the molecules H2, O2, and N2, the coolprop outputs and the table values are in agreement.  But for CO2 and Air, the tables and coolprop are not in agreement. They do agree on internal energy changes, as in the CO example above.

Does anyone have an explanation of this that I can give to the students?  The textbook I used as a reference is Moran/Shapiro.

Thanks! 

greg

Ian Bell

unread,
Jan 23, 2018, 8:54:49 PM1/23/18
to coolpro...@googlegroups.com
Greg,

I haven't been asked this question in a long time :)  Here is the answer: https://github.com/CoolProp/CoolProp/blob/master/FAQ.md#usage Basically, you need to consider the reference state.  If you do that, all will be well with the world.  Differences between states (should) always agree to within the precision of the given equation of state.

Also, in your first example, to get the molar internal energy directly, you could do:

CoolProp.PropsSI('Umolar','T',400,'P',101325,'CarbonMonoxide')

Please see also http://www.coolprop.org/coolprop/HighLevelAPI.html#table-of-string-inputs-to-propssi-function

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

gpsimms

unread,
Jan 24, 2018, 11:08:44 AM1/24/18
to coolprop-users
Thanks for the quick reply. I thought that was the answer, but my advisor was a bit skeptical about it so he asked me to ask. FWIW, he was surprised by the 233.15 K reference state being commonly used. Anyway, thanks.

Thanks also for the link to the different allowed inputs, I was looking for that.

greg
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,
Jan 25, 2018, 1:05:08 AM1/25/18
to coolpro...@googlegroups.com
Glad that helped.  The reference state is totally arbitrary, but different industries do different things when it comes to reference states.  But -40 C is not *very* common.  Usually these are the standard ones: http://www.coolprop.org/coolprop/HighLevelAPI.html#reference-states

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.

gpsimms

unread,
Feb 21, 2018, 6:54:16 PM2/21/18
to coolprop-users
Hey Ian,

In our thermo class, we are trying to get undergrads to use coolprop as comfortably as they use their textbook thermo tables.  It is going great so far!  I am working a bit ahead on their homework, to make sure everything is making sense on their homework, and I am afraid I have another mundanae undergrad level question follow-up here...

There is a problem in which we are supposed to come up with the heat transfer into a water steam-vapor system in a piston cylinder. It requires internal energy calculations and I am not sure they are working out correctly.


Process 1-2 sees an internal energy increase, and the coolprops calls reflect that...


State 1:


>> CoolProp.PropsSI('U','P',1.5e5,'Q',.2,'Water')
ans =
   8.7742e+05

Between state 1 and state 2 there is a volume increase from .2327 --> .3723 m^3/kg

State 2: 
>> CoolProp.PropsSI('U','P',1.5e5,'D', 1/.3723,'Water')
ans =
   1.1247e+06

So far, so good.  We see the increase in U.

For process 2-3, we have a constant volume process where p and T increase until we hit the saturated vapor point. So internal energy should increase further.
 Using coolprops with constant volume and quality of 1.0...

State 3:

>> CoolProp.PropsSI('U','Q',1.0,'D',1/.3723,'Water')
ans =
   6.4069e+05

Which is lower than both u1 and u2.  What is going on here? 

Thank you for the help!

Ian Bell

unread,
Feb 21, 2018, 10:34:06 PM2/21/18
to coolpro...@googlegroups.com
I think the issue is one of units maybe?  The consistency plots look pretty good for water: http://www.coolprop.org/fluid_properties/fluids/Water.html#consistency-plots

The PropsSI function takes base SI units, and 'D' indicates a mass density, not a molar density.  What density units are you working with?

On my side, I get the same result:

In [7]: PropsSI('rhomass_critical','Water')
Out[7]: 322.00000000000006

In [8]: PropsSI('P','Q',1.0,'D',1/.3723,'Water')
Out[8]: 503572.3888600874

In [9]: PropsSI('T','Q',1.0,'D',1/.3723,'Water')
Out[9]: 425.2494609835173


As always, the best thing is to plot a U,D plot for the fluid and overlay your points to make sure things make sense.  Even the saturation curves would be enough.

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.

gpsimms

unread,
Feb 22, 2018, 12:26:48 PM2/22/18
to coolprop-users
Thanks Ian for the quick reply.

I have played around with it a bit, and can now pinpoint this issue more clearly. It seems like, for an identical state, coolprops outputs a different internal energy depending on which inputs I supply...Sorry for making you check my work here, but hopefully we can find where I am going wrong, or if somehow there is an issue with the software here...

Here is a T-V diagram of the 3 states through which the system moves:


The system moves from states red->green->magenta.  Here are the coolprop calls for each state.


State_1 (given information - saturated liquid vapor mix, q=0.2, P=1.5 bar):


>> T1=CoolProp.PropsSI('T','P',1.5e5,'Q',0.2,'Water')
T1 =
  384.4994
>> U1=CoolProp.PropsSI('U','P',1.5e5,'Q',0.2,'Water')
U1 =
   8.7742e+05
>> D1=CoolProp.PropsSI('D','P',1.5e5,'Q',0.2,'Water')
D1 =
    4.2974
>> V1=1/D1
V1 =
    0.2327

State_2 (given information - heated at constant pressure until V2 = 1.6*V1):

>> V2=1.6*V1
V2 =
    0.3723
>> D2=1/V2
D2 =
    2.6859
>> T2=CoolProp.PropsSI('T','D',D2,'P',1.5e5,'Water')
T2 =
  384.4994
>> U2=CoolProp.PropsSI('U','D',D2,'P',1.5e5,'Water')
U2 =
   1.1248e+06

Everything is looking good so far.  Now we go from state 2->3.  For this step, we are now heating at constant volume until we are a saturated vapor. 

>> D3=D2
D3 =
    2.6859
>> V3=1/D3
V3 =
    0.3723
>> T3=CoolProp.PropsSI('T','D',D3,'Q',1.0,'Water')
T3 =
  425.2474
>> P3=CoolProp.PropsSI('P','D',D3,'Q',1.0,'Water')
P3 =
   5.0355e+05

All of this looks good.  And this is the point plotted in magenta in T-V diagram above.  But when I try to get the internal energy, things get a bit weird.

If I try to get internal energy using the constant density from state 2 and a quality of 1.0, I get a *decrease* in internal energy from the previous state:

>> U3=CoolProp.PropsSI('U','D',D3,'Q',1,'Water')
U3 =
   6.4069e+05

On the other hand, if I use the temperature that I got in the calculation above for T3 and a quality of 1.0, I get a different result:

>> U3=CoolProp.PropsSI('U','T',T3,'Q',1,'Water')
U3 =
   2.5609e+06

*This call gets the right answer which agrees with the thermotables from the book.*
But these two calls correspond to the exact same state, right?  e.g.:

>> D3
D3 =
    2.6859
>> T3
T3 =
  425.2474
>> CoolProp.PropsSI('D','T',T3,'Q',1,'Water')
ans =
    2.6859
>> CoolProp.PropsSI('T','D',D3,'Q',1,'Water')
ans =
  425.2474

One other thing to mention is that if I use P3 and T3 to find U3, I get an error:

>> P3=CoolProp.PropsSI('P','D',D3,'T',T3,'Water')
P3 =
   5.0355e+05
>> U3=CoolProp.PropsSI('U','T',T3,'P',P3,'Water')
Warning: Saturation pressure [503546 Pa] corresponding to T [425.247 K] is within 1e-4 400f given p [503546 Pa] 
Error using CoolPropMATLAB_wrap
Fatal error.
Error in CoolProp.PropsSI (line 2)
  [varargout{1:max(1,nargout)}] = CoolPropMATLAB_wrap(353,varargin{:});

Sorry for all the quoted code.  I thought that was the easiest way to clearly state the issue.  Now that I read back over it all, I am not positive that is true.  Let me know if anything is unclear. It looks to me like there is something up with the internal energy call which is giving two different outputs for the same state depending on which state variables are input.  I don't think this is a units issue as I stuck to density=[kg/m^3] and volume=[m^3/kg] the whole way through.

Thank you again for the help  It is much appreciated!

greg 

gpsimms

unread,
Feb 22, 2018, 1:07:22 PM2/22/18
to coolprop-users
Sorry, was not thinking clearly, the reason for the error in the last call is obvious, since there are many states that correspond to that temperature and pressure, due to the fact that they are the saturation temperature and pressure. But there is still the question regarding the internal energy that I would like answered.

Here it is summed up in a few lines:

>> CoolProp.PropsSI('U','T',T3,'D',D3,'Water')
ans =
   2.5609e+06
>> CoolProp.PropsSI('U','P',P3,'D',D3,'Water')
ans =
   2.5609e+06
>> CoolProp.PropsSI('U','P',P3,'Q',1,'Water')
ans =
   2.5609e+06

>> CoolProp.PropsSI('U','T',T3,'Q',1,'Water')
ans =
   2.5609e+06

>> CoolProp.PropsSI('U','D',D3,'Q',1,'Water')
ans =
   6.4069e+05


So, pressure-density call works, as does temp-density, temp-quality, and pressure-quality.  But for some reason density-quality gives a different output.

Thanks again.

greg

Ian Bell

unread,
Feb 23, 2018, 12:08:30 AM2/23/18
to coolpro...@googlegroups.com
Can you please file an issue on github about this and Ill fix it over the weekend?

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.

gpsimms

unread,
Feb 23, 2018, 9:52:50 AM2/23/18
to coolprop-users
Done.  Thanks for looking into it.
Reply all
Reply to author
Forward
0 new messages