usnistgov / REFPROP-wrappers

Wrappers around NIST REFPROP for languages such as Python, MATLAB, etc.
195 stars 127 forks source link

How to update refprop to 10.0.0.02? (or fix 2-phase enthalpy/density issues on v10.0) #520

Closed ChemicalDave closed 6 months ago

ChemicalDave commented 1 year ago

TL;DR

In short, I’d like to request an update (or instructions on how to update) to my refprop version and excel add-in, as the current version of 10.0 is not providing accurate results whilst my coworker’s 10.0.0.02 appears to be. I do not know how to update to the newest version of REFPROP .DLL and .XLS, nor does my coworker.

Instructions on how to update refprop would certainly suffice, but for the technically curious, feel free to continue reading: REFPROP.exe and Excel using refprop banner provide different results, causing issues

Description

We both use an identical file of excel to calculate enthalpy of a mixture at a certain temp/pressure (which is used in equations to calculate temperature change across a reaction). The only difference between our computers was our refprop versions, shown here: I use REFPROP.xls version 10.0, and REFPROP DLL version 10.0 [the erroneous setup] My coworker uses REFPROP.xls v10.0.0.01 and REFPROP.dll v10.0.0.02 [the accurate setup]

There appears to be a difference between REFPROP and EXCEL when calculating enthalpy (and density!), so I have provided a excel file that recreates a discrepancy highlighted in the image at the bottom. Both of our refprop programs are set to use default reference state for enthalpy.

Steps to Reproduce

In EXCEL and REFPROP:

  1. Create a user-defined mixture with species (mole fraction) of: CO2 (0.074) -- O2 (0.044) -- N2 (0.722) -- H2O (0.160)

  2. Ensure the Reference State (under options in Refprop) is set to: Use the default reference state

  3. Calculate a specified state point of 70 F, 16.00 psia, ask refprop to determine the density and enthalpy

  4. Repeat for a specified state point of 140 F, 16.00 psia.

Desired (correct) behavior: Refprop and Excel should be reporting the same values for their respective state points, which using v10.0.0.02 successfully does.

Current (erroneous) behavior: The excel v10.0 behavior instead reports an bad enthalpy in excel for the 2phase (70 F) condition, as well as density.

It's worth noting that there is no such thing as a "correct" enthalpy value for any given mixture at T/P, as enthalpy is relative. However, the multiple values that the excel model uses refprop to calculate result in deviation of results, even though the excel file is identical (only the refprop DLL and XLS version change).

Versions

REFPROP Version: v10.0 both XLS and DLL, and v10.0.0.01 XLS + v10.0.0.02 DLL for coworker Operating System and Version: Windows 11 and Windows 10 respectively
Access Method: Excel, as well as REFPROP program

Additional Information

In summary, REFPROP v10.0, REFPROP v10.0.0.02, and REFPROP Excel .XLS v10.0.0.01 seem to report accurately. However, REFPROP Excel .XLS v10.0 seems to report different values. I think updating to the newest .DLL and .XLS may fix the problem, but I don't know how.

The below image shows refprop DLL v10.0, calculating density and enthalpy, as well as excel v10.0 performing the same calculations. image

This link should provide a way to download the excel file producing these erroneous results in the screenshot https://docs.google.com/spreadsheets/d/187jZlK66dvAyn3mRG74mnSjKtUYB3Dof/edit?usp=share_link&ouid=103021653056063346831&rtpof=true&sd=true

This may or may not be related to a previous thread, where I observed the v10.0 reference state adjusting enthalpy with composition, causing issues with enthalpy conservation when mixing or changing composition: https://github.com/usnistgov/REFPROP-issues/issues/542

ChemicalDave commented 1 year ago

A follow up comment on density:

The density is somehow more confusing. I calculated density using both S.R.K. and Peng-Robinson property packages in separate program, they have determined:

The process simulator calculates a 2-phase mixture density of 0.09155 lbm/ft3 for 70 F, and a density of 0.06916 lbm/ft3 for 140 F. The "correct" enthalpy version (v10.0.0.02) calculates a density of 0.07831 lbm/ft3 for 70 F, and a density of 0.06912 lbm/ft3 for 140 F The "incorrect" enthalpy version (excel v10.0) calculates a density of 0.09099 lbm/ft3 for 70 F, and a density of 0.06912 lbm/ft3 for 140 F.

So, Refprop seems to perhaps miss the mark on 2-phase density, which may be reasonable given the heterogeneous nature of a 2-phase mixture. What surprises me most of course is just that the density is inconsistent as well as enthalpy, if referring to the DLL vs the XLS, despite both aligning for a single-phase mixture.

ianhbell commented 1 year ago

First step: send me an email (ian.bell@nist.gov) and we'll get you up to 10.0.0.02