thorade / HelmholtzMedia

Modelica library for the calculation of fluid properties from a Helmholtz energy equation of state (EoS).
BSD 3-Clause "New" or "Revised" License
35 stars 16 forks source link

Remaining issues with HelmholtzMedia in OpenModelica #39

Open thorade opened 4 years ago

thorade commented 4 years ago

newInst Library report, Library coverage, last 7 runs


This is a follow-up ticket for #34, to track the few issues that are left after the release of OpenModelica 1.16. There is a corresponding ticket in OM Trac: https://trac.openmodelica.org/OpenModelica/ticket/6088


  1. Examples.ConvergenceTest.Ancillary_Saturation This goes into a branch of an if-else that I thought is unreachable (this should also not happen)??? After updating the assert message, it is seen that h=nan

  2. Examples.ConvergenceTest.setSat An iteration written by me does not converge, close to the critical point, but it works in Dymola. There is a warning about abs value being negative.

  3. Examples.MediaTestModels.IsopentaneTestModel (during initialization) Failing assert

  4. Examples.Validation.Derivatives_SaturationBoundary (during initialization) fails during initialization, with liq.s and vap.s having same value

  5. Examples.Validation.idealGasLimit this should converge to a certain value, but starts to oscillate because of numerical noise, also with other tools, but at a later point. Might be solved by changing some tolerance or other setting?

thorade commented 4 years ago

Number 3 Isopentane is now also simulating, started to work with https://libraries.openmodelica.org/branches/history/newInst/2020-11-09%2011:30:51..2020-11-09%2020:32:27.html https://github.com/OpenModelica/OpenModelica/pull/6877

thorade commented 3 years ago

Division by zero check: https://github.com/OpenModelica/OpenModelica/pull/7023

thorade commented 3 years ago

OM master switched to newInst on 2020-12-14: https://libraries.openmodelica.org/branches/history/master/00_history.html https://libraries.openmodelica.org/branches/history/master/2020-12-14%2003:04:35..2020-12-14%2022:49:53.html

master Library report, Library coverage, last 7 runs

newInst Library report, Library coverage, last 7 runs

thorade commented 3 years ago
thorade commented 3 years ago

Some models broken due to #45, will be addressed through #33

bilderbuchi commented 2 years ago

With the fix for #48, we are now at 36/41 models simulating: https://libraries.openmodelica.org/branches/master/HelmholtzMedia/HelmholtzMedia.html

A fresh case not yet mentioned is Examples.ConvergenceTest.SinglePhase_setState_pramp_Tsine , which tells about setSat_p not converging.

bilderbuchi commented 2 years ago

Examples.Validation.idealGasLimit this should converge to a certain value, but starts to oscillate because of numerical noise, also with other tools, but at a later point. Might be solved by changing some tolerance or other setting?

Some of the problems stem from density being prescribed to go below its lower limit (Modelica.Constants.small). I guess something like

  when d < 2*Modelica.Constants.small then
    terminate("Stopping before hitting the density limit");
  end when;

could help with that at least.

thorade commented 2 years ago

I have change the stop time of that example in https://github.com/thorade/HelmholtzMedia/commit/224effca7609908e66ef175d9e6fc933f5d559d0

thorade commented 2 years ago

also see #40 for the convergence criterion

thorade commented 2 years ago

It would be interesting to see where this NaN during initialization is coming from: https://libraries.openmodelica.org/branches/master/HelmholtzMedia/files/HelmholtzMedia_HelmholtzMedia.Examples.Validation.Derivatives_SaturationBoundary.sim

bilderbuchi commented 2 years ago

Funny, when I simulate that model locally with current HH master, OM 1.18, MSL 3.2.3, Win10, I get another error:

Model error: Argument of log(1.0 - exp(e[i,2] * tau)) was 0 should be > 0
simulation terminated by an assertion at initialization
Simulation process failed. Exited with code 0xffffffffffffffff.

Possibly connected? Sadly, I did not manage to trace where this error comes from, either.