Reference · Physics · Numerical Methods · Fluids
📅 July 2026 ⏱ ≈ 14 min read 🔄 Updated: July 2026

Comparison of Simulation Methods — Integrators, Fluid Models & Monte Carlo

"Simulation" covers a wide family of numerical techniques with very different accuracy, stability, and cost trade-offs. This reference compares the time-stepping integrators (Euler, Verlet, RK4, implicit), the two fundamental ways of modelling continuous media (Lagrangian vs. Eulerian), and stochastic Monte Carlo methods — so you can pick the right tool instead of defaulting to whatever the last tutorial used.

1. Integrator Comparison Table

The integrator is the piece of code that advances position and velocity by a timestep dt. All of the differences below come down to three properties: order of accuracy (how fast the local error shrinks as dt shrinks), energy behaviour (does the simulation gain or lose energy over long runs), and cost (force evaluations per step).

Method Order Evals/step Energy behaviour Stability Typical use
Explicit Euler 1st 1 Gains energy (diverges) Poor Teaching only
Semi-implicit EulerGames 1st 1 Bounded oscillation Good (symplectic) Game physics, particles
Verlet (position) 2nd 1 Bounded oscillation Good (symplectic) Cloth, ropes, N-body
Velocity Verlet 2nd 1–2 Bounded oscillation Good (symplectic) Molecular dynamics
RK4Accurate 4th 4 Slow secular drift Non-symplectic Orbits, chaos (Lorenz)
Implicit Euler 1st 1 (solve) Loses energy (damped) Unconditionally stable Stiff cloth/soft body
Leapfrog 2nd 1 Bounded oscillation Good (symplectic) N-body / astrophysics

"Symplectic" methods exactly conserve a nearby (shadow) Hamiltonian, so energy error stays bounded forever instead of drifting away — critical for long-running simulations like orbital mechanics or particle systems that must not visibly gain energy.

2. Explicit Euler

The simplest possible integrator: evaluate the derivative at the current state, then step forward using that single slope estimate.

v(t+dt) = v(t) + a(t)·dt x(t+dt) = x(t) + v(t)·dt
// Explicit (forward) Euler — DO NOT use for anything oscillatory
function stepEuler(body, dt) {
  const a = body.force.scale(body.invMass);
  body.pos = body.pos.add(body.vel.scale(dt)); // uses OLD velocity
  body.vel = body.vel.add(a.scale(dt));
}

Because position uses the velocity from before the force was applied, explicit Euler systematically adds energy to any oscillating system (springs, orbits, pendulums). A frictionless spring simulated with explicit Euler will visibly spiral outward and eventually explode, no matter how small dt is made — the error only shrinks, it never disappears qualitatively. It is included here purely as the baseline every other method improves on.

3. Semi-Implicit (Symplectic) Euler

A one-line fix: update velocity first, then use the new velocity to update position. Same cost as explicit Euler, dramatically better energy behaviour.

