Algorithmresearch
Generalized interpolation material point method
Also called GIMP.
Gives each material point a finite domain and averages the grid shape functions over it, which reduces the cell crossing noise of the original MPM.
- Time
- Θ(N + M) worst
- Space
- Θ(M) extra
- Where
- M = the number of grid nodes; N = the number of material points
- Model
- Real RAM
- Properties
- conservativedeterministic
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Scott G. Bardenhagen, Edward M. Kober, 2004
The generalized interpolation material point method (GIMP) is a version of the material point method in which each material point is not a point but a small region of the body, its domain. The weight that connects a point to a grid node is the average of the node's shape function over the domain, and the force uses the gradient of that average. With the linear hats of the original method, the force on a node jumps each time a point crosses a cell boundary; with GIMP the weights and their gradients change continuously, so the jumps go away and the stress noise is much smaller. The cost per step is the same order as MPM.
In plain words
In the plain material point method each bead of material talks only to the two grid points around its centre. When a bead moves across a grid point, its pull on that grid point changes all at once, and the forces in the material jump. In GIMP each bead is a short piece of material with a width. Its pull on a grid point is the average pull over its whole width. When the piece slides over a grid point, part of it is on each side for a while, so the pull changes smoothly. If the pieces fit together with no gaps, a material under even tension feels no false forces inside at all, only at its two ends.
The problem
The input is the same as for MPM: material points with mass , initial volume , position , velocity , deformation gradient and stress ; the stress rule (here 1D linear elasticity, ); a grid of nodes with the hats ; the supports; and a step . In addition each point has a half width , here , so in 1D the domain stretches with the material (the contiguous particle form, cpGIMP). The GIMP weight and its gradient are
With the antiderivative of the unit hat, for , for , for , and for , the weight is . The rest of the step is the update stress last MPM step with and in place of and .
The algorithm
GIMP-STEP(points, grid, E, h)- 1
for each material point p do ▷ points to grid - 2
l_p ← F_p l_p^0; for each node i whose hat meets [x_p - l_p, x_p + l_p] do - 3
S_ip ← (1 / (2 l_p)) ∫ N_i over [x_p - l_p, x_p + l_p] - 4
S′_ip ← (N_i(x_p + l_p) - N_i(x_p - l_p)) / (2 l_p) - 5
m_i += S_ip m_p; (mv)_i += S_ip m_p v_p - 6
f_i ← -Σ_p V_p σ_p S′_ip for every node i ▷ internal force, V_p = F_p V_p^0 - 7
v_i ← (mv)_i / m_i; v_i^new ← v_i + h f_i / m_i; v_i^new ← 0 at fixed nodes; a_i ← (v_i^new - v_i) / h - 8
for each material point p do ▷ grid to points - 9
v_p ← v_p + h Σ_i S_ip a_i; x_p ← x_p + h Σ_i S_ip v_i^new - 10
ε̇_p ← Σ_i S′_ip v_i^new; F_p ← (1 + h ε̇_p) F_p; σ_p ← σ_p + E h ε̇_p - 11
return the points; clear the grid
Lines L2 to L4 are the only change from MPM. With , a domain meets at most 3 hats in 1D, so line L2 visits at most 3 nodes, against 2 for MPM. Line L7 is the lumped explicit grid update with the supports, and lines L9 and L10 are the FLIP update and the stress update at the points, as in MPM.
Example
Take the cell crossing example of the MPM page: , 8 points at , each with and . Give each point the half width , so the domains fill the body with no gaps.
The point at has the domain . On it, has the mean , has the mean and has the mean ; the three add up to 1. The gradients are , and .
Line L6 then gives the nodal forces at nodes 0 to 6. The interior nodes 1, 2 and 3 get no force, where MPM gave at nodes 1 to 3. The only forces are the traction of the stress at the two ends of the body: at the left end , and at the right end , shared by nodes 4 and 5 in the ratio .
A measurement with the code on this page shows the effect on a run. Take the vibrating bar of the MPM page (, , 20 cells, 2 points per cell, , 800 steps, one period), started with . The displacement amplitude is larger than , so points cross cells. The largest second difference of the stress along the points, divided by , is 0.044 with GIMP and 2.7 with MPM, and the energy error is 6 percent with GIMP and 26 percent with MPM. At , where no point crosses a cell, the two methods agree.
Correctness
The full proof is in the correctness proof. It proves these facts (theorems, in exact arithmetic):
- The weights form a partition of unity and reproduce linear functions: , and . So the transfer of mass and momentum is exact, momentum is conserved without supports, and a rigid translation is exact, by the same arguments as for MPM.
- is the derivative of with respect to , and for it is a Lipschitz continuous function of with constant . So no nodal force jumps when a point crosses a node or a cell boundary.
- If the domains tile an interval and (unit cross section), a uniform stress gives : zero at every node whose hat does not reach an end of the body.
The last fact holds for any tiling, with points of any sizes and at any positions. For MPM the same force is the stress times the difference of the particle volumes in two cells, which is zero only for special positions.
GIMP does not make the method exact. When the domains do not tile the body, for example after a 2D or 3D deformation that the axis aligned domains of the simple form cannot follow, the quadrature error comes back, usually smaller than in MPM (a heuristic, not a bound); Steffen, Kirby and Berzins (2008) analyse these errors.
Proof: The GIMP weights form a partition of unity, their gradients are continuous in the point position, and tiling domains under a uniform stress give no interior forcefull
We work in 1D with the hats , , and exact arithmetic. A point has the domain with , and
Line L2 visits every node whose hat is not zero on an open part of the domain, and the other nodes have , so sums over the visited nodes equal sums over all nodes. We use two facts of the hats: for every , and (on the cell only and are not zero, and they are and with ).
Claim 1 (partition of unity). , and .
Proof. Only finitely many terms are not zero, so the sum and the integral commute: . In the same way . Finally .
With Claim 1 in place of the partition of unity of the hats, the proofs of Claims 1, 2 and 3 on the MPM page go through word for word: the transfer in line L5 puts all mass and momentum on the grid, the step conserves momentum when no node is fixed (since ), and a rigid translation with zero stress is reproduced exactly (each point moves by and has ). These need the same assumption as there, that every node with or for some point has a positive mass.
Claim 2 (the gradient). For fixed , is a continuously differentiable function of with derivative , and for all , ,
Proof. is continuous, so by the fundamental theorem of calculus , and dividing by gives . This is continuous in because is. is Lipschitz with constant , so each of the two terms changes by at most , and .
So the internal force is a continuous function of the positions, and it cannot jump when a point crosses a node or a cell boundary. For the hats themselves (), jumps by at each node, which is the cell crossing jump of MPM.
Claim 3 (no interior force for tiling domains). Let the domains of points tile , that is , for and ; let , and let every point have the stress . Then for every node ,
Proof. , so
since the sum telescopes by .
and for every node with and , so these nodes get no force, whatever the sizes and positions of the points. The forces at the remaining nodes are the traction at the left end and at the right end, spread over the nodes by the hats; in the example of the page, and give .
Claim 4 (the MPM limit). If is not a node, then and as .
Proof. is the mean of a continuous function over an interval that shrinks to , so it tends to . For smaller than the distance from to the nearest node, is linear on , so exactly.
Complexity
In the real-RAM model, with each point meets at most 3 hats per axis, so nodes in dimensions, against for MPM with linear hats. Each weight costs through . So one step costs time and extra space, a constant factor of about above MPM for the transfers. The explicit step has the same CFL limit as MPM.
Properties
- Continuous weights and gradients. is continuously differentiable in , so the forces change smoothly as points move.
- Conservation. Mass is exact, and momentum is conserved without supports, as in MPM.
- No interior force from a uniform stress when the domains tile the body (a theorem in 1D).
- The MPM limit. As , and away from the nodes, so MPM is the limit of GIMP.
- Wider stencil. A point reaches nodes up to away, so the grid needs one more layer of nodes at the edges of the body.
Variants and improvements
- uGIMP. The domain size stays for the whole run. This is cheap and is the form used in many codes, but the domains stop tiling the body under large stretch or compression.
- cpGIMP. The domain follows the stretch of the material along each axis, as in the code on this page ().
- CPDI. The convected particle domain interpolation of Sadeghirad, Brannon and Burghardt (2011) follows the domain as a parallelogram or a tetrahedron under the full deformation gradient, which also handles shear and rotation.
- B-spline MPM. Quadratic or cubic B-spline shape functions on the grid have continuous gradients, which removes the jumps without particle domains. Computer graphics codes for snow and sand, for example those built on APIC, usually take this route; they use quadratic B-spline weights and do not use GIMP domains, and they aim at visual plausibility rather than at convergent stresses.
When to use it
Use GIMP when an MPM solid moves more than a cell and the stress matters, for example in impact, soil and other geomechanics problems, or in any MPM run where the stress shows noise from cell crossing. If the deformation is small, so that the points stay in their cells, plain MPM gives the same answer at less cost. If shear and rotation are large in 2D or 3D, prefer CPDI or B-spline shape functions.
Pitfalls
- Domains that leave the grid. A point near the edge of the body reaches one more node than in MPM; the grid must have that node.
- The wrong domain size at the start. For the zero interior force result, the domains must tile the body: with points per cell in 1D, and the points at the centres of their domains.
- Mixing uGIMP and the tiling claim. With fixed domain sizes, a stretched body has gaps between domains and a compressed one has overlaps, and the force from a uniform stress is no longer zero.
- Tiny nodal masses. As in MPM, a node with a very small mass gets a huge acceleration; skip or threshold such nodes.
- Boundary conditions. A support acts on nodes, and the domain of a point next to a fixed node also overlaps the next node; check that the boundary is where the domains end.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/generalized-interpolation-material-point/. The authors are listed in prov/4J3GZH.jsonl.
"""The generalized interpolation material point (GIMP) method in 1D.
Each material point p has a domain [x_p - l_p, x_p + l_p]. The grid uses the
linear hats N_i(x) = max(0, 1 - |x - x_i| / dx), x_i = i dx. The GIMP weight
of node i is the mean of N_i over the domain,
S_ip = (1 / (2 l_p)) * integral of N_i over [x_p - l_p, x_p + l_p],
and its gradient with respect to x_p is
dS_ip = (N_i(x_p + l_p) - N_i(x_p - l_p)) / (2 l_p).
In 1D the domain follows the deformation: l_p = F_p l_p^0 (the "contiguous
particle" form, cpGIMP). The rest of the step is the update-stress-last MPM
step with the FLIP velocity update.
Cost per step: Theta(N + n) time for N points and n nodes, if l_p <= dx.
"""
import math
from dataclasses import dataclass, field
def hat(t: float) -> float:
"""N(t) = max(0, 1 - |t|) in units of dx."""
return max(0.0, 1.0 - abs(t))
def hat_integral(t: float) -> float:
"""Phi(t) = integral of N from -infinity to t, in units of dx."""
if t <= -1:
return 0.0
if t <= 0:
return (t + 1) ** 2 / 2
if t <= 1:
return 1 - (1 - t) ** 2 / 2
return 1.0
def gimp_weights(x: float, lp: float, dx: float) -> list[tuple[int, float, float]]:
"""(i, S_ip, dS_ip) for every node i whose hat overlaps the domain [x - lp, x + lp]; lp > 0."""
a, b = x - lp, x + lp
out = []
for i in range(math.floor(a / dx) - 1, math.floor(b / dx) + 2): # @line L2
s = dx * (hat_integral((b - i * dx) / dx) - hat_integral((a - i * dx) / dx)) / (2 * lp) # @line L3
g = (hat((b - i * dx) / dx) - hat((a - i * dx) / dx)) / (2 * lp) # @line L4
if s != 0.0 or g != 0.0:
out.append((i, s, g))
return out
@dataclass
class Points:
x: list[float]
v: list[float]
m: list[float]
vol0: list[float]
l0: list[float]
F: list[float] = field(default_factory=list)
stress: list[float] = field(default_factory=list)
def __post_init__(self):
if not self.F:
self.F = [1.0] * len(self.x)
if not self.stress:
self.stress = [0.0] * len(self.x)
def grid_force(ps: Points, dx: float, n: int) -> list[float]:
"""f_i = -sum_p V_p sigma_p dS_ip with V_p = F_p V_p^0 and l_p = F_p l_p^0."""
f = [0.0] * n
for p in range(len(ps.x)):
for i, _, g in gimp_weights(ps.x[p], ps.F[p] * ps.l0[p], dx):
f[i] -= ps.F[p] * ps.vol0[p] * ps.stress[p] * g
return f
def gimp_step(ps: Points, dx: float, n: int, young: float, h: float, fixed: frozenset = frozenset()) -> Points:
"""One update-stress-last step with GIMP weights, for sigma_dot = E eps_dot."""
mass, mom = [0.0] * n, [0.0] * n
weights = []
for p in range(len(ps.x)): # @line L1
ws = gimp_weights(ps.x[p], ps.F[p] * ps.l0[p], dx)
weights.append(ws)
for i, s, _ in ws:
mass[i] += s * ps.m[p] # @line L5
mom[i] += s * ps.m[p] * ps.v[p] # @line L5
f = grid_force(ps, dx, n) # @line L6
v_old = [mom[i] / mass[i] if mass[i] > 0 else 0.0 for i in range(n)] # @line L7
v_new = [v_old[i] + h * f[i] / mass[i] if mass[i] > 0 else 0.0 for i in range(n)] # @line L7
for i in fixed: # @line L7
v_new[i] = 0.0 # @line L7
acc = [(v_new[i] - v_old[i]) / h for i in range(n)] # @line L7
out = Points(list(ps.x), list(ps.v), list(ps.m), list(ps.vol0), list(ps.l0), list(ps.F), list(ps.stress))
for p, ws in enumerate(weights): # @line L8
out.v[p] = ps.v[p] + h * sum(s * acc[i] for i, s, _ in ws) # @line L9
out.x[p] = ps.x[p] + h * sum(s * v_new[i] for i, s, _ in ws) # @line L9
rate = sum(g * v_new[i] for i, _, g in ws) # @line L10
out.F[p] = ps.F[p] * (1 + h * rate) # @line L10
out.stress[p] = ps.stress[p] + young * h * rate # @line L10
return out # @line L11
def vibrating_bar(cells: int, ppc: int, length: float, rho: float, v0: float):
"""Points of a bar on [0, length] in its first mode, with domains that tile the bar."""
dx = length / cells
xs, vs, ms, vols, ls = [], [], [], [], []
for c in range(cells):
for k in range(ppc):
x = (c + (k + 0.5) / ppc) * dx
xs.append(x)
vs.append(v0 * math.sin(math.pi * x / (2 * length)))
vols.append(dx / ppc)
ms.append(rho * dx / ppc)
ls.append(dx / (2 * ppc))
return Points(xs, vs, ms, vols, ls), dx, cells + 3
test_generalized_interpolation_material_point.py 133 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/generalized-interpolation-material-point/. The authors are listed in prov/4J3GZH.jsonl.
import math
import random
import pytest
from generalized_interpolation_material_point import Points, gimp_step, gimp_weights, grid_force, hat, vibrating_bar
def quadrature_weight(i, x, lp, dx, k=2000):
# oracle: the midpoint rule for the mean of N_i over [x - lp, x + lp]
a = x - lp
return sum(hat((a + (j + 0.5) * 2 * lp / k - i * dx) / dx) for j in range(k)) / k
def test_page_example_has_no_interior_force():
ps = Points([0.3 + 0.6 * k for k in range(8)], [0.0] * 8, [0.6] * 8, [0.6] * 8, [0.3] * 8, stress=[1.0] * 8)
f = grid_force(ps, 1.0, 7)
assert f == pytest.approx([1.0, 0.0, 0.0, 0.0, -0.2, -0.8, 0.0], abs=1e-12)
ws = gimp_weights(0.9, 0.3, 1.0)
assert [i for i, _, _ in ws] == [0, 1, 2]
assert [s for _, s, _ in ws] == pytest.approx([2 / 15, 5 / 6, 1 / 30], abs=1e-12)
assert [g for _, _, g in ws] == pytest.approx([-2 / 3, 1 / 3, 1 / 3], abs=1e-12)
def test_weights_match_quadrature_and_form_a_partition_of_unity():
rng = random.Random(1)
for _ in range(60):
dx = rng.uniform(0.2, 2)
lp = rng.uniform(0.01, 1) * dx
x = rng.uniform(2, 10)
ws = gimp_weights(x, lp, dx)
for i, s, _ in ws:
assert s == pytest.approx(quadrature_weight(i, x, lp, dx), abs=1e-6)
assert sum(s for _, s, _ in ws) == pytest.approx(1, abs=1e-12)
assert sum(s * i * dx for i, s, _ in ws) == pytest.approx(x, abs=1e-9)
assert sum(g for _, _, g in ws) == pytest.approx(0, abs=1e-12)
assert all(s >= 0 for _, s, _ in ws)
def test_gradient_is_the_derivative_of_the_weight():
rng = random.Random(2)
for _ in range(200):
dx, lp = 1.0, rng.uniform(0.05, 0.5)
x, d = rng.uniform(2, 6), 1e-6
up = dict((i, s) for i, s, _ in gimp_weights(x + d, lp, dx))
dn = dict((i, s) for i, s, _ in gimp_weights(x - d, lp, dx))
for i, _, g in gimp_weights(x, lp, dx):
assert (up.get(i, 0.0) - dn.get(i, 0.0)) / (2 * d) == pytest.approx(g, abs=1e-5)
def test_gradient_is_continuous_in_the_position():
# |dS(x + e) - dS(x)| <= e / (lp dx): no jump when a point crosses a node
rng = random.Random(3)
for _ in range(300):
dx, lp, e = 1.0, rng.uniform(0.05, 0.5), 1e-7
x = rng.choice([3.0, 3.0 + lp, 3.0 - lp, rng.uniform(2, 6)])
a = dict((i, g) for i, _, g in gimp_weights(x - e, lp, dx))
b = dict((i, g) for i, _, g in gimp_weights(x + e, lp, dx))
for i in set(a) | set(b):
assert abs(a.get(i, 0.0) - b.get(i, 0.0)) <= 2 * e / (lp * dx) + 1e-12
def test_small_domains_give_the_mpm_hat_weights():
rng = random.Random(4)
for _ in range(100):
dx = rng.uniform(0.5, 2)
x = (rng.randint(2, 8) + rng.uniform(0.1, 0.9)) * dx
j, w = math.floor(x / dx), x / dx - math.floor(x / dx)
ws = dict((i, (s, g)) for i, s, g in gimp_weights(x, 1e-6 * dx, dx))
assert ws[j][0] == pytest.approx(1 - w, abs=1e-9) and ws[j + 1][0] == pytest.approx(w, abs=1e-9)
assert ws[j][1] == pytest.approx(-1 / dx, abs=1e-9) and ws[j + 1][1] == pytest.approx(1 / dx, abs=1e-9)
def test_any_tiling_with_uniform_stress_has_zero_interior_force():
rng = random.Random(5)
for _ in range(30):
cuts = sorted(rng.uniform(1.0, 7.0) for _ in range(rng.randint(3, 12)))
lengths = [b - a for a, b in zip(cuts, cuts[1:])]
xs = [(a + b) / 2 for a, b in zip(cuts, cuts[1:])]
s = rng.uniform(-2, 2)
ps = Points(xs, [0.0] * len(xs), [1.0] * len(xs), lengths, [d / 2 for d in lengths], stress=[s] * len(xs))
f = grid_force(ps, 1.0, 10)
for i in range(10):
# only the two ends of the body carry the traction
assert f[i] == pytest.approx(s * hat(cuts[0] - i) - s * hat(cuts[-1] - i), abs=1e-12)
def test_momentum_is_conserved_and_rigid_translation_is_exact():
rng = random.Random(6)
n, dx = 16, 0.5
xs = [rng.uniform(2, 5) for _ in range(30)]
ps = Points(xs, [rng.uniform(-1, 1) for _ in xs], [rng.uniform(0.5, 2) for _ in xs], [0.1] * 30, [0.05] * 30,
stress=[rng.uniform(-1, 1) for _ in xs])
p0 = sum(m * v for m, v in zip(ps.m, ps.v))
for _ in range(50):
ps = gimp_step(ps, dx, n, 10.0, 1e-3)
assert sum(m * v for m, v in zip(ps.m, ps.v)) == pytest.approx(p0, abs=1e-10)
xs = [0.5 + 0.25 * k for k in range(10)]
ps = Points(xs, [0.3] * 10, [1.0] * 10, [0.25] * 10, [0.125] * 10)
for _ in range(100):
ps = gimp_step(ps, 0.5, 12, 50.0, 0.01)
assert ps.v == pytest.approx([0.3] * 10, abs=1e-12)
assert ps.x == pytest.approx([x + 0.3 for x in xs], abs=1e-9)
assert ps.stress == pytest.approx([0.0] * 10, abs=1e-12)
def test_vibrating_bar_first_mode():
young, rho, length, v0 = 100.0, 1.0, 1.0, 0.1
ps, dx, n = vibrating_bar(20, 2, length, rho, v0)
c = math.sqrt(young / rho)
h = 0.1 * dx / c
w1 = math.pi * c / (2 * length)
worst = 0.0
for s in range(1, int(round(0.4 / h)) + 1):
ps = gimp_step(ps, dx, n, young, h, frozenset([0]))
vcm = sum(m * v for m, v in zip(ps.m, ps.v)) / sum(ps.m)
worst = max(worst, abs(vcm - 2 / math.pi * v0 * math.cos(w1 * s * h)))
assert worst < 0.02 * (2 / math.pi * v0)
def test_stress_stays_smooth_when_points_cross_cells():
# displacement amplitude v0 / omega_1 = 0.064 > dx = 0.05, so points cross cell boundaries
young, rho, length, v0 = 100.0, 1.0, 1.0, 1.0
ps, dx, n = vibrating_bar(20, 2, length, rho, v0)
h = 0.1 * dx / math.sqrt(young / rho)
rough = 0.0
for _ in range(800):
ps = gimp_step(ps, dx, n + 8, young, h, frozenset([0]))
st = ps.stress
rough = max(rough, max(abs(st[k + 1] - 2 * st[k] + st[k - 1]) for k in range(1, len(st) - 1)))
assert rough < 0.1 * young * v0 / math.sqrt(young / rho)
History
Bardenhagen and Kober (2004) wrote the weak form of the momentum equation with a characteristic function for the region of each material point. With a Dirac delta as the characteristic function they got the original MPM of Sulsky, Chen and Schreyer (1994), and with the indicator function of a box they got GIMP. They showed that the noise of MPM comes from the jumps of the hat gradients at cell boundaries. Steffen, Kirby and Berzins (2008) analysed the quadrature errors of both methods and their effect on convergence in space. CPDI followed in 2011.
References
- Scott G. Bardenhagen and Edward M. Kober, The generalized interpolation material point method, Computer Modeling in Engineering and Sciences 5(6), 2004, 477-495, the weak form with particle characteristic functions, the GIMP weights and the cell crossing noise
- Michael Steffen, Robert M. Kirby and Martin Berzins, Analysis and reduction of quadrature errors in the material point method (MPM), International Journal for Numerical Methods in Engineering 76(6), 2008, 922-948, the quadrature errors of MPM and GIMP and their effect on convergence
- Deborah Sulsky, Zhen Chen and Howard L. Schreyer, A particle method for history-dependent materials, Computer Methods in Applied Mechanics and Engineering 118(1-2), 1994, 179-196, the original MPM that GIMP changes
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 4J3GZH Edit this page History Report an error Markdown