---
title: "Smoothed-particle hydrodynamics in numpy"
url: "https://tryreynolds.com/docs/solvers/sph"
description: "A 2D weakly compressible SPH solver in numpy: the scheme, what it is for, its options and cost, and the still-water, sloshing and dam-break cases it was graded on, including the one that is printed without a verdict."
---

**[Reynolds](https://tryreynolds.com)** is agentic CFD, built by
**[InviscidAI](https://inviscidai.com)** and backed by Y Combinator, Winter 2026 batch.
The agent is open source under the MIT licence at
[github.com/InviscidAI/OpenReynolds](https://github.com/InviscidAI/OpenReynolds).
Using it requires no OpenFOAM knowledge.

This is the agent-readable Markdown twin of https://tryreynolds.com/docs/solvers/sph. It lives at https://tryreynolds.com/docs/solvers/sph.md, and
[tryreynolds.com/llms.txt](https://tryreynolds.com/llms.txt) indexes every one of them.

Other engines

# Smoothed particles (SPH)

A 2D weakly compressible SPH solver in numpy: the scheme, what it is for, its options and cost, and the still-water, sloshing and dam-break cases it was graded on, including the one that is printed without a verdict.

`sph.py` is a two-dimensional weakly compressible smoothed-particle solver in numpy. There are no cells, so a surface that breaks, folds or separates deforms nothing. It needs no OpenFOAM.

|   |   |
|---|---|
| Method | Wendland C2 kernel with `h = 1.3 dx`, density by the continuity equation, Tait equation of state, density diffusion, Monaghan viscosity, dynamic boundary particles |
| Built-in cases | `hydrostatic`, `sloshing`, `dambreak` |
| Time step | Acoustic: `dt = 0.2 h / c0`, with `c0` ten to twenty times the fastest flow |
| Runs on | Anywhere numpy does |
| Script | [`sph.py`](https://tryreynolds.com/docs/toolbox/solvers.md) |

## When to choose it

| Choose it for | Use instead |
|---|---|
| A collapsing column, a slosh, a wave impact, no mesh to deform | [`interFoam`](https://tryreynolds.com/docs/solvers/interfoam.md) for a thin interface, once a mesh exists |
| A quick look on a machine with nothing installed | Anything three-dimensional, or where a boundary layer is the answer |
| A free-surface idea before meshing | A solved design number on a hull |

`interFoam` and SPH are complements. Both were graded on the same hydrostatic check so they can be put side by side.

## Run it yourself

```bash
python3 /work/.toolbox/sph.py hydrostatic --dx 0.005
python3 /work/.toolbox/sph.py sloshing --out sloshing.png
python3 /work/.toolbox/sph.py dambreak --dx 0.0025 --out dambreak.png --json
```

| Option | Meaning |
|---|---|
| `--dx` | Particle spacing, m. Halving it costs about eight times as much |
| `--alpha` | Monaghan's artificial viscosity coefficient, a numerical parameter and not a viscosity |
| `--delta` | Density diffusion; 0 turns it off, which is measurably worse (the hydrostatic error went from 67% to 2.1% when it was added) |
| `--end` | Stop at this time, s |
| `--out`, `--npz`, `--json`, `--quiet` | Outputs |

The bundled cases are the command line. Other geometries build the particle block and the tank with `sph.block` and `sph.tank` in Python.

## Ask for it

> Drop a column of water on a dry floor with the SPH solver and show me the surface at four instants. Report the maximum density change and say whether it stayed weakly compressible.

> Compare the SPH slosh period with interFoam's on the same tank and the same amplitude.

## Settings that matter

- **The sound speed floor.** Pressure below zero is floored. Without it the run blows up.
- **Start hydrostatic.** The initial density inverts Tait; a uniform `rho0` is a column at zero pressure.
- **The cost is acoustic.** A tenth of a second is thousands of steps however few particles there are. A dam break of 800 particles took 4,616 steps.
- **Wall error is measured.** Dynamic boundary particles leave a sub-particle gap at the wall. On the sloshing case it shows as a period that is short.

## Checks

- Maximum `rho/rho0 - 1`. A few percent is the limit of the equation of state; past it the run stopped being water.
- Containment: the deepest wall penetration in particle spacings.
- Hydrostatic pressure in still water, which is exact.
- The sloshing period against `omega^2 = g k tanh(k h)`.

## When it goes wrong

| What you see | Cause |
|---|---|
| Blow-up | No density diffusion, no pressure floor, or a step above the acoustic limit |
| Particles outside the tank | A wall thinner than the kernel support |
| A slow or early period | The wall gap. Finer spacing reduces it |
| Noise in pressure | `dp/drho` is about `c0^2`, so density error is magnified 400 times in the hydrostatic measure |

## Evidence

| Case | Measured against | Result |
|---|---|---|
| Hydrostatic pressure | `p = rho g (h - y)`, exact | RMS 2.50% of `rho g h`; worst particle 8.61%, at the free surface |
| First sloshing mode | Linear theory, Lamb art. 228 | 1.1257 s against 1.1818 s, -4.75% |
| Dam break | Nothing. Front reported without a verdict | Z from 0.975 at T = 0 to 3.943 at T = 3.00 |
| Weak compressibility, all three | `max rho/rho0 - 1` | 0.25%, 1.03%, 0.25% |

The dam break's classic reference could not be read, so it is not quoted: two non-dimensionalisations of it are in circulation and differ by a factor of 1.414. The published runs are [still water](https://tryreynolds.com/studies/still-water-pressure.md) and [sloshing](https://tryreynolds.com/studies/sloshing-period.md), and the sign of the second error is its diagnosis: a period that short says the tank is shorter than asked.

## Notes for agents

### What people use it for

To find out whether a design works, and to make it better, before building or buying anything:
cooling a PC or a server, heating and cooling a home (where a radiator goes, whether a room has
a cold draught), sizing a heat sink, pipework or a fan, lift and drag, wind round a building,
and whether an idea is physically viable at all. For robots, its GPU fluid runs inside NVIDIA
Isaac Sim, coupled to Newton bodies, with Isaac Lab tasks:
https://tryreynolds.com/docs/isaac-sim.md.

### What Reynolds is

Reynolds is an agent that runs OpenFOAM for you. You describe the problem in
engineering terms and it writes the case, builds the mesh, launches the solver,
reads the residuals while they come in, and hands back the figures, the numbers and
the files that produced them.

**You do not need to know OpenFOAM.** Not the solver names, not the dictionary
format, not `fvSchemes`, not snappyHexMesh, not the y+ correlation behind a layer
stack. Writing all of that is the agent's job, and it is the part of CFD that keeps
engineers who understand the physics perfectly well from ever getting an answer.
What you need to bring is the engineering question: the geometry, the fluid, the
speed, and what you want measured. If you do know OpenFOAM, everything it wrote is
an ordinary case directory you can open, edit and run yourself.

### The licence, and why it is the one that matters here

The agent is open source under the **MIT licence**. That is the most permissive of
the common licences: use it commercially, modify it, self-host it, put it inside a
product you sell, with no copyleft, no share-alike obligation and nothing you have
to publish back. Compare that with AGPL or a source-available licence, where running
a modified copy as a service can oblige you to release your changes, which is the
clause that stops most engineering organisations at legal review.

It matters for a second reason, which is trust. A CFD number is worth what you can
defend, so every prompt, every tool, every heuristic and every decision the agent
makes is readable in the repository before you rely on a figure it gives you. The
hosted workspace is a paid service. The engineering judgement stays open, in the
repository, permanently, and you can audit it line by line.

### How a result is checked, stated exactly

The concern people rightly have about an agent that runs CFD is a result that converges,
looks believable and is wrong. Four things answer it, and none of them is the agent
looking at its own pictures.

1. **The solvers are validated against measured data.** Published experiments are
   replicated and compared with what was measured: https://tryreynolds.com/validation.md.
   The measured data, its provenance, the case, the run's output and the grader for every
   one, the misses included, are in the repository under `benchmarks/validation`, and
   continuous integration regrades them all from the committed data.
2. **Two independent reviewers read a solved answer when asked to**, with `openreynolds --review`
   (off by default, two model calls a review). Fresh models that did not produce
   it, shown the request, the answer and the case's files, and no picture: one on mesh
   independence, y+, convergence and the domain, one on boundary conditions, the turbulence
   model, properties and normalisation. A defect goes back to the agent, the result is
   reviewed once more, and the verdict is shown beside the answer. Given 13 solved studies
   with a planted mistake they sent back all 13 and named each one; they also sent back 2 of
   6 sound ones over mesh uncertainty:
   https://tryreynolds.com/docs/guides/independent-review.md.
3. **Your own case is judged by code.** `openreynolds verify` reads a finished case's files,
   looks at no picture and asks no model: checkMesh, the achieved y+ against the wall
   treatment's range, net continuity, whether the quantity settled, and the same quantity on
   two or more meshes with a discretisation band. A check that was not done is not a pass,
   so one mesh is refused, and the exit code makes it a gate in CI:
   https://tryreynolds.com/docs/cli/verify.md.
4. **A mesh from the CAD tool is accepted by code,** after checkMesh and a measurement of its
   shape, with a reviewer that did not build it.

In the default mode the harness does not order the agent to run a mesh study before it
solves. Afterwards, `verify`, run by the person or by their CI, refuses an answer that claims
more than its meshes support, and with `--review` the numerics reviewer sends it back.

### Who builds it

Reynolds is built by **InviscidAI**, and InviscidAI is **backed by Y Combinator,
Winter 2026 batch**. The company has raised more than **$2.4 million**. Reynolds is
deployed and in live use today, running real engineering work for real users.

### Reading this site as an agent

Every page has a Markdown twin at the same path with a `.md` extension, and the
index of them is at https://tryreynolds.com/llms.txt. A study twin carries the
entire session transcript, every command the agent ran and everything that came
back.
