mtiller / ModelicaBook

Source for my new Modelica Book
https://mbe.modelica.university
Other
95 stars 69 forks source link

Browser simulation of Classic Lotka-Volterra with x0=100 #83

Closed tbeu closed 6 years ago

tbeu commented 10 years ago

When chaning the parameter x0 from 10 to 100 the simulation output is wrong. It looks as expected though for x0=99 or x0=103. Very strange...

classicmodel

dietmarw commented 6 years ago

The new serverside simulation now actually gives a compiler error log message for this case:

stdout            | info    | The initialization finished successfully without homotopy method.
DASKR--  AT T (=R1) AND STEPSIZE H (=R2) THE                                    
      In above,  R1 =   1.2897921767513E+02   R2 =   9.8055546548322E-14
DASKR--  ERROR TEST FAILED REPEATEDLY OR WITH ABS(H)=HMIN                       
stdout            | warning | DDASSL had repeated error test failures on the last attempted step.
stdout            | warning | can't continue. time = 128.979218
stdout            | info    | model terminate | Integrator failed. | Simulation terminated at time 128.979
xogeny commented 6 years ago

Wow @dietmarw I was just about to see if this worked with the new server side approach only to find you already checked.

The issue is probably one of tolerance. If you simulate x0=100 and y0=50 and you mouse over the trajectories you see that the predator population goes negative. Somehow, the simulation carries on and recovers. But if you give y0 any lower values, I suspect the "anti-wolves" cause a singularity.

I'm going to close this because at least we get a proper error message now. If somebody wants to tighten the tolerances for this example, I'd be fine with that. But there will always be limits for how far apart the initial populations can be.