Changes between Initial Version and Version 1 of Ticket #5141


Ignore:
Timestamp:
2018-10-08T17:47:28Z (6 years ago)
Author:
Francesco Casella
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5141 – Description

    initial v1  
    5353show up, even though the simulation eventually reaches the end.
    5454
    55 I guess the root cause of this issue is that the error control is performed on the absolute pressures (which are around 1e5), while the mass flow rate between the two volumes is very sensitive to much smaller delta-p changes of 0.001 or less, ''and'' very strongly nonlinear. Therefore the solver accepts steps which are perfectly fine in terms of relative accuracy of the states (-> absolute pressures) but which can still cause significant perturbations of the flow rate and possibly lead to convergence issues at the next time step, even though the state values change very little between steps. According to this interpretation (which I believe in), the problem is not just that the system is ill-conditioned, but that it is also very strongly nonlinear. In fact, if I use ''linear'' pressure drop models with the same dp's, these problems do not show up at all.
     55I guess the root cause of this issue is that the error control is performed on the absolute pressures (which are around 1e5), while the mass flow rate between the two volumes is very sensitive to much smaller delta-p changes of 0.001 or less, ''and'' very strongly nonlinear. Therefore the solver accepts steps which are perfectly fine in terms of relative accuracy of the states (-> absolute pressures) but which can still cause significant perturbations of the flow rate and possibly lead to convergence issues at the next time step, even though the state values change very little between steps. The problem is that once the previous step has been accepted (based on the relative error on the pressure states), there is no way to undo it if the next step has convergence issues: the solver can try to reduce the time step a lot, but it can't go backward in time.
     56
     57According to this interpretation (which I believe in), the problem is not just that the system is ill-conditioned, but that it is also very strongly nonlinear. In fact, if I use ''linear'' pressure drop models with the same dp's, these problems do not show up at all.
    5658
    5759From this point of view, one option is to increase the {{{wnf}}} parameter of the pressure loss models, which makes the residual function of the algebraic loop much less strongly nonlinear close to zero (and with a larger Jacobian, which doesn't harm), thus helping the convergence. In fact, the empirical evidence is that higher values of {{{wnf}}} on small pressure loss components help avoiding this problem. This strategy somehow saved my neck so far. However, it would be nice if we had robust ways of solving these systems without the need of resorting to these tricks.
    5860
    59 One possible way of doing this would be to make a state variable change and use the absolute pressure of one volume and the pressure difference between the volumes as states, instead of the two absolute pressures. In this way, a reasonable tolerance like 1e-4 or 1e-5 on both states would avoid getting dp's large enough to cause significant mass flow rate oscillations. In fact, this approach works nicely, see {{{Test5}}}, where the sought after solution is found very quickly and with high accuracy even with a relative tolerance of 1e-3(!).
     61One possible way of doing this would be to make a state variable change and use the absolute pressure of one volume and the pressure difference between the volumes as states, instead of the two absolute pressures. In this way, a reasonable tolerance like 1e-4 or 1e-5 on both states would avoid getting dp's large enough to cause significant mass flow rate oscillations. In fact, this approach works nicely, see {{{Test5}}}, where the sought after solution is found very quickly and with high accuracy even with a relative tolerance of 1e-3(!), or {{{Test6}}}, where the solution is found very quickly with the original accuracy of 1e-6.
    6062
    61 The only problem here is that doing this in an object-oriented way is really not possible, because this delta-p spans several components - in which commponent should I define the {{{p1 - p2}}} variable with the {{{stateSelect.prefer}}} attribute? Also, a static choice of which dp's to use may not be always feasible, in a circuit where valves are opened and closed and parts of the circuit dynamically sealed off from the rest.
     63The only problem here is that doing this in an object-oriented way is really not possible, because this delta-p spans several components - in which component should I define the {{{p1 - p2}}} variable with the {{{stateSelect.prefer}}} attribute? Also, a static choice of which dp's to use may not be always feasible, in a circuit where valves are opened and closed and parts of the circuit dynamically sealed off from the rest.
    6264
    6365However, a smart enough back-end may automatically generate code to detect these situations and do the (dynamic) state variable change of its own initiative, selecting the right dp's as states to achieve robust and fast simulation. We may help the back-end doing this by re-using the branch-node mechanism of the overconstrained connectors.  @bachmann, @karim.abdelhak, I guess this would be an interesting research topic for you.