usnistgov / REFPROP-issues

A repository solely used for reporting issues with NIST REFPROP
26 stars 13 forks source link

Inconsistent and missing SoS and other properties calculations by REFPROP.XLA (v. 9.1), REFPROP.XLA (v. 10) and REFPROP Windows App #540

Open SATE-Attilio opened 2 years ago

SATE-Attilio commented 2 years ago

Hello please find here attached supporting files and an issue description as summarised here below. Best regards Attilio Brighenti S.A.T.E. Systems and Advanced Technologies Engineering S.r.l. Venice (Italy)

Summary:

Inconsistent and missing calculations by REFPROP.XLA (v. 9.1), REFPROP.XLA (v. 10) and REFPROP Windows App of the speed of sound (as well as Cp, Cv and Cp/Cv) with a natural gas mixture.

Attached files:

NIST_SATE_support_case_220826.zip including:

1) REFPROP_10_NG_sample_SoS_issue_00ab220826.xlsx This is an example Excel file where one first issue appears, with the formulae to access REFPROP 10 are used to calculate SoS and other properties of a natural gas mixture. The cells in yellow in columns B and C have the input data, the others are calculated. Columns O to Q show the only values calculated by REFPROP Windows app setting the EOS as Peng Robinson Columns S to U show the values calculated by REFPROP,XLA under version 9.1 (copie and pasted from a parent file that worked well with exactly the same mixture and pressure and temperature ranges. Note: i am aware that the mixture crosses the saturation boundary in the p,T range of interest.

2) Results table files NG_tables_1_2_3_4.txt NG_tables_1_2_6.txt Obtained by the Windows App with the following preferences (see accompanying preferences screenshots named NG_sample_preferences_x.JPG (x = 1,2,3,4, 6) Pref. 1: default EOS Pref. 2: GERG-2008 EOS Pref. 3: AGA8 EOS Pref. 4 & 6: Peng Robinson EOS (applied respectively to tables 4 and 6, having just different pressure values list)

3) Screenshots of the results and iteration error message appearing with prefs, NG_sample_table_x.JPG (errors appear with prefs 1,2,3

4) mixture composition file NG_sample.mix

Description

1st issue: In Excel REFPROP 10 on Excel does not converge for the example pressures from 25 to 70 bar a, while REFPROP 9.1 did. It is unclear, however what EOS is run under Excel, with the function called in the cells, e.g. in cell J13 ... =SpeedOfSound(Gas_mixture,"TP","SI with C",B13,C13/10) Note that the name "Gas_mixture", corresponds to cell B65 where the formula = FluidString(A68:A83,B68:B83) generates the mixture molar composition defined in the Excel file (range A68 to B83). ...

2nd issue: To verify the origins of the 1st issue I explored with REFPROP v. 10 App in Windows the results with the different EOS preferences above mentioned and with exactly the same mixture and composition (file NG_sample.mix) Unexpectedly the App version does not converge at all pressure values where the Excel version does (e.g. for p >= 75 bar a), while for lower values the distinct SoS values are calculated for the liquid and vapour phases (which would be fine if available also in Excel) The default EOS gets error 226 at 85 bar a The GERG 2008 EOS gets error 226 at 95 bar a The AGA8 EOS gets error 213 at 30 bar a The PR EOS proceeds with no errors at all pressures yet it calculates only the Vapour phase SoS, while the the fits two calculate SoS for both liquid and vapour.

Steps to Reproduce

  1. [First Step] Open the Excel file to see how the REFPROP v. 10 and 9.1 compare with the only available data set from the Windows REFPROP calculations (Peng Robinson) (where converging REFPROP 9.1 and 10 overlap, but the latter misses the low pressure values)

  2. [Second Step] Use REFPROP 10 with the mixture provided to verify the tables files obtained

  3. [Third step] Open the Tables screenshots to verify the error got with the various EOS preferences

Expected behavior: I would expect: a) that for a same EOS option the EXCEL and the Windows REFPROP would generate the same values and would fail (if any) at the same p, T conditions) b) that the Speed of Sound, Cp and Cv are calculated and produced throughout a continuous p & T range, even if distinct for the liquid and vapour phase, when coexisting.

Actual behavior: In Excel REFPROP 9.1. produces a continuous set of values REFPROP 10 produces a values only above a certain pressure (75 bar a for the case of T = 30 °C) In either cases it is unclear what option of EOS is used in Excel, which instead should be transparent (Note that this same need applies under MATLAB)

Versions

REFPROP Version: 10 vs. 9.1 Operating System Microsoft Windows 10 Pro Version 10.0.19044 Build 19044

NIST_SATE_support_case_220826.zip Access Method: EXCEL and Windows batch App

Additional Information

If possible, please post examples and/or screenshots of the issue. See attached files in compressed file NIST_SATE_support_case_220826.zip

SATE-Attilio commented 2 years ago

