Open casella opened 2 years ago
It seems that setState_pT picks the wrong enthalpy for some reason:
Unfortunately this issue is still there in version 3.3.2, updated to the latest version of CoolProp.
This is maybe an upstream (i.e. Coolprop) issue, I can reproduce this reading using the Python wrapper:
In [1]: import CoolProp
In [2]: HEOS = CoolProp.AbstractState("HEOS", "CO2")
In [3]: TTSE = CoolProp.AbstractState("TTSE&HEOS", "CO2")
In [4]: BICU = CoolProp.AbstractState("BICUBIC&HEOS", "CO2")
In [5]: HEOS.update(CoolProp.PT_INPUTS, 90e5, 308); BICU.update(CoolProp.PT_INPUTS, 90e5, 308); TTSE.update(CoolProp.PT
...: _INPUTS, 90e5, 308)
In [7]: print(HEOS.rhomass(), TTSE.rhomass(), BICU.rhomass())
665.3674051097354 905.0585107989239 636.4883422212183
In [9]: CoolProp.__version__
Out[9]: '6.4.3'
In [10]: HEOS.update(CoolProp.PT_INPUTS, 90e5, 306); BICU.update(CoolProp.PT_INPUTS, 90e5, 306); TTSE.update(CoolProp.P
...: T_INPUTS, 90e5, 306)
In [11]: print(HEOS.rhomass(), TTSE.rhomass(), BICU.rhomass())
702.8534640782832 705.8648349168404 684.6191073389101
(checked two relevant points only, irrelevant lines elided)
I looked in the issue tracker, the most relevant-sounding issues I could find are https://github.com/CoolProp/CoolProp/issues/1301 https://github.com/CoolProp/CoolProp/issues/1437 (for the bicubic method, though)
@jowr ?
I have adapted the script from here to show the issue. This seems to show some periodicity, but especially severe in your region of interest:
I just tried out the newly released 3.3.1 version using Dymola 2022 under Windows 10, 64 bits. The examples in the ExternalMedia library seem to work fine.
I then tested the BICUBIC and TTSE CO2 medium model. I confirm that the issue I had in #29 is now fixed, the first time I ran the model it took some time to generate the tables, and then the simulation ran correctly. Subsequent simulations went like a breeze.
I tested the CO2 medium model on an isobaric line at 90 bars, which is supercritical, but not too much, so I expect to see significant real-gas effects. The setState_pT function is used, see the test model TestInterpolatedCO2.mo.txt. I report the plots of density:
There is clearly a problem with the TTSE interpolation between 85 and 150 bars. Above 150 bars, all seems fine. @jowr, could you please have a look?