GollyGang / ready

A cross-platform implementation of various reaction-diffusion systems and PDEs.
GNU General Public License v3.0
755 stars 60 forks source link

Option to switch to using RK4 instead of forward-Euler #128

Open timhutton opened 3 years ago

timhutton commented 3 years ago

See discussion in #118

RK4 is:

One approach is to store a2, a3 and a4 in new images. This would quadruple the amount of GPU memory needed, which is not desirable.

Alternatively we can use a larger neighborhood so that we can find the intermediate values we need. This is the approach we use in advection_RungeKutta4.vti

One optimisation opportunity in that implementation is that many of the intermediate values are computed more than once. For example, the value at state a4 for the central cell is computed three times - once for this cell, once for the cell to the left and once for the cell to the right. Fortunately OpenCL has a mechanism for reusing such computation - local memory. See #122 for a discussion of how to use it.