You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The derivative k1 is computed from the current state, a.
A half-step forward in time is taken, using k1: a2 = a + (timestep/2)*k1
The derivative k2 is computed from state a2.
A half-step forward in time from the start is taken again, using k2 this time: a3 = a + (timestep/2)*k2
The derivative k3 is computed from state a3.
A full step forward in time from the start is taken, using k3: a4 = a + timestep*k3
The derivative k4 is computed from state a4.
The new state is given by a' = a + timestep * (k1 + 2*k2 + 2*k3 + k4) / 6
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.
The text was updated successfully, but these errors were encountered:
See discussion in #118
RK4 is:
a2 = a + (timestep/2)*k1
a3 = a + (timestep/2)*k2
a4 = a + timestep*k3
a' = a + timestep * (k1 + 2*k2 + 2*k3 + k4) / 6
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.
The text was updated successfully, but these errors were encountered: