particle based fluid simulation
play

Particle-Based Fluid Simulation CSE169: Computer Animation Steve - PowerPoint PPT Presentation

Particle-Based Fluid Simulation CSE169: Computer Animation Steve Rotenberg UCSD, Spring 2016 Del Operations = Del: = Gradient:


  1. Particle-Based Fluid Simulation CSE169: Computer Animation Steve Rotenberg UCSD, Spring 2016

  2. Del Operations πœ– πœ– πœ– 𝛼 = β€’ Del: πœ–π‘¨ πœ–π‘¦ πœ–π‘§ πœ–π‘‘ πœ–π‘‘ πœ–π‘‘ 𝛼𝑑 = β€’ Gradient: πœ–π‘¨ πœ–π‘¦ πœ–π‘§ πœ–π‘€ 𝑧 = πœ–π‘€ 𝑦 πœ–π‘§ + πœ–π‘€ 𝑨 Divergence: 𝛼 βˆ™ 𝐰 πœ–π‘¦ + β€’ πœ–π‘¨ πœ–π‘€ 𝑧 πœ–π‘€ 𝑧 πœ–π‘€ 𝑨 πœ–π‘€ 𝑦 πœ–π‘¨ βˆ’ πœ–π‘€ 𝑨 πœ–π‘¦ βˆ’ πœ–π‘€ 𝑦 πœ–π‘§ βˆ’ 𝛼 Γ— 𝐰 = β€’ Curl: πœ–π‘§ πœ–π‘¨ πœ–π‘¦ = πœ– 2 𝑑 πœ–π‘¦ 2 + πœ– 2 𝑑 πœ–π‘§ 2 + πœ– 2 𝑑 𝛼 2 𝑑 β€’ Laplacian: πœ–π‘¨ 2

  3. Transport Equations 𝑒𝑑 𝑒𝑒 = βˆ’π° βˆ™ 𝛼𝑑 β€’ Advection: 𝑒𝐰 𝑒𝑒 = βˆ’π° βˆ™ 𝛼𝐰 β€’ Convection: 𝑒𝑑 𝑒𝑒 = 𝑙𝛼 2 𝑑 β€’ Diffusion: 𝑒𝐰 𝑒𝑒 = πœˆπ›Ό 2 𝐰 β€’ Viscosity: 𝑒𝐰 𝑒𝑒 = βˆ’π›Όπ‘ž β€’ Pressure:

  4. Navier-Stokes Equation β€’ The incompressible Navier-Stokes equation describes the forces on a fluid as the sum of convection, viscosity, and pressure terms: πœ–π° πœ–π‘’ = βˆ’π° βˆ™ 𝛼𝐰 + πœˆπ›Ό 2 𝐰 βˆ’π›Όπ‘ž β€’ In addition, we also have the incompressibility constraint: 𝛼 βˆ™ 𝐰 = 0 β€’ As discussed in the previous lecture, these are formulated from the point of view of a fixed point in space (Eulerian frame of reference)

  5. Lagrangian Approach β€’ In the Lagrangian approach, we formulate the Navier-Stokes equation from the point of view of a particle moving along with the fluid β€’ The pressure and viscosity terms don’t change, but the convection term goes away entirely 𝑒𝐰 𝑒𝑒 = πœˆπ›Ό 2 𝐰 βˆ’π›Όπ‘ž The paper also adds a term for externally applied forces as well as a 1 𝜍 β€’ term to account for the fact that the particle based methods will have some variation in density 𝑒𝐰 𝑗 𝑒𝑒 = πœˆπ›Ό 2 𝐰 𝑗 βˆ’ 1 π›Όπ‘ž 𝑗 + 𝐠 𝑗 𝜍 𝑗 𝑛 𝑗

  6. Particle-Based Fluids

  7. Grid-Based Methods β€’ Fluid dynamics has traditionally been simulated on uniform grids or irregular meshes β€’ These techniques are good for engineering applications due to their potential for high accuracy β€’ They are effective in computer graphics uses as well, particularly for smoke and simulations of airflows β€’ However, it is very difficult to handle fluid interfaces (such as the water-air boundary) and complex splashing situations, which are the situations one often wants in entertainment applications

  8. Smooth Particle Hydrodynamics β€’ Particle based fluid simulation is often referred to as smooth particle hydrodynamics or SPH β€’ Some of the original work was done for simulating galactic gas dynamics by astrophysicists β€’ The technique was introduced to the computer graphics community around 2003 β€’ In recent years, advances in the techniques as well as increases in GPU computational power have made large-scale SPH simulations possible β€’ The technique has proven very effective, especially for simulating very dynamic situations with lots of splashing and interaction with complex surfaces

  9. SPH Fluids in Computer Graphics β€’ We will follow the paper β€œSPH Fluids in Computer Graphics” β€’ Authors: Markus Ihmsen, Jens Orthmann, Barbara Solenthaler, Andreas Kolb, Matthias Teschner β€’ This was a β€˜State of The Art Report’ (STAR) published in Eurographics 2014, and it summarizes much of the development on the subject that had been done in the previous 10 years β€’ This is a great overview of the subject and the important issues, and with lots of other great references in the bibliography β€’ Many of the formulas in these slides come from the paper as well as a few quoted statements

  10. Field Representation β€’ We saw that scalar and vector fields can be represented by grids or meshes by sampling the field at the grid points and interpolating the values in between β€’ Alternately can use a meshless set of irregularly spaced particles to represent a field β€’ Rather than being a 0 dimensional point, a particle is thought of as being smeared out over some small radius β€’ The maximum radius of influence for a particle is called the support radius β€’ The particles have to be close enough together so that they effectively cover all of the domain of interest, and often they are arranged so that every point in the domain is overlapped by several particles (maybe around 3-10)

  11. Field Representation β€’ Each particle 𝑗 represents a small sample of the fluid so it will have a mass 𝑛 𝑗 , position 𝐲 𝑗 , and velocity 𝐰 𝑗 β€’ We will also compute various properties per particle such as the local density 𝜍 𝑗 , pressure π‘ž 𝑗 , or volume π‘Š 𝑗

  12. Kernel Function β€’ We define a kernel function W () that represents the strength of a particle’s influence as a function of the distance from the particle β€’ At the support radius, we expect W () to go to 0 and smoothly increase to 1 as we get closer to the particle β€’ There have been many kernel functions proposed, and we will look at the one used in the paper

  13. Kernel Function β€œA quantity 𝐡 𝑗 at arbitrary position 𝐲 𝑗 is approximately computed with a set of β€’ known quantities 𝐡 π‘˜ at neighboring particle positions 𝐲 π‘˜ ” 𝐡 𝑗 = 𝑛 π‘˜ 𝐡 π‘˜ 𝑋 π‘—π‘˜ 𝜍 π‘˜ π‘˜ With 𝑋 β€’ π‘—π‘˜ being a kernel function of the form 𝐲 𝑗 βˆ’ 𝐲 π‘˜ = 𝑋 π‘Ÿ = 1 𝑋 π‘—π‘˜ = 𝑋 β„Ž 𝑒 𝑔 π‘Ÿ β„Ž β€’ A typical choice for the function f () would be 3 βˆ’ π‘Ÿ 2 + 2 1 2 π‘Ÿ 3 0 ≀ π‘Ÿ < 1 𝑔 π‘Ÿ = 3 2𝜌 1 ≀ 2 1 6 2 βˆ’ π‘Ÿ 3 π‘Ÿ β‰₯ 2 0

  14. Kernel Function 𝐲 𝑗 βˆ’ 𝐲 π‘˜ = 𝑋 π‘Ÿ = 1 𝑋 π‘—π‘˜ = 𝑋 β„Ž 𝑒 𝑔 π‘Ÿ β„Ž β€’ The value d is the number of dimensions β€’ The value h is the smoothing radius , which is not the same as the support radius β€’ The particle spacing is typically close to h β€’ From examining the equations, one can see that the support radius is 2 h in the example from the paper, but they mention it may vary from h to 3 h depending on choice of kernel function f ()

  15. Derivative Computation β€’ When using uniform grids, we were able to easily compute various spatial derivatives by using finite differencing β€’ With particles, the irregular spacing makes derivative computation a little more tricky and several approaches have been used in the literature β€’ The paper uses the following: 𝜍 𝑗2 + 𝐡 π‘˜ 𝐡 𝑗 βˆ‡π΅ 𝑗 = 𝜍 𝑗 𝑛 π‘˜ 𝜍 π‘˜2 βˆ‡π‘‹ π‘—π‘˜ π‘˜ βˆ‡ βˆ™ 𝐁 𝑗 = βˆ’ 1 𝑛 π‘˜ 𝐁 π‘—π‘˜ βˆ™ βˆ‡π‘‹ π‘—π‘˜ 𝜍 𝑗 π‘˜ βˆ‡ 2 𝐡 𝑗 = 2 𝑛 π‘˜ 𝐲 π‘—π‘˜ βˆ™ βˆ‡π‘‹ π‘—π‘˜ 𝐡 π‘—π‘˜ 𝐲 π‘—π‘˜ βˆ™ 𝐲 π‘—π‘˜ + 0.01β„Ž 2 𝜍 π‘˜ π‘˜

  16. Derivative Computation β€’ Notice that all of the derivatives involve summing over j , which is the set of nearby particles within the support radius β€’ In order to do the calculations, every particle must determine which particles are nearby β€’ This can be problematic when you are dealing with millions of particles, and so special data structures are required to make this neighbor search fast β€’ We will look at those in a little bit

  17. Equations of Motion β€’ SPH uses the Lagrangian form of the Navier-Stokes equation: 𝑒𝐰 𝑗 𝑒𝑒 = πœˆπ›Ό 2 𝐰 𝑗 βˆ’ 1 π›Όπ‘ž 𝑗 + 𝐠 𝑗 𝜍 𝑗 𝑛 𝑗 β€’ This is computed for each particle and then integrated using the standard forward Euler method of integration that we’ve been using for other particle systems β€’ Note that it requires a density 𝜍 and pressure p to be calculated first and the paper has a couple different methods to do that depending on the specific approach

  18. Algorithm β€’ The paper presents 4 different algorithms for SPH simulation β€’ They are all similar and effectively try to calculate the same thing, but they use different computational approaches and don’t produce the exact same results β€’ The main difference between the approaches involves the exact order that things are done and how the incompressibility constraint is handled β€’ Most methods allow for some compression, but some of the better approaches attempt to enforce incompressibility using iterative approaches or solutions to large systems of equations β€’ In general, the more sophisticated methods require more time to compute a single time step, but run more stable and can handle larger time steps β€’ The result is that usually the more sophisticated approaches will outperform the simpler approaches in real world use cases

  19. Integration & Time Steps β€’ We need small time steps to keep things stable, but ideally we could use larger time steps if things aren’t moving as quickly β€’ We can therefore consider adapting the time step over time based on what is happening in the simulation β€’ It is common to base this off of the Courant-Friedrich- Levy (CFL) condition that limits the time step so that the fastest particle doesn’t move more than some portion of it’s smoothing radius: β„Ž βˆ†π‘’ ≀ πœ‡ 𝐰 𝑛𝑏𝑦 with πœ‡ β‰ˆ 0.4

  20. Spatial Hash Tables

Recommend


More recommend