Particle in Cell Method
Particle in Cell (PIC) is a numerical method that moves away from the grid-based method into a hybrid of Lagrangian and Eulerian solvers.
- Grids (Eulerian): Excellent for solving the global pressure projection constraint because the math sits on a rigid, predictable matrix.
- However, they are terrible at advection because interpolating data across the grid causes massive numerical diffusion (blurring).
- Particles (Lagrangian): Perfect for advection. Simply move the particle through space (). There is exactly zero numerical diffusion.
- However, calculating the global pressure constraint is a nightmare because particles are disorganized and require expensive nearest-neighbor searches to figure out who is pushing whom.
First, discretize the material space as particles . Each particle has a mass that is invariant over time. The particle location is our flow map . Computing pressure projection is difficult using this particle method.
Denote an Eulerian function and its Lagrangian twin:
where
To do advection, we need to move the particles according to the fluid velocity field. This is done by doing it in the Lagrangian coordinate:
This is much easier as there is no diffusion term. This is unlike the Eulerian method where
which requires heavy interpolation when discretized. This causes numerical diffusion and blurring.
Steps
At the beginning of each iteration, each particle has a velocity and .
- Advection step or and .
- Transfer particle data to grid .
- Pressure projection on grid . Recall we do this via Applying FFT (Spectral Method).
- Transfer grid data back to particles .
- End iteration.
Fluid Implicit Particle Solver (FLIP)
At the beginning of each iteration, each particle has a velocity and .
- Advection step or and .
- Transfer particle data to grid .
- Pressure projection on grid . Recall we do this via Applying FFT (Spectral Method).
- Transfer the incremental effect of pressure back to particle. .
- End iteration.
This works because the particle keeps its own original, perfectly advected velocity, and only adds the acceleration caused by the pressure gradient.
Particle-Grid Transfer
How do we calculate the transfer of data between continuous floating particles and a rigid, discrete grid? In particular, how do we calculate and ?
Before we can transfer data, we need a rule for how much a particle affects a grid cell. This is the basis function for and . It has the following properties:
- Local: when is far away from the grid point .
- Partition of unity: for all .
- Nonnegativity: for all .
Idea
Imagine a particle glowing like a lightbulb. describes how bright that light is at grid cell when the particle is at position .
- Local: The light fades to exactly if the particle is too far away.
- Partition of unity: If you add up the light hitting all the surrounding grid cells, it must equal exactly . You cannot artificially create or destroy mass/momentum during the transfer.
- Usually, this is calculated using a B-spline, which is just a mathematically smooth bell curve.
Thus, we can calculate Grid to Particle () as
To find the particle’s new velocity, we look at the surround grid cells and multiply each grid velocity by the basis weight, and add them up (kind of like a 2D convolution!).
And for Particle to Grid ():
This is just the weighted average of the particles, which causes the smoothing effect.
Affine Particle-Grid Transfer
We can upgrade both and to be Affine and not just linear. The idea is that each particle stores more information than just velocity.
Affine Grid to Particle ():
Affine Particle to Grid ():
The primary difference here is that the numerator now includes a term for the gradient of the particle’s properties. This is merely a first-order Taylor expansion of the particle’s influence on the grid.
Idea
Instead of a particle being a single point moving through space with velocity , we can imagine the particle is a tiny, squishy rubber ball. It can also stretch, shear, and spin. We store this inside .
So how do we calculate the optimization problem? The goal is to find a specific gradient matrix that captures how the particle’s properties are changing in space.
- Let be the distance vector from the particle to grid node .
- Our approximation of the velocity at node is . The actual velocity at node is .
- We also only care about the nodes that are close to the particle.
Thus, we get an error function for a given :
We want to minimize this error. So we need to take the derivative and set it to to find the Local Minima.
With some rearranging, we get
For this specific particle, is a constant matrix, so we can pull it out of the summation.
The very last term is important. Because standard B-spline basis functions are perfectly symmetrical, if you sum up all the distances to the surrounding grid nodes weighted by the spline, they perfectly balance out to exactly . This causes to completely vanish! We are left with
Now, define
where is the “Inertia” tensor (note how is like a mass distribution and is like the moment of inertia) and is the “Angular Momentum” tensor (note how is like a mass distribution, is like the velocity, and is like the distance from the center of mass).
Thus, and .
Lattice Boltzmann Method (LBM)
Previously, we have been solving the Eulerian fluid equations by directly discretizing the PDEs. The Lattice Boltzmann Method (LBM) simulates a mesoscopic1 statistical view of the fluid.
- Continuum Mechanics is only a macroscopic model where the fluid is a continuous blob. Every point in space has one single, averaged velocity .
- Molecular dynamics simulates every single fluid molecule bouncing off each other. One of water is particles (computationally expensive!)
- Mesoscopic (statistical) dynamics tracks the probability of particles moving in certain directions at a given point in space instead of tracking one average velocity or many.
The state of the system is a Probability Measure over the tangent bundle . In particular, is the probability density of a particle being at position and velocity at time . With this, we can calculate:
- The mass density:
- The momentum density:
- Internal energy: where is the temperature and is the Boltzmann constant.
- Stress-energy tensor:
Boltzmann Equation
The Boltzmann equation describes how the probability density evolves over time.
The probability distribution is advected by its own velocity and external forces . The right hand side “can be”2 a pointwise operator modeling the internal collision that mutates the distribution (obeying some conservation law).
Instead of particles moving in any direction, they are only allowed to move in a handful of fixed directions. This dramatically simplifies the computation required.
- becomes discrete
- Advection becomes a simple shift of the probability distribution along the lattice directions.
- Local collision runs on each node.
Other Methods
- Vorticity is curl of velocity. Vortex lines are curves parallel to vorticity.
- Vortex lines are transported in the Euler equation.
- One can reconstruct divergence-free velocity from the vorticity field (on simply-connected domains).
- Simulations of fluid using this principle are called vortex methods.
- When velocity is treated as 1-form (covector), it is also known as “impulse”. They are Lie-transported in Euler fluids.
- They correspond to covector methods/impulse methods.
Footnotes
-
Mesoscopic means it is between the microscopic particle level and the macroscopic fluid level. ↩
-
The reason why it is “can be” is because it depends on the kind of fluid. For example, we could have a dilute fluid (like upper atmosphere) where the particles are so far apart that they almost never collide. Since collisions are statistically negligible, we can set . Dense fluids will have a more complicated that models the collisions. ↩