Skip to content
SpecializedSource checked

Smoothed Particle Hydrodynamics

Simulates fluids with particles that estimate local density and pressure.

Quick Facts

Compact metadata for implementation and discovery.

Category
Simulation
Difficulty
Advanced
Family
Particle Simulation
Tier
Specialized
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
4
Code example
Not ready
Visualization
Ready
Aliases
SPH

Overview

SPH treats fluid as particles and uses smoothing kernels to approximate continuous fluid quantities.

Core Concepts

simulated statefluid stateparticle interactionphysical stateparticle simulationstate updatetime stepnumerical stability

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(n)

Average

O(n k)

Worst

O(n^2)

Space

O(n)

When to Use

  • Use Smoothed Particle Hydrodynamics when you need to find neighboring particles.
  • Use it for fluid simulation with inputs like particles.
  • Use it when approximate behavior over time is more useful than a closed-form answer.
  • Use it when the Particle Simulation tradeoff is acceptable for the problem size.

When Not to Use

  • Avoid it when the time step, grid size, or sample count cannot support stable results.
  • Avoid it when O(n^2) worst-case behavior is too costly for the expected input size.
  • Avoid it when the required output is not updated particle positions and velocities.

What It Does

  • Finds neighboring particles
  • Computes density, pressure, and forces from kernels

Use Cases

  • Fluid simulation
  • Splash effects
  • Astrophysics models

Inputs

  • Particles
  • Kernel radius
  • Fluid parameters

Outputs

  • Updated particle positions and velocities

Key Formulas (1)

Density estimate

densityi = ∑(massj · W(distance(pi, pj), h))
density_i = sum(mass_j * W(distance(p_i, p_j), h))

Estimates fluid density from nearby particles using a smoothing kernel.

Pseudocode

  1. 1.Find neighbors for each particle
  2. 2.Estimate density from nearby particles
  3. 3.Compute pressure and viscosity forces
  4. 4.Integrate velocities and positions
  5. 5.Apply boundary handling

Canonical Example

Input
position = 0, velocity = 2, time step = 0.5
Output
next simulated state
Explanation
Smoothed Particle Hydrodynamics: The algorithm advances the system by applying its update rule over a small step.

Implementation Notes

  • Keep the input contract explicit: Particles; Kernel radius; Fluid parameters.
  • Use this step as the implementation spine: Find neighbors for each particle.
  • Then preserve the next state change: Estimate density from nearby particles.
  • Track units and invariants such as mass, energy, or count where they matter.

Common Pitfalls

  • Efficient neighbor search is essential for large SPH simulations.
  • Using a time step that is convenient for rendering but unstable for the simulated system.
  • Returning updated particle positions and velocities without handling empty, invalid, or boundary inputs.

Interactive Mechanism Walkthrough

Iterative Convergence & State Trajectory

Show particles flowing while neighbor kernels shape pressure forces.

Smoothed Particle Hydrodynamics mechanism walkthrough step 1 of 5x₀x₁x₂x*
Step 1 of 5: Find neighbors for each particle
fluid-particles

Notes

Smoothed Particle Hydrodynamics operates in O(n k) time and O(n) space within the Particle Simulation family. Key governing relation: density_i = sum(mass_j * W(distance(p_i, p_j), h)). Often compared with Position Based Dynamics and N-Body Simulation.

Sources (1)

What each reference supports for this entry.

Monaghan SPH review

Paper

Annual Reviews reference for smoothed particle hydrodynamics foundations.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Both simulate fluids using particle/grid-inspired local updates.

Position Based Fluids adapts particle fluid ideas with position constraints.

Tags

SimulationFluid SimulationParticlesPhysics