thermotools / thermopack

Thermopack is a thermodynamic model library for fluid properties and PVT calculations
Other
51 stars 13 forks source link

Introduce robustness flag. #116

Closed ailoa closed 10 months ago

ailoa commented 11 months ago

TP flash routines for MEOS are very unstable if one skips stability check after successive substitutions. Since one often wants robustness over speed, I introduced a flag to control this. The idea would be to use this flag across modules.

vegardjervell commented 11 months ago

This looks like a nice addition, and think its a good idea to have this as a "level" rather than just a boolean on/off flag. That will make it more flexible for future development. But I have a couple questions/requests:

1) Is there any intent for how the behaviour should change for robustness_level > 1? I think it would be nice to indicate in routines that use the robustness_level what the "maximum" value is, after which increasing it further will have no effect.

2) Could you add a corresponding get method, so that we can read out the robustness_level from the python side?

ailoa commented 11 months ago
  1. Not any clear idea per now, it was set as an integer for future flexibility. But increasing it above 1 could mean increasing the number of initial guesses or so on.
  2. Thanks for the suggestion, added get function now.
morteham commented 10 months ago

Great! Currently the flag is set globally for all model instances. Does It make sense to apply the flag only to a given model instance? And also to set the robustness level to 1 in the MEOS constructor?