A Large Particle Simulation of Granular Processes from Scratch in OpenGL

Final Video

A brief video demonstration of our simulation, key results, and an overview of the process of simulating sand particles.

A brief video demonstration of our simulation, key results, and an overview of the process of simulating sand particles.

Abstract

We implemented a particle simulator to demonstrate both the behavior of sandstorms as well as the piling behavior of sand particles. The simulator supports live rendering for a small number of particles and offline video renders for larger scenes.

Technical Approach

Rendering and Loading

We began with the simple GUI and CGL interface from project 4, clothsim, and adapted the code to fit our needs for particle simulation. We created a SandSimulator class to keep track of parameters and handle events as well as perform the simulation steps and updates. Within the SandSimulator, we created a Sandbox class that kept track of sand particles and inter-particle collisions, and performed operations on all of its constituent SandParticles.

As in project 4, we used JSON files to specify a scene, although we changed the functionality to allow multiple objects of the same type and variable constructors based on supplied parameters for classes like the WindField.

We maintained the GUI from project 4 that allowed for parameter tuning in real time, removed texture selection, and added new keyboard events for toggling wind forces on and off. We also provided new command line arguments to specify new default values for frames per second, simulation steps per frame, and recording parameters.

Adapted cloth simulator GUI.

Adapted cloth simulator GUI.

{
  "sandbox": {
    "alpha": 0.5,
    "beta": 1.5,
    "k_d": 0.5,
    "k_r": 100,
    "k_t": 10000,
    "mass": 13e-6,
    "top_left": [1, 0.5, 1],
    "bottom_right": [-1, 0, -1],
    "num_sand_particles": 500,
    "sand_radius": 0.01,
    "mu": 0.4
  },
  "plane": {
    "point": [0.5, -0.2, 0.5],
    "normal": [0, 1, 0],
    "length": 5,
    "width": 5,
    "friction": 0.4
  },
  "wind": {
    "top_left": [100, 3, 100],
    "bottom_right": [-100, -1, -100],
    "radius": 1,
    "magnitude": 10,
    "center": [0, 0]
  }
}

Particle Simulation

We model a sand particle as a sphere. Each sand particle is of uniform size and mass. Note that we do not account for particle rotation, only position and previous position (using Verlet integration).

The inter-particle forces are modeled by Particle-Based Simulation of Granular Materials (2005) and Angle of repose and angle of marginal stability: molecular dynamics of granular particles (1993).

All equations are taken from the 2005 paper while some implementation details of tangent forces was taken from the 1993 paper.

The following (up until we define $\vec F_t$) is taken nearly verbatim from the 2005 paper:

The inter-particle contact force on one particle due to another particle can be summarized as

$$ \vec{F}=\vec{F}_n+\vec{F}_t, $$