Support for liquids in Jos Stam's code
As a newbie to CFD, I recently took a closer look at Jos Stam's implementation that shipped with his paper "Real-time Fluid Dynamics for Games". I found that a more mathematical and thus more concise definition of the solution is given by NVIDIA's GPU Gems, Chapter 38 (Fast Fluid Dynamics Simulation on the GPU).
The problem is, even though the authors talk about "fluid" a whole bunch, the code actually only simulates gas (using Navier-Stokes). I figured that, first of all, density was dropped from the momentum equations, so I added that back in and it worked fine (even though, it still looked a little too diffusive for my taste). Then I added gravity that pulls toward the bottom of the grid (a small negative value that is added to the vertical velocity component). But now, the "dye" (represented by the density quantity that is advected by the velocity field) drops below the grid, despite the full reflective boundary condition given in the set_bnd function. For some reason, my added gravity somehow invalidates that boundary condition, and I cannot understand why (I am not changing any boundary cell). Does anyone have some insight on this?
Thanks a bundle in advance!
|All times are GMT -4. The time now is 08:26.|