v(t+dt) = v(t) + a(t)·dt x(t+dt) = x(t) + v(t+dt)·dt ← uses the NEW velocity
function stepSemiImplicit(body, dt) {
  const a = body.force.scale(body.invMass);
  body.vel = body.vel.add(a.scale(dt));      // velocity first
  body.pos = body.pos.add(body.vel.scale(dt)); // then position, using new v
}
Why games use this everywhere: it is symplectic — energy oscillates around the true value instead of drifting away. It is also trivially cheap (one force evaluation) and simple to implement, which is why almost every real-time physics engine (Box2D, Cannon-es, Rapier's default) uses semi-implicit Euler as its base integrator, usually combined with substepping for extra accuracy.

4. Verlet & Velocity Verlet

Position (Störmer) Verlet drops velocity entirely and derives it implicitly from two stored positions. It is second- order accurate for the same single force evaluation as Euler, which makes it the default choice for cloth, ropes, and particle chains.

x(t+dt) = 2·x(t) − x(t−dt) + a(t)·dt² (implied velocity ≈ (x(t+dt) − x(t−dt)) / (2·dt))
function stepVerlet(p, dt) {
  const a = p.force.scale(p.invMass);
  const next = p.pos
    .scale(2)
    .sub(p.prevPos)
    .add(a.scale(dt * dt));
  p.prevPos = p.pos;
  p.pos = next;
}

Velocity Verlet keeps an explicit velocity, giving the same second-order accuracy but with a usable v(t) for damping, drag, or velocity-dependent forces:

x(t+dt) = x(t) + v(t)·dt + ½·a(t)·dt² v(t+dt) = v(t) + ½·(a(t) + a(t+dt))·dt ← needs a SECOND force eval
Why cloth solvers prefer position Verlet: constraints (fixed rope lengths, distance constraints between cloth particles) can be applied by directly moving positions after the integration step, with no need to touch a velocity vector. This "Verlet integration + constraint relaxation" combo (popularised by Thomas Jakobsen's 2001 paper) is still the standard technique for real-time cloth and soft-body ropes today.

5. Runge-Kutta 4 (RK4)

RK4 samples the derivative four times per step — at the start, twice at the midpoint, and once at the end — and combines them into a weighted average. It is fourth-order accurate: halving dt shrinks the local error by roughly 16×, versus 4× for Verlet and 2× for Euler.

k1 = f(t, y) k2 = f(t + dt/2, y + dt/2·k1) k3 = f(t + dt/2, y + dt/2·k2) k4 = f(t + dt, y + dt·k3) y(t+dt) = y(t) + dt/6·(k1 + 2·k2 + 2·k3 + k4)
function rk4Step(state, dt, derivative) {
  const k1 = derivative(state);
  const k2 = derivative(addScaled(state, k1, dt / 2));
  const k3 = derivative(addScaled(state, k2, dt / 2));
  const k4 = derivative(addScaled(state, k3, dt));
  return addScaled(
    state,
    combine(k1, k2, k3, k4), // k1 + 2k2 + 2k3 + k4
    dt / 6
  );
}

This site's Lorenz Attractor and Double Pendulum simulations use RK4 because chaotic systems amplify small numerical errors exponentially — a low-order integrator's error becomes visually wrong trajectories within seconds. RK4's downside: it is not symplectic, so orbital simulations run with RK4 slowly gain or lose energy over thousands of orbits (use Leapfrog or Verlet instead for N-body work that must run indefinitely).

6. Implicit Euler & Stiff Systems

Implicit (backward) Euler evaluates the force at the future state instead of the current one, which requires solving an equation (often a sparse linear system) each step rather than just plugging in numbers.

v(t+dt) = v(t) + a(t+dt)·dt ← a depends on the unknown v(t+dt) x(t+dt) = x(t) + v(t+dt)·dt

This extra work buys unconditional stability: even with a huge dt, an implicit integrator will not blow up — it just damps out high-frequency motion, which is usually a feature. That property matters most for stiff systems, where forces vary over very different time scales (e.g. a very taut cloth spring next to a loose one). Baraff and Witkin's 1998 "Large Steps in Cloth Simulation" paper popularised implicit integration for cloth precisely because explicit methods needed impractically tiny timesteps to stay stable on stiff springs.

Position Based Dynamics (PBD) and XPBD sidestep the force/velocity formulation entirely: they directly solve position constraints each frame (Gauss-Seidel style, similar to the sequential-impulse solver described in Build a Physics Engine From Scratch). PBD trades some physical accuracy for guaranteed stability at any timestep, which is why it now underpins most real-time cloth and soft-body solvers in games (NVIDIA Flex, Unity's cloth system).

7. Lagrangian vs. Eulerian Fluid Simulation

Beyond single-particle integrators, continuous media (fluids, smoke, terrain erosion) can be modelled from two opposite viewpoints.

Lagrangian: follow the material

Represent the fluid as a set of moving particles, each carrying mass, velocity, and density. Smoothed Particle Hydrodynamics (SPH), used in this site's SPH Fluid simulation, is the classic example: each particle's properties are computed by smoothing (kernel-weighting) over nearby particles.

ρᵢ = Σⱼ mⱼ · W(rᵢ − rⱼ, h) (density from neighbours) Pᵢ = k · (ρᵢ − ρ₀) (equation of state) Fᵢ = −Σⱼ mⱼ·(Pᵢ+Pⱼ)/(2ρⱼ)·∇W(rᵢ−rⱼ,h) (pressure force)

SPH naturally conserves mass (particles ARE the mass), handles free surfaces and splashing without extra bookkeeping, and its cost scales with the number of particles rather than the size of empty space. Its downside is the O(N·k) neighbour search every step and noisier surfaces at low particle counts.

Eulerian: fix a grid, let material flow through it

Discretise space into a fixed grid and store velocity/density/ pressure at each cell, solving the Navier-Stokes equations with finite differences. Jos Stam's "Stable Fluids" method (semi-Lagrangian advection + pressure projection) is the standard real-time technique:

∂v/∂t + (v·∇)v = −∇p/ρ + ν∇²v + f (momentum) ∇·v = 0 (incompressibility)

Grid methods give smooth, artifact-free fields and are ideal for smoke, gases, and reaction-diffusion patterns (see this site's Reaction-Diffusion simulation, which uses a fixed-grid ping-pong GPU texture). Their weakness is resolution-bound cost — a 256×256 grid spends equal compute on empty air and the interesting fluid region — and grid methods lose fine detail (small droplets, thin sheets) below one cell's size.

Property Lagrangian (SPH) Eulerian (grid)
Mass conservation Exact (particles = mass) Approximate (advection error)
Free surfaces / splashes Natural Needs level-set / VOF tracking
Smooth fields (smoke, gas) Noisy at low counts Smooth by construction
Cost scaling O(N particles) O(cells), independent of content
Typical GPU technique Spatial hash / neighbour grid Ping-pong FBO / compute shader
Hybrid FLIP/PIC and MPM (Material Point Method) combine both: particles carry state, a background grid solves pressure — used in modern VFX fluid and snow simulation (e.g. Disney's Frozen snow solver).

8. Monte Carlo Methods

Not every simulation advances a deterministic state through time. Monte Carlo methods use repeated random sampling to estimate a result that would otherwise require an intractable integral or exhaustive search — trading determinism for a statistical answer that converges as sample count grows.

Error ∝ 1/√N (N = number of samples) → to halve the error you must QUADRUPLE the sample count, regardless of the problem's dimensionality

That 1/√N convergence rate is both Monte Carlo's biggest strength and its biggest weakness: it is the same rate no matter how many dimensions the problem has, which is why Monte Carlo beats grid-based quadrature for high-dimensional integrals (path tracing light transport, financial option pricing), but it converges slowly compared to a good deterministic method when the dimensionality is low.

Deterministic vs. stochastic is a separate axis from the integrator choice above: you can combine Monte Carlo sampling (for, say, initial particle placement or stochastic wind gusts) with any deterministic integrator (Verlet, RK4) for the time-stepping itself. The two are not mutually exclusive.

9. How to Choose

Rule of thumb: if a demo runs fine for 10 seconds but visibly gains energy or explodes after a minute, you are almost certainly using a non-symplectic integrator (explicit Euler or RK4) on a system that should use a symplectic one (semi-implicit Euler, Verlet, or Leapfrog).