# Jos Stam's stable fluids — why is the timestep multiplied by the number of grid cells?

One more question about Jos Stam's GDC tutorial on stable fluids: in the advection step on page 8, the timestep for each dimension is implemented as dt * N, where N is the height or width of the grid. This corresponds to a position update:

$$x_{prev} = x - \frac{\Delta t}{h} \cdot v_x$$

where $$h = 1/N$$.

But why is $$h$$ involved in the backtracing of velocity? I thought the time evolution would just be given by $$x = x_{prev} + \Delta t \cdot v_x$$ without involving the grid size.

Stam's code is written in such a way that the coordinates of the cell centers correspond to integers. This way, the cell where a particle ends can be easily determined by rounding (e.g. i0 = (int)x;) Likewise the starting point of backtracking is simply given by (i,j) (see e.g. x = i - dt0 * u[IX(i,j)]). So the computational problem is scaled such it makes computation simpler / easier to understand.

• Aha, of course. I forgot that the grid implicitly has unit length and height. Commented Sep 27, 2021 at 17:22