cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

CoolProp 6.3.0 Released - Wrappers for Mathcad 15 and Prime

JeffH1
15-Moonstone

CoolProp 6.3.0 Released - Wrappers for Mathcad 15 and Prime

Since we can't post on the Tips forum, I'll leave this here...

 

Coolprop version 6.3.0 is released.  Coolprop is an open-source C++ library that implements:

  • Pure and pseudo-pure fluid equations of state and transport properties for 122 components
  • Mixture properties using high-accuracy Helmholtz energy formulations
  • Correlations of properties of incompressible fluids and brines
  • Highest accuracy psychrometric routines (Humid Air properties) 
  • User-friendly interface around the full capabilities of NIST REFPROP (if you own REFPROP already)
  • Fast IAPWS-IF97 (Industrial Formulation) for Water/Steam

Fully featured wrappers are available for both Mathcad 15 and Mathcad Prime as Add-in DLLs.  Documentation can be found at http:/www.coolprop.org.  Instructions for downloading the Add-in wrappers from SourceForge for either version of Mathcad can be found here.  A Mathcad worksheet is included with the DLL that demonstrates how to use the add-in.

ACCEPTED SOLUTION

Accepted Solutions
JeffH1
15-Moonstone
(To:ValeryOchkov)

Yep.  That's .045% relative error in Cp between IF97 and IAPWS-95.  To be expected.  These are the differences between IAPWS-95 and IF97.

 

The IF97 computational validation points match the verification points in IAPWS R7-97(2012) to 8 decimal places in most cases.

View solution in original post

22 REPLIES 22

The CoolPro uses the IAPWS-95 not the IAPWS-IF97 formulation! It is a bag!

JeffH1
15-Moonstone
(To:ValeryOchkov)

Not true.  I spent the last year coding IF97 into it.  You just use the fluid "IF97::Water" instead of "Water".  This calls the IAPWS-IF97 backend, which is now included.  See the docs.

 

The Mathcad add-in was re-implemented in version 6.0.0 and full IF97 was implemented in 6.2.0.

Last Maple uses CoolProp with IAPWS-95 formulation!

One my fine picture
iapws95-97surface.PNG

JeffH1
15-Moonstone
(To:ValeryOchkov)

Again, please read the documentation.   Just use the fluid "IF97::Water" instead of just "Water" or "HEOS::Water"; the HEOS implementation is IAPWS-95.  There's no reason this won't work in the Maple wrapper as well.  It's been tested in Python, Mathcad, and Excel wrappers.  You might have to download the latest version of CoolProp if Maple is distributing an older version.  Version 6.3.0 is hot off the press, so I doubt they have it yet in their distribution.

JeffH1
15-Moonstone
(To:ValeryOchkov)

I see that the latest Maple 2018 release only includes CoolProp 6.1.0.  I believe that IF97 is only partially implemented in that release of CoolProp.  That was about when I started working on it.

Cool Prop IF97 vs WaterSteamPro

8-КПД-Plots-Cool_Prop.png

JeffH1
15-Moonstone
(To:ValeryOchkov)

@ValeryOchkov What is the JeffH1_0-1701310920046.png function that you are plotting against the Liquid Saturation Temperature? 

 

What are the parameters being passed in?

JeffH1
15-Moonstone
(To:ValeryOchkov)

@ValeryOchkov - Thanks for this.  I've looked at your SMath document and reproduced it in Mathcad, with errors.  Indeed there is an error when using IF97, but not using the default HEOS for water (which uses IAPWS-95) and not in the IF97 backend.  The trick is that your efficiency function makes a few calls to the backward formulation for h(p,s).  There is no function documented in the IF97 release for this so CoolProp has evaluate it manually in all phase regions, which is fairly straight forward.  In the two-phase region, however, it requires a lever law calculation, which is not being evaluated correctly (although I'm not sure why yet).   I will look into this and make sure something gets into the next patch release.

JeffH1
15-Moonstone
(To:ValeryOchkov)

If you are making the Coolprop call to "H2O" you are using the IAPWS-95 functions.  IF97 requires "IF97::H2O" or "IF97::Water".

53.png

JeffH1
15-Moonstone
(To:ValeryOchkov)

Yep.  That's .045% relative error in Cp between IF97 and IAPWS-95.  To be expected.  These are the differences between IAPWS-95 and IF97.

 

The IF97 computational validation points match the verification points in IAPWS R7-97(2012) to 8 decimal places in most cases.

JeffH1
15-Moonstone
(To:JeffH1)

@ValeryOchkov 

 

After some time, I was able to reproduce your SMath document in Mathcad Prime and verify the issue with CoolProp.  It was easy to verify, not so easy to figure out why it was occurring.

 

