-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Describe the bug
When running MetroscopeModelingLibrary.Tests.WaterSteam.Machines.Pump_reverse in OpenModelica, the following error is generated:
Matrix singular!
under-determined linear system not solvable!
nonlinear system 35 fails: at t=0
Opening the debugger shows that system 35 has one unknown (pump_b3) and one scalar residual, coming from
rh = noEvent(max(if (R > 1e-5) then b1*Qv_in^2/R^2 + b2*Qv_in/R + b3 else b3, rhmin));OpenModelica is trying to invert this equation to compute b3, given all the other variables and parameters. Unfortunately, the boundary conditions correspond to rh = 0.19 (we checked this with Dymola, using the "Debug | Store variables after failed initialization"), which is below rhmin = 0.2. So, there is no solution to this equation.
What happens is that the Newton solver tries to bring the residual of the equation to zero by reducing b3, but when going below rhmin, the sensitivity of the residual to b3 becomes zero, hence the Jacobian becomes singular. Trying to solve the model with Dymola produces a similar result.
Bottom line: this model is ill posed and cannot be solved.
If you reduce the parameter pump.rhmin below that threshold to, say, 0.1, the model runs successfully. Of course, if the value of rh at the solution is close to rhmin, finding it could be challenging for the Newton solver, since the residual is not smooth and has a discontinuity on the first derivative close to the solution.