germannp/yalla

Adaptive time step

Opened this issue · 2 comments

Certain reaction-diffusion systems, like Turing systems, require very small time steps at some times and thus profit a lot from adaptive time steps.

For now e95b44b in an experimental adaptive branch adds two additional methods to Solution, take_rk12_step() and take_rk12_rd_step(). The latter does not use friction and does not update the velocities after accepting a step. Both can incorporate noise, which can also help Turing systems converge faster.

This way reaction-diffusion (rd) equations can separated from mechanics. However, the treatment of friction is very tricky and we hope that in the future Runge-Kutta-1-2 can be used with both, mechanics and rd in one step the following ways:

Solution<Pt, Heun, Tile> cells{n};
Solution<Pt, Rk12, Grid> cells2{n};
...

If separating mechanics from rd should turn out to be required because the changes in neighborhood keep the time steps much smaller than required for the rd terms, then take_rk12_rd_step() should enforce that the positions are left untouched.

If the changes in neighborhood should turn out to be problematic, maybe switching from the simple ReLU potentials to some smooth 3rd order polynomial might help? I attached some python stuff I did when I played with potentials.

Potentials.zip

Also, the step function from diffusion might be a problem for the time stepper. I don't think weighing by distance would help given that essentially only nearest neighbours are considered, but maybe a smooth transition when two cells get close enough to become neighbours might be required.