4/8/2013

Overview Fluids for • Some terms… • Incompressible Navier-Stokes Equations • Boundary conditions Bedřich Beneš, Ph.D. • Lagrange vs. Euler Purdue University • Eulerian approaches Department of Computer Graphics Technology • Lagrangian approaches • Shallow water • Conclusions © Bedrich Benes

Some terms Some terms • Advect: • Lagrangian: evolve some quantity forward in time methods that move fluid mass using a velocity field. For example (for example by advecting particles) particles, mass, etc. • Eulerian: • Convect: fluid quantities are defined on a grid transfer of heat by circulation of that is fixed movement of fluid. (the quantities can vary over time)

© Bedrich Benes © Bedrich Benes

1 4/8/2013

Equations Equations Fluids are governed by the incompressible • , , velocity of the fluid [/] Navier-Stokes Equations • (rho) fluid density /] water ~1000 ∙ p υ∙ (1) air ~1.3 ∙0 (2) • pressure [Pa] force per unit area that the fluid exerts © Bedrich Benes © Bedrich Benes

Equations Equations The momentum equation ( ) • 0, 9.81,0 accel. due gravity [/] How the fluid accelerates due to the forces

(assuming: acting on it gravity and other points to you, is up, is right) external forces drag 1 ∙ p υ∙ • (upsilon) kinematics viscosity how difficult it is to stir viscosity

convection pressure acceleration (internal

© Bedrich Benes © Bedrich Benes movement)

2 4/8/2013

Equations Equations The momentum equation ( ) • Balance of momentum. gravity Internal + external forces = change in momentum.

• Conservation of energy. Kinetic + internal energy = const.

acceleration convection pressure drag

© Bedrich Benes © Bedrich Benes

Equations Equations Conservation of mass Conservation of mass Advecting mass through the velocity field 0 cannot change total mass.

∙0 0

© Foster & Metaxas, 1996

© Bedrich Benes © Bedrich Benes

3 4/8/2013

Boundary Conditions Boundary Conditions • Three types • Solid boundaries • Normal component of fluid velocity = 0 • Solid walls ∙ 0

• Free surface • Ideal fluids (slip boundary) • The tangential component is unchanged. • Other fluids • Viscous fluids (no-slip boundary) • The tangential component is set to zero.

© Bedrich Benes © Bedrich Benes

Boundary Conditions Solutions • Free surface • Lagrangian: Interface between the fluid • The world is a particle system and “nothing” (air) • Each particle has an ID and properties (position, velocity, acceleration, etc.) • Volume-of-fluid tracking (for Eulerian) • Eulerian: • Mesh tracking (tracks evolving mesh) • The point in space is fixes • Particle fluids (Lagrangian) • Measure stuff as it flows past • Level sets: • Analogy - temperature: advects a signed distance function • Lagrangian: a balloon floats with the wind • Eulerian: on the ground wind blows past

© Bedrich Benes © Bedrich Benes

4 4/8/2013

Incompressibility Eulerian Approach

Nick Foster and Dimitri Metaxas (1996) Realistic animation of liquids. Graph. Models Image Process. 58, 5 (September 1996), 471-483. • Real fluids are compressible • Space discretization that is why we hear under water • Uses fixed 3D regular grid (voxels) (two of them) • Not important for animation and • Each cell has pressure in the middle expensive to calculate • Each cell has its state: • FULL of fluid • SOLID material • EMPTY air

© Bedrich Benes © Bedrich Benes • SURFACE boundary cell

Eulerian Approach Eulerian Approach • Each wall stores the velocity vector • Discretization of the NS momentum equation gives new velocity :

© Bedrich Benes © Bedrich Benes

5 4/8/2013

Eulerian Approach Eulerian Approach • Time step and the • The divergence fluid (“missing mass”) • Convergence condition

• , , are given, so we can only decrease the time step • Is a finite difference approx. of ∙0 • This causes the to slow down over time. 0 © Bedrich Benes © Bedrich Benes

Eulerian Approach Eulerian Approach • Change of the mass causes change of the pressure

1 1 1 /2 ∙ ∈ 1,2

init iteration 1 iteration n

© Bedrich Benes © Bedrich Benes

6 4/8/2013

Eulerian Approach Eulerian Approach • The face vortices are then updated • Cell pressure is updated

© Bedrich Benes © Bedrich Benes

