Closed casella closed 10 years ago
Thank you for the bug report, I have edited it a bit and moved parts of it:
Added the test from your file, thanks. If I understand correctly, one should run the simulation and check that
d_p
is equal to d_p_int
d_h
is equal to d_h_int
d_p_diff
is equal to zerod_h_diff
is equal to zerod_p_err
is equal to zerod_h_err
is equal to zeroCorrect?
Using Butane, the simulation runs nicely and d_p_err
and d_h_err
are smaller than 1e-8
.
Now I'll start investigating why the simulation fails for Helium.
The error message suggests to increase the size of Sizebuffer
.
Increasing it by a factor of 10 did not change the error message at all.
The highest level function in the error message is setState_ph
. In commit e71c7a361415485206c4c969e8f1272f849841f4 some print
commands have been added. At the time of the error, the fluid is in the super-critical liquid-like region with p=230000
(above critical pressure) and h=-2165.19
(below critical enthalpy). Using these values directly, the setState_ph
function converges (with 95 Newton iterations! That is slow!).
So, still unclear to me where the error comes from.
With the changed start values, the test simulation does now run. Seems like it was due to the many Newton iterations in the setState_ph
function.
Changing the start values is always dangerous, because it might help in some cases but break others, so in the future watch out for new errors in the super-critical liquid-like region!
A few comments regarding the integration test. In principle what you wrote above is correct. In practice, some integration error is inevitable, though one can keep it low by selecting a tight integration tolerance. The tests are set with a relative tolerance of 1e-10, so the relative errors d_p_err and d_h_err should have that order of magnitude (or less). In practice, a relative error of 1e-8 or even 1e-6 (which is then due to inconsistencies between the density function and its derivatives, not by integration errors which are much smaller) would still be acceptable, considering that this error eventually causes a lack or excess of mass of the same order of magnitude during transients in closed circuits where the pressure or the enthalpy spans the same interval.
Thanks! The test case now works fine.
Francesco
Il 22/09/2014 10:26, Matthis Thorade ha scritto:
Closed #22 https://github.com/thorade/HelmholtzMedia/issues/22.
— Reply to this email directly or view it on GitHub https://github.com/thorade/HelmholtzMedia/issues/22#event-168318242.
Francesco Casella - Ph.D. Dipartimento di Elettronica, Informazione e Bioingegneria Politecnico di Milano Via Ponzio 34/5 I-20133 MILANO - ITALY
Tel: +39-02-2399-3465 (Leonardo) +39-02-2399-7749 (Polo di Cremona) Fax: +39-02-2399-3412 e-mail: francesco.casella@polimi.it web: http://home.dei.polimi.it/casella Skype: callto://francesco.casella
We are trying to use the Helium model for cryogenic system studies, possibly using OpenModelica. We already found some issues using Dymola. Please download this small package which allows you to reproduce them: http://home.deib.polimi.it/casella/transfer/HelmholtzBugs.mo
We have built a test case, named
CheckDerivativesHeliumHelmholzFluids
, to check the consistency of density derivatives by integrating them, and then comparing the result with the actual density changes. The model has been tested with other media (e.g., IF97 water, or ExternalMedia models of Helium) and it works. When using the Helium model of your library, if fails with this error message:It looks pretty much low-level, can you have a look at it?