Matthew Zhu
At each time step calculate each particle’s acceleration and use Verlet numerical integration to update its position, velocity, and grid cell Particles — Sequential Particle Interactions Particle objects have data fields such as: Density, pressure, position, velocity, acceleration, and force. For each grid cell: Retrieve all particles in cell For each particle: Find interacting particles within distance H Calculate inter-particle viscosity forces, pressure forces, surface tension forces, external forces, properties, and acceleration Account for each neighbor particle’s contribution to density Calculate pressure from density
Trivially Parallelizable SPH Simulation Each thread accesses a particle, finds the particle’s neighbors, and computes their force contributions.
Symmetrizing Particle Interactions
Accounting for Symmetric Contributions A data race occurs if two particles try to access each other simultaneously Each thread accesses a particle, finds the particle’s neighbors, and applies forces to both the particle and its neighbors.
Dividing Workload Particles keep track of grid cells and z-index Particle array sorted by z-indices Apply cell-fitting procedure
Two-dimensional Coloring Algorithm Interaction Pattern On cell (0, 0) Chromatic Number: 4 Interactions of a single color may be processed in parallel without data races Four passes are required to process all interactions
Generalization to Three Dimensions (0,0,0) (1,0,0) (1,0,1) (0,0,1) (1,1,0) (0,1,0) (0,1,1) (1,1,1) 3D Interaction Pattern To determine the color of a cell: Chromatic Number: 8 (x mod 2, y mod 2, z mod 2) yields one of eight possible colors For example,the grid cell at (9, 9, 8) is assigned the color red
Simulation Algorithm — Particle Interactions (9,9,8) (10,9,8) (10,9,9) (9,9,9) (9,10,8) (9,10,9) Thread 1 Local Interaction ListColor Interaction List[red] For each local cell: For each pair of cells in the interaction pattern: (pattern includes interactions within a cell represented by dot) (9,9,8) If cells are local to thread add pair to local interaction list Otherwise add pair to interaction list of the cell’s color (9,9,8)(9,9,9) (9,9,8)(10,9,9) (9,9,8)(10,10,9) (9,9,9)(9,10,8) (9,9,8)(10,9,8) (9,9,8)(9,10,9)(9,9,8)(9,10,8) (9,9,9)(10,10,8) (9,9,8)(10,10,8) (9,9,9)(10,9,8) (9,10,8)(10,9,9) (9,10,9)(10,9,8) (9,10,8)(10,9,8)
Simulation Algorithm — Physics Computation (9,9,8) (9,9,9) (9,9,8)(10,9,9) (9,9,8)(10,10,9) (9,9,9)(9,10,8) (9,9,8)(10,9,8) (9,9,8)(9,10,9) (9,9,8)(9,10,8) (9,9,9)(10,10,8) (9,9,8)(10,10,8) (9,9,9)(10,9,8) (9,10,8)(10,9,9) (9,10,9)(10,9,8) (9,10,8)(10,9,8)
References [1] P. Goswami et al., “Interactive SPH Simulation and Rendering on the GPU,” in ACM SIGGRAPH Symposium on Computer Animation., 2010, pp [2] Y. R. López and D. Roose, “A Parallel SPH Implementation on Shared Memory Systems,” in 9th International SPHERIC Workshop., Paris, France, 2014, pp [3] M. Müller et al., “Particle-Based Fluid Simulation for Interactive Applications,” in SIGGRAPH Symposium on Computer Animation., 2003, pp. 1-7.