Eulerian Approach Eulerian Approach Putting this all together: • Where is the free level? 1. Scene definition (material, sources, sinks) • Use marching cubes 2. Set initial pressure and velocity 3. In a loop • Use Marker Particles – particles that are advected with the velocity I. Compute ,, for all Full cells. Markers and Cells (MAC) II. Pressure iteration for all Full cells.

© Bedrich Benes © Bedrich Benes

7 4/8/2013

Eulerian Approach Eulerian Approach

© Bedrich Benes © Bedrich Benes

Eulerian Approach Eulerian Approach

© Bedrich Benes © Bedrich Benes

8 4/8/2013

Stability Follow up works • Slowing down because of stability • Ronald Fedkiw, Jos Stam, and Henrik Wann Jensen. 2001. Visual simulation of smoke. In Proceedings of the 28th • Some iterations for divergence needed annual conference on Computer graphics and interactive techniques(SIGGRAPH '01). • Addressed by Jos Stam. 1999. Stable fluids. In Proceedings of the 26th annual conference on Computer graphics and interactive techniques (SIGGRAPH '99). • Demo © Bedrich Benes © Bedrich Benes

Follow up works Follow up works • Douglas Enright, Stephen Marschner, and Ronald Fedkiw. • Erosion simulation 2002. Animation and rendering of complex water surfaces. ACM Trans. Graph. 21, 3 (July 2002), 736-744.

© Bedrich Benes © Bedrich Benes

9 4/8/2013

Follow up works More… • Erosion

© Bedrich Benes © Bedrich Benes

Lagrangian approaches Smoothed Particle Hydrodynamics (SPH) • R.A. Gingold and J.J. Monaghan, (1977) Smoothed particle hydrodynamics: theory and application to non-spherical stars, Mon. Not. R. • Lagrangian: Astron. Soc., Vol 181, pp. 375–89. methods that move fluid mass • M. Desbrun, and M-P. Cani. (1996). Smoothed (for example by advecting particles) Particles: a new paradigm for animating highly deformable bodies. In Proceedings of Eurographics Workshop on Computer Animation and Simulation

© Bedrich Benes © Bedrich Benes

10 4/8/2013

SPH SPH

• Fluid is divided into discrete particles , • Particles advect mass • The values of different properties in the – the physical value at location space where no particles are present are - mass of the th particle calculated by using smoothing functions the physical value of the th particle location of the th particle the smoothing kernel

© Bedrich Benes © Bedrich Benes radius of influence

SPH Boundary • Can be represented as a triangular mesh • or as boundary particles (slip, no-slip) SPH particles p0 h boundary particles x p2 p1

© Bedrich Benes © Bedrich Benes

11 4/8/2013

SPH SPH

© Bedrich Benes © Bedrich Benes

SPH SPH • Varying viscosity http://www.youtube.com/watch?feature=play er_embedded&v=6bdIHFTfTdU

http://www.youtube.com/watch?feature=play er_embedded&v=Kt4oKhXngBQ

http://www.youtube.com/watch?feature=play

© Bedrich Benes © Bedricher_detailpage&v=UYIPg8TEMmU Benes

12 4/8/2013

SPH Shallow Water Simulation • Pros • The fluid is a simple 2-D grid with layers • No problems with losing material • Neighbor cells are connected by pipes • Implicitly saves data • Cannot simulate splashes and overhangs (particles are where the fluid is) • Good enough for near-still water with • Splashes are easy… boats • Cons • Large number of particles is necessary • Not as good for GPU as Eulerian (but still pretty good)

© Bedrich Benes © Bedrich Benes

Shallow Water Simulation Shallow Water Simulation • Acceleration

: 1) Get acceleration from unequal levels 2) Calculate flow between cells 3) Change levels of water 4) Go to 1) gh a  l Distance between cells

© Bedrich Benes © Bedrich Benes

13 4/8/2013

Shallow Water Simulation Shallow Water Simulation • New flow • Update levels

f tt  f t  tCa

Cross‐sectional area New flow Old flow of the pipe

© Bedrich Benes © Bedrich Benes

Shallow Water Simulation Shallow Water Simulation

© Bedrich Benes © Bedrich Benes

14 4/8/2013

Conclusions Reading • Fluid simulation is a complex topic • Robert Bridson • Fluid simulation for CG uses Fluid Simulation for simplifications that are aimed at Computer Graphics • Speed • Visual quality • Siggraph proceedings • Still an open problem • lot of work to do…

© Bedrich Benes © Bedrich Benes

15