Affine Particle-In-Cell Transfer
We defined the material point data following Simulation Setup, extending it with two additional terms: the affine velocity field used in the APIC transfer scheme and the scalar log_J_diff
used for volume correction as described in Drucker-Prager Elastoplasticity.
During the particle-to-grid (P2G) transfer, we adopt the APIC formulation for momentum exchange. Instead of directly transferring particle velocity, we include the local affine velocity field . Specifically, momentum is transferred using the form:
Implementation 31.3.1 (Affine Transfer in APIC Particle-to-Grid (P2G), simulator.py).
grid_v[base + offset] += weight * m[p] * (v[p] + C[p] @ dpos) # momentum Transfer, APIC formulation
Here, dpos
is the offset from the particle to the grid node.
During the grid-to-particle (G2P) transfer, we gather both the updated velocity and the affine velocity matrix from the background grid. The affine matrix is computed from the weighted outer product of grid velocities and position offsets. This allows each particle to retain local velocity variation, significantly reducing numerical dissipation compared to PIC.
Implementation 31.3.2 (Affine Transfer in APIC Grid-to-Particle (G2P), simulator.py).
new_C += weight * grid_v[base + offset].outer_product(dpos) / D
Here, is a constant factor when using the Quadratic B-spline interpolation function:
Implementation 31.3.3 (Constant D for Quadratic B-spline used for APIC, simulator.py).
D = (1./4.) * dx * dx # constant D for Quadratic B-spline used for APIC
