Presentation is loading. Please wait.

Presentation is loading. Please wait.

Simulation of Fluids using the Navier-Stokes Equations Kartik Ramakrishnan.

Similar presentations


Presentation on theme: "Simulation of Fluids using the Navier-Stokes Equations Kartik Ramakrishnan."— Presentation transcript:

1 Simulation of Fluids using the Navier-Stokes Equations Kartik Ramakrishnan

2 Presentation Scope Introduction Theory Adaptation to CPU and GPU Results Optimizations and Future Work

3 Introduction Physically based simulation of fluids produces very good visual effects Computationally expensive process In the past,usually done offline and not in real time Real time fluid simulation was done using particle systems Current hardware makes physically based fluid simulation possible in real time

4 Navier-Stokes Theory The fluid being rendered is assumed to be incompressible (fluid volume remains constant over time) The fluid being rendered is assumed to be homogeneous (fluid density remains constant in space)

5 Navier-Stokes Theory RHS of the equation, proceeding left to right, Advection/velocity term Pressure term Diffusion term Force term

6 Navier-Stokes Theory Advection -Describes the transport mechanism of the fluid -Also describes the transport mechanism of any material the fluid may be carrying -For example, ink in water, the advection term describes the movement of both the water and the ink

7 Navier-Stokes Theory Diffusion -Describes the resistance of the fluid to flow -Viscosity of the fluid is a factor in this term -More viscous the fluid, the more resistant it is to flow -Impedes the velocity of the fluid

8 Navier-Stokes Theory Pressure -Describes the behavior of the fluid due to pressure induced among fluid particles -Think fluid particles squished against each other due to the application of force -Pressure leads to increase in the velocity

9 Navier-Stokes Theory Force -Describes the behavior the fluid due to any externally applied force or any bodily force (gravity) -Application of force causes an increase in the fluid velocity

10 Adaptation to CPU and GPU The NS equation is not in a finite form Need to reduce each of the above RHS terms to a discrete representation that can be implemented on the CPU and the GPU

11 Adaptation to CPU and GPU Finite representation of the NS Equation

12 Adaptation to CPU and GPU Discrete NS algorithm -Assume a 2D bounding grid for the fluid -Assume one such grid for each fluid property of interest (velocity, pressure, force, dye etc.) -Assume that velocity and pressure are 0 at time t = 0 -Assume that velocity is negative and that pressure is 0 at the grid boundaries

13 Adaptation to CPU and GPU Algorithm steps - Apply force: w1 = u + Force* timestep - Advect: w2 = w1(x – timestep*w1) - Diffuse term: del 2 w3 = w2 - Pressure term: del 2 p = w3 - Subtract pressure gradient: w4 = w3 – del p

14 Adaptation to CPU and GPU void Fluids::Simulate() { //Advect Advect((); SwapVelocityGrid(); SwapColorGrid(); //Add force AddForce(); SwapVelocityGrid(); //Diffuse Diffuse(); SwapVelocityGrid(); //Compute Pressure ComputePressure(); SwapPressureGrid(); //Project Project(); SwapVelocityGrid(); SetBounds(); timestep++; }

15 Results AMD Athalon 3200+ 2.19 GHz, 2GB RAM AMD Radeon 4870 1GB Brook+ 64x64 fluid grid, 50 frames and 70 jacobian iterations CPU (averaged over 50 frames) = 0.83 sec GPU (averaged over 50 frames) = 0.035 sec

16 Optimizations and Future Work Use float 4 for the pressure computation instead of float Pinned memory, new to Brook+1.4 Shared memory, supposed to be implemented, but think its not GPU version still glitchy – needs a few tweaks Other fluid grid sizes

17 Distant future Better visuals Port to DirectX 10 : dedicated texture hardware support available, bilinear interpolation available for free

18 Questions


Download ppt "Simulation of Fluids using the Navier-Stokes Equations Kartik Ramakrishnan."

Similar presentations


Ads by Google