The issue stems from the fact that:

  1. IF97 does not provide functions of h(p,s).  These have to be evaluated by calculating temperature from T(p,s) and then using h(T,p) to get enthalpy.  These functions involve some uncertainties (±25 mK) that can provide (T,p) state points that are just slightly on the wrong side of the saturation curve, returning enthalpies in the vapor phase rather than the liquid phase.
  2. This problem was exacerbated by calculating saturation temperature (Tk, T'H2, T'H1, etc.) from pressure using Tsat(p), which has some uncertainty (±0.007%). The efficiency function then uses that temperature to get saturation enthalpy/entropy from h'(T) and s'(T), which do not exist in IF97, so the code has to convert Temperature back to saturation pressure (adding another ±0.007% uncertainty) and then calling h'(p) and s'(p).  These errors can be removed by calling the saturation functions of pressure h'(p) and s'(p) directly without evaluating the saturation temperature at all.  This removes the uncertainties added and (mostly) returns enthalpies and entropies on the correct side of the saturation dome.

However, the saturation temperature from the reverse functions T(p,s) and T(p,h) should still be returning values that are limited to the correct phase, depending on the input state point.  This has been corrected in CoolProp (Github.com/CoolProp/CoolProp PR#2404) and it's underlying IF97 backend (Github.com/CoolProp/IF97 PR#49) to behave more robustly very near the saturation curve, which is where the efficiency equation operates.  Here are the efficiency plots (reproduced in Mathcad Prime) using both the native HEOS (IAPWS-95) and IF97 backends for Water.

 

JeffH1_0-1723450346174.png

JeffH1_1-1723450373652.png

 

These robustness improvements to the reverse functions will be included in the next release of CoolProp (6.6.1).  However, the improvements are included in the nightly build on SourceForge (v6.6.1dev) of the current development version.

 

JeffH1
15-Moonstone
(To:JeffH1)

The CoolProp 6.3.0 binaries have been verified using the new release of Mathcad Prime 6.0.

 

 

I'm a longtime user of Mathcad 15 with steam table extension and a novice using Prime.  I've copied the latest CoolProp .dll file to the "Custom Functions" folder but Prime doesn't recognize any of the thermodynamic functions.  I'm looking for some help using CoolProp in Mathcad Prime.

The best stwem tables for Prime 6 is WaterSteamPro 

Cp.png

JeffH1
15-Moonstone
(To:RM_4611061)

Make sure you've got the correct DLL.  The one for Mathcad 15 is 32-bit, while the one for Mathcad Prime is 64-bit and compiled specifically for Mathcad Prime.

 

1. With the DLL in place, restart Mathcad Prime and enter, CustomFunctions= .  If the DLL is the correct one, and properly installed, you will see the following list of functions available from the DLL:

JeffH1_0-1600951678499.png

If you do not see this list of functions, you do not have the correct DLL.

 

2. Also on SourceForge, where you got the DLL, is an example Mathcad Prime file called CoolPropFluidProperties.mcdx.  Once the DLL is installed properly, download and open this file in Mathcad Prime and press <Ctrl>-F5 to update all equations.  This document will show you how to use the functions.

 

Hope this helps.

Jeff

 

 

Jeff,

 

Thanks that all helped me lumber through this problem.

 

With your insights I continued searching until I found that the Mathcad Prime DLL for CoolProp revision 6.3.0 seems to work work well for me.  I can list the functions with CustomFunctions= and all of the functions I've tried so far return expected results.

 

None of the newer revision DLL files work at all for me and some of the earlier revisions crash when trying to execute the get_global_param_string.  Another note, an agent from PTC was able to get the most recent revision, 6.4.1, to work with his set up.

 

For now I can proceed with a complex MC 15 to Prime 6 thermodynamic analysis conversion and hopefully in the future get the newest revision to work.  

 

Thanks again for your much needed help!

 

Rob Mock

SPRstructur
15-Moonstone
(To:JeffH1)

Coolprop, may the software I never know,What important of coolprop for mathcad ?

I believe they are functions and tables that import standard thermodynamic properties into Mathcad.  There is also WatersteamPro.

JeffH1
15-Moonstone
(To:SPRstructur)

Yes, @Fred_Kohlhepp is correct.  CoolProp is an open source library of functions that provide thermodynamic and thermo-physical properties of 120+ pure fluids, mixtures, over 35 incompressible fluids, and Humid Air properties (based on ASHRAE equations).  It also provides an easy to use interface to IF97 water/steam properties (built-in) and NIST REFPROP (if installed).  You can find out more at http://www.coolprop.org

JeffH1
15-Moonstone
(To:JeffH1)

Note that CoolProp 6.6.0 is now released and the DLL for Mathcad Prime is autogenerated on SourceForge for this release (along with a sample worksheet).

Announcements

Top Tags