1 | | TBW |
| 1 | Consider the attached test package. The test case represents a simple thermo-hydraulic system with a fixed pressure and temperature source, two series-connected laminar pressure losses and a variable volume, that breathes air in and out through the two pressure losses. |
| 2 | |
| 3 | The two series-connected components generate a nonlinear system of equation in the regular section, which is torn and results in a system with two iteration variables {{{p1}}} and {{{p2}}}. |
| 4 | |
| 5 | If you simulate {{{Test1}}}, the simulation fails at time 0.32. Some analysis reveals that the derivative of the state {{{p2rel}}} is very noise, and that depends on the fact that {{{w}}} is also very noisy. This noise fools the error estimator of the ODE solver, causing it to reduce the time step and to eventually fail because it cannot guarantee the required tolerance. |
| 6 | |
| 7 | By running the test with {{{LOG_NLS_V}}} turned on, several messages "NO ITERATION NECESSARY" pop up, at time instants corresponding to the spikes in {{{w}}} and {{{der(p2rel)}}}. It seems that the code of the default nonlinear solver checks the residuals of the nonlinear system at each new time step, and in case they are below the tolerance [https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/simulationflags.html#simflag-newtonftol NewtonFTol] they accept the solution. This is not good, because also the tolerance on the unknowns [https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/simulationflags.html#simflag-newtonxtol NewtonXTol] should be checked, triggering a few iterations of the solver and guaranteeing that not only the residual is small, but also that the solution is precise enough. |
| 8 | |
| 9 | This problem only affects systems which are badly conditioned from a numerical point of view, but this often happens with thermo-hydraulic systems, in particular when components with small pressure losses are included in the circuit. |
| 10 | |
| 11 | For the record, {{{Test2}}} usese the KINSOL solver, which is not affected by this issue, resulting in the simulation to be successful and only require 14 steps. |