I add one important strange point: the 2nd issue (in REFPROP 10 for Windows) does not occur, even with the GERG 2008 EOS option, if the "isoproperty table" is used instead of the "specified state point". This means that for a same p and T and gas mixture composition REFPROP 10 provides SoS and density, with no error messages values if the isoproperty table (including selected same specified p and T) is run, instead of the specified state point command. The problem holds for the Excel environment (1st issue). NIST should clarify, please

ianhbell commented 2 years ago

Did you enable or not the saturation splines consistently?

SATE-Attilio commented 2 years ago

Thanks Ian, could you pelase clarify? do you refer to the Windows App or the Excel? can you address to the user manual relevant pages? or other documents?

ianhbell commented 2 years ago

Good place to start: https://github.com/usnistgov/REFPROP-wrappers/issues/106

In the GUI, it is this option:

image

SATE-Attilio commented 2 years ago

I confirm that In the REFPROP App for Windows I had left set (as per default) the option you highlight. See any of the files NG_sample_preferences_x.JPG (x = 1,2,3,4,6) that I attached to the query (in file NIST_SATE_support_case_220826.zip). I understand, however, that this acts only on the Windows App, not on the Excel REFPROP.XLA. Therefore anyway the inconsistent behaviour remains. I will go through the suggested reference (What to do when the Excel Add-in fails to converge for mixture calculations. #106) and inform you. Please, anyway consider the different behaviour between specified state points and isoproperty tables in the Windows App, still occurring. Best regards Attilio

SATE-Attilio commented 2 years ago

Dear Dr. Bell

I have answered in GitHub

I confirm that In the REFPROP App for Windows I had left set (as per default) the option you highlight. See any of the files NG_sample_preferences_x.JPG (x = 1,2,3,4,6) that I attached to the query (in file NIST_SATE_support_case_220826.zip). I understand, however, that this acts only on the Windows App, not on the Excel REFPROP.XLA. Therefore anyway the inconsistent behaviour remains. I will go through the suggested reference (What to do when the Excel Add-in fails to converge for mixture calculations. https://github.com/usnistgov/REFPROP-issues/issues/106 #106) and inform you. Please, anyway consider the different behaviour between specified state points and isoproperty tables in the Windows App, still occurring. Best regards Attilio

From: Ian Bell @.> Sent: 01 September 2022 23:55 To: usnistgov/REFPROP-issues @.> Cc: SATE-Attilio @.>; Author @.> Subject: Re: [usnistgov/REFPROP-issues] Inconsistent and missing SoS and other properties calculations by REFPROP.XLA (v. 9.1), REFPROP.XLA (v. 10) and REFPROP Windows App (Issue #540)

Good place to start: usnistgov/REFPROP-wrappers#106 https://github.com/usnistgov/REFPROP-wrappers/issues/106

In the GUI, it is this option:

https://user-images.githubusercontent.com/11966765/188019676-18c2eefd-a4f0-4bfa-8e0f-5f8560257c80.png

— Reply to this email directly, view it on GitHub https://github.com/usnistgov/REFPROP-issues/issues/540#issuecomment-1234822311 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ALNT4MXRRQWXKE7R25W234LV4EQ23ANCNFSM57XN6HUQ . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ALNT4MV3YHWDTMVUZ2PNSKTV4EQ23A5CNFSM57XN6HU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJGM6JJY.gif Message ID: @. @.> >

SATE-Attilio commented 2 years ago

Dear Dr. Bell I have tried to set the "iFlag" as suggested, but, even by changing the functions call syntax in Excel from the v. 9 format, e.g. =Density(fluid, etc.) to the v, 10 syntax, e.g. =REFPROP("D",fluid, etc.), there are still and even more error messages resulting in the sample spreadsheet I shared (file REFPROP_10_NG_sample_SoS_issue_00ab220826.xlsx). Could we have a telco next week at convenient day and time for you? Best regards Attilio

SATE-Attilio commented 2 years ago

Dear Dr. Bell

I replied further after testing the “iFlag” change, but things got worse.

Could we have a telco next week, so that we could interact better?

I think there are different issues, yet overlapping for our purposes:

Best regards

Attilio

From: SATE - Attilio Brighenti @.> Sent: 02 September 2022 08:57 To: 'usnistgov/REFPROP-issues' @.> Subject: RE: [usnistgov/REFPROP-issues] Inconsistent and missing SoS and other properties calculations by REFPROP.XLA (v. 9.1), REFPROP.XLA (v. 10) and REFPROP Windows App (Issue #540)

Dear Dr. Bell

I have answered in GitHub

I confirm that In the REFPROP App for Windows I had left set (as per default) the option you highlight. See any of the files NG_sample_preferences_x.JPG (x = 1,2,3,4,6) that I attached to the query (in file NIST_SATE_support_case_220826.zip). I understand, however, that this acts only on the Windows App, not on the Excel REFPROP.XLA. Therefore anyway the inconsistent behaviour remains. I will go through the suggested reference (What to do when the Excel Add-in fails to converge for mixture calculations. https://github.com/usnistgov/REFPROP-issues/issues/106 #106) and inform you. Please, anyway consider the different behaviour between specified state points and isoproperty tables in the Windows App, still occurring. Best regards Attilio

From: Ian Bell @. @.> > Sent: 01 September 2022 23:55 To: usnistgov/REFPROP-issues @. @.> > Cc: SATE-Attilio @. @.> >; Author @. @.> > Subject: Re: [usnistgov/REFPROP-issues] Inconsistent and missing SoS and other properties calculations by REFPROP.XLA (v. 9.1), REFPROP.XLA (v. 10) and REFPROP Windows App (Issue #540)

Good place to start: usnistgov/REFPROP-wrappers#106 https://github.com/usnistgov/REFPROP-wrappers/issues/106

In the GUI, it is this option:

https://user-images.githubusercontent.com/11966765/188019676-18c2eefd-a4f0-4bfa-8e0f-5f8560257c80.png

— Reply to this email directly, view it on GitHub https://github.com/usnistgov/REFPROP-issues/issues/540#issuecomment-1234822311 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ALNT4MXRRQWXKE7R25W234LV4EQ23ANCNFSM57XN6HUQ . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ALNT4MV3YHWDTMVUZ2PNSKTV4EQ23A5CNFSM57XN6HU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJGM6JJY.gif Message ID: @. @.> >

SATE-Attilio commented 2 years ago

Dear Dr. Bell I confirm my last findings after having resaved and moved to the c:\Program Files (x86)\REFPROP\ folder the macro enabled Add in REFPROP.xlam, created by the original REFPROP.xls. I also reset the Add-In location in the Excel Options (to avoid ambiguities) in the same path and linked the example file I sent you to the same. Then I retried setting the SATSPLN iFlag either = 0 (commented line) or =1 (uncommented line) Mo changes resulted from the previous tests. The convergence problems are occurring in more cases with the iFlag ON than with OFF.

with iFlag = 0 (commented line the following error appears (e.g. for "Z" at 30°C and 25 bar a);

[REFPROP error 810] One or more of the input properties is not thermophysically defined for two-phase states and cannot be calculated.

with iFlag = 1 (commented line the following error appears (e.g. for "Z" at 30°C and 25 bar a);

1) (at 20°C and 25 bar a)

[REFPROP error 810] One or more of the input properties is not thermophysically defined for two-phase states and cannot be calculated.

2) (at 20°C and 90 bar a)

[TPFL2 error 226] 2-phase iteration did not converge.

The only available option to turn around this problem, at present, is to calculate the missing values on REFPROP app, using the isoproperty table generated therein and copy (as frozen values) the results in Excel. Of course this is not a suitable option for other sets and mixtures calculations. So I would welcome clarifications on options to be set or warnings about the reasons for non convergence.

I am not complaining about REFPROP that is a very powerful tool, but would hope to contribute to its improvement. Best regards Attilio

SATE-Attilio commented 2 years ago

Hello I made slight variation tests to the mixture to see if the Excel callback to REFPROP.xlam improved. Actually I found that by removing the dodecane fraction and increasing by its same amount the nitrogen one avoids the error generated. Instead the errors remain by making other changes of the smallest fractions. The uploaded files show this, as follows: 0 - REFPROP_10_NG_sample_SoS_issue_03ab220905.xlsx (original NG sample mixture: errors at p = 5 to 75 bar a) 1 - REFPROP_10_NG_sample_SoS_issue_03ab220905_mix_var_1.xlsx (shift of H2S fraction to N2: errors at p = 5 to 75 bar a) 2 - REFPROP_10_NG_sample_SoS_issue_03ab220905_mix_var_2.xlsx (shift of CO2 fraction to N2: errors at p = 5 to 75 bar a) 3 - REFPROP_10_NG_sample_SoS_issue_03ab220905_mix_var_3.xlsx (shift of C12 fraction to N2: NO ERRORS) 4 - REFPROP_10_NG_sample_SoS_issue_03ab220905_mix_var_4.xlsx (shift of C12 fraction to C10: errors at p = 5 to 75 bar a) 5 - REFPROP_10_NG_sample_SoS_issue_03ab220905_mix_var_5.xlsx (shift of C12 fraction to C9: errors at p = 5 to 75 bar a)

As reported before I made trials setting the SATSPLN iFlag either = 0 (commented line) or =1 (uncommented line) The issue is still open and a bit strange as the calculations fail not on the topmost side of the 2phase region of the mixture but in the middle (see attached T-P plot) REFPROP_10_NG_sample_SoS_issue_03ab220905.xlsx REFPROP_10_NG_sample_SoS_issue_03ab220905_mix_var_1.xlsx REFPROP_10_NG_sample_SoS_issue_03ab220905_mix_var_2.xlsx REFPROP_10_NG_sample_SoS_issue_03ab220905_mix_var_3.xlsx REFPROP_10_NG_sample_SoS_issue_03ab220905_mix_var_4.xlsx REFPROP_10_NG_sample_SoS_issue_03ab220905_mix_var_5.xlsx NG_sample_00ab220913_rho_p_T_5.pdf

Best regards Attilio