reference: https://pdfs.semanticscholar.org/847f/819a4ea14bd789aca8bc88e85e906cfc657c.pdf

while ( simulating )
    get_from_UI ( dens_prev, u_prev, v_prev );
    vel_step ( N, u, v, u_prev, v_prev, visc, dt );
    dens_step ( N, dens, dens_prev, u, v, diff, dt );
    draw_dens ( N, dens );

Is u,v the same as x,y?


So, yes and no. According to your paper, u and v are vector fields.

As read on the bottom of Page 3:

In practice we allocate two arrays for both the density and the velocity of size,

size=(N+2)*(N+2):static u[size], v[size], u_prev[size], v_prev[size];static dens[size], dens_prev[size];

U and V contain an array of vectors for each 'grid'- this method takes the particles that end up at grid 'centres' and backtraces them compared to a previous snapshot. In other words:

1) Take a snapshot;

2) Run for a bit of time;

3) Take an end snapshot and look at the points that ended up in grid centres;

4) Look at where these points were at the start;

5) Draw a nice smooth line between the start and end points

6) Call it a vector.

In this paper, u is the field of x coordinates for the vectors and v is the field of vector y coordinates. I appreciate it's a longwinded post, but I feel I'd be being cruel just to say 'yeah sure' because it's not actually the answer.

Of course, I'm sure you'll be able to work out that u_prev and v_prev are just the coordinates before the timer started.

Hope it helps!

  • 1
    \$\begingroup\$ Wow! Thank you so much! I am so impressed you were able to look at it and decipher the information, especially for a little ol' stack overflow post! Have a wonderful day. \$\endgroup\$ – Dinosaurs for Friends Sep 16 '19 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.