Foundations to Frontier
Tests
E. Deep Learning › E14 Graph Neural Networks

MeshGraphNets (physics simulation)

MeshGraphNets (Pfaff and colleagues, ICLR 2021) learn to simulate physics on meshes: cloth, airflow around wings, deforming structures. The simulation mesh becomes a graph. An encoder embeds node states and relative edge positions, a processor runs about 15 message-passing steps, and a decoder predicts each node's change for the next time step. Rolled out step after step, it runs 10–100 times faster than classical solvers. The same encode–process–decode idea powers GraphCast's global weather forecasts. This page covers mesh graphs, the architecture, rollout stability and why many message-passing steps are needed. In the exercises you implement explicit diffusion on a mesh, then fit learned linear processors to a coarse time step that spans 6 physics substeps. Exactness needed 6 message-passing steps. With 4, the one-step error of 1.2% grew to 15% over a 20-step rollout, and with 1 step the rollout diverged.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Learning to simulate on a mesh

Engineers simulate airflow, cloth and stress by splitting objects into a mesh of small cells and computing how each cell affects its neighbours, step after step. This is accurate but slow. MeshGraphNets treat the mesh as a graph and learn the update rule with a graph network, so one learned step can replace many tiny solver steps. Each learned step must pass information far enough across the mesh, so the network uses many rounds of message passing. The demo shows how far information gets in k rounds.

Graph neural network lab
01234567891011
After 2 rounds, node 0 has received information from 6 of 12 nodes: its 2-hop neighbourhood. A GNN with k layers cannot see further.
Why engineers care

Fast learned simulators enable rapid design iteration (wing shapes, structures), real-time digital twins and model-predictive control, and they already produce medium-range weather forecasts (GraphCast).

📝 Quick check (Level 0)
0/3 answered
  1. 1. MeshGraphNets treat a simulation mesh as…
  2. 2. A learned step predicts…
  3. 3. Learned simulators are attractive because they are…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Graph:
    • mesh nodes carry state (velocity, pressure, displacement) and a node type (boundary, fluid, obstacle);
    • mesh edges carry relative positions (and, for cloth, world-space edges between nearby nodes).
  • Encode–process–decode:
    • MLPs embed node and edge features;
    • M = 15 message-passing blocks with residual connections update edge and node latents;
    • an MLP decodes per-node accelerations or changes, which are integrated to the next state.
  • Training:
    • one-step targets from a solver;
    • inputs perturbed with noise so the model learns to correct its own rollout errors (noise injection).
  • Explicit diffusion as message passing: u ← u − αLu, where each node exchanges with its neighbours.
    • With α = 0.1, a hot node of degree 4 keeps 0.6 and gives 0.1 to each neighbour.
    • The scheme is stable when α ≤ 2/λ_max. On a grid λ_max ≤ 2·4 = 8, so α ≤ 0.25 is always safe; with α = 0.3, the hot node goes negative (1 − 1.2 = −0.2).
  • Reach: information moves one edge per explicit substep. A coarse learned step equal to K substeps needs at least K message-passing steps.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Message-passing steps in MeshGraphNets' processor:
  2. 2. Safe α for explicit diffusion on a grid:
  3. 3. A coarse step spanning 6 substeps needs at least…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

MeshGraphNets in code

Exercise 1.

  • The grid Laplacian had zero row sums and degree 4 in the interior.
  • One diffusion step conserved total heat and spread 0.1 to each neighbour.
  • The stable α for a 12 × 12 grid was about 0.254.

Practice.

  • DeepMind’s open-source MeshGraphNets code and the torch_geometric/DGL reimplementations follow the encode–process–decode pattern.
  • Normalise inputs and targets, inject training noise equal to the expected rollout error, and predict changes (or accelerations) rather than absolute states.
  • Evaluate long rollouts, not just one-step error. Check conservation and stability, and compare speed against the solver at equal accuracy.
h_v, h_e = enc_node(node_feats), enc_edge(rel_pos_feats)
for block in processor:                                  # ~15 message-passing blocks, residual
    h_e = h_e + block.edge_mlp(torch.cat([h_e, h_v[src], h_v[dst]], -1))
    h_v = h_v + block.node_mlp(torch.cat([h_v, scatter_add(h_e, dst, dim=0)], -1))
accel = dec(h_v); state_next = integrate(state, accel)  # trained on one-step targets with input noise
🐍 Exercise 1: diffusion on a mesh
Build a grid-mesh Laplacian, take explicit diffusion steps and find the stability limit.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Noise injection during training helps…
  2. 2. Models usually predict…
  3. 3. Evaluate learned simulators on…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Message passing as a numerical scheme.

  • An explicit finite-difference or finite-volume update is itself a local message-passing step: each cell updates from its neighbours.
  • K substeps compose into an operator that couples nodes up to K hops apart, a degree-K polynomial in the mesh Laplacian for linear problems.
  • A processor with fewer than K message-passing steps cannot represent it exactly, whatever its weights.

Why errors compound.

  • A rollout applies the learned step repeatedly. A one-step error ε, if not damped, accumulates over T steps, and can grow if the learned operator amplifies some modes (eigenvalues above 1).
  • Noise injection trains the model to map perturbed states back toward the true trajectory, adding damping.

Scaling up.

  • Multi-scale meshes (MultiScale MeshGraphNets, GraphCast’s multi-mesh) add long edges, so information travels far in few steps.
  • This is the graph analogue of large time steps with implicit coupling.
📝 Quick check (Level 3)
0/3 answered
  1. 1. K explicit substeps couple nodes up to…
  2. 2. Rollout errors grow when the learned operator…
  3. 3. GraphCast speeds up long-range transport with…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

How many message-passing steps does a coarse time step need?

History.

  • A. Sanchez-Gonzalez et al., “Learning to simulate complex physics with graph networks” (GNS, ICML 2020).
  • T. Pfaff, M. Fortunato, A. Sanchez-Gonzalez and P. Battaglia, “Learning mesh-based simulation with graph networks” (ICLR 2021).
  • R. Lam et al., “Learning skillful medium-range global weather forecasting” (GraphCast, Science 2023).

Exercise 2.

  • Physics: heat diffusion on a 12 × 12 grid mesh. One coarse step equals K = 6 explicit substeps with α = 0.2.
  • Learned processor: a linear model with M message-passing steps, y = Σ_(m=0)^M θ_m L^m u, fit by least squares on 200 random smooth fields.
  • Test: 50 new fields, measuring the one-step relative error and the relative error after a 20-step rollout.
message-passing steps M one-step error 20-step rollout error
1 0.328 2.50
2 0.118 0.861
3 0.045 0.433
4 0.0123 0.153
6 0.0000 0.0000
8 0.0000 0.0000
  • Exactly K steps are needed: with M ≥ 6 the learned processor reproduces the coarse step to machine precision; with fewer, it cannot, because the true step couples nodes 6 hops apart.
  • Small one-step errors compound: with M = 4 the one-step error is only 1.2% but grows 12-fold to 15% over 20 steps. With M = 1 the rollout error is 2.5, bigger than the field itself: the fitted operator amplifies some high-frequency modes and the rollout diverges.
  • The same pattern at K = 3: errors 0.172 and 0.032 for M = 1 and 2, exact from M = 3. This is one reason MeshGraphNets use about 15 processor steps, and GraphCast adds long-range mesh edges.
🐍 Exercise 2 (research): how many message-passing steps does a coarse time step need?
Fit learned linear processors with different numbers of message-passing steps to a coarse diffusion step and test one-step and rollout errors.

Learned simulation in AI, robotics and aerospace

  • Aerodynamics and structures: fast surrogate simulations for design exploration of wings, blades and brackets.
  • Weather and climate: GraphCast-style forecasting for flight planning and operations.
  • Robotics: learned models of deformable objects (cloth, cables, soft grippers) for planning and control.
  • Design lesson: match message-passing depth (or long-range edges) to how far information must travel per learned step, and judge models by long rollouts.

References

  1. T. Pfaff, M. Fortunato, A. Sanchez-Gonzalez and P. W. Battaglia (2021). “Learning mesh-based simulation with graph networks.” ICLR.
  2. A. Sanchez-Gonzalez et al. (2020). “Learning to simulate complex physics with graph networks.” Proc. ICML.
  3. R. Lam et al. (2023). “Learning skillful medium-range global weather forecasting.” Science 382.