New answers tagged

3

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 ...


1

For the divergence computation: The Poisson equation we are going to solve is $$ \nabla \cdot \nabla p = \nabla \cdot u_{old}.$$ This is given by taking divergence on both sides of the conservation equation and $\nabla \cdot u_{new}=0$ since we assume the result velocity field should be divergence free. Then discretize both sides on colocated grid: $$\frac{...


6

As always, answers to questions of this kind will be of the form "it depends". What it depends on is how many peas you have. If you only have a few dozen peas that dribble out of the container, then what you have is not a fluid but a "granular medium" because the behavior of what is happening is best described by the trajectories of the ...


1

Consider a FV method as an approximation of the integral conservation law. Starting from the one-dimensional, scalar conservation equation \begin{equation} u_t + f(u,\nabla u)_x =0, \end{equation} with the definitions of the step sizes $\Delta x$ and $\Delta t$ \begin{equation} t_n = n \Delta t,~~~x_i = i \Delta x,~~~x_{i+1/2}=\frac{1}{2}\left(x_i + x_{i+...


Top 50 recent answers are included