---
title: "Wall treatment and y+: wall functions, first cell height and layer coverage"
url: "https://tryreynolds.com/docs/guides/wall-treatment"
description: "Where the first cell has to sit, which wall function each generated case carries and the band it is valid in, how to size the first cell, and how to measure the y+ and the layer coverage a finished mesh really has."
---

**[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/guides/wall-treatment. It lives at https://tryreynolds.com/docs/guides/wall-treatment.md, and
[tryreynolds.com/llms.txt](https://tryreynolds.com/llms.txt) indexes every one of them.

Guides

# Wall treatment and y+

Where the first cell has to sit, which wall function each generated case carries and the band it is valid in, how to size the first cell, and how to measure the y+ and the layer coverage a finished mesh really has.

Skin friction, heat transfer and separation are all decided in the first few cells off a wall. Three things have to agree there: where the first cell centre sits, which wall function the case carries, and how much of the wall actually has the layers you asked for. This guide is how the toolbox sets and measures each of them.

## The three regions

| Region | y+ | What holds |
|---|---|---|
| Viscous sublayer | 0 to 5 | `u+ = y+` |
| Buffer layer | 5 to 30 | neither law |
| Log layer | 30 and up | `u+ = ln(y+)/0.41 + 5.2` |

The sublayer and the log law meet at y+ 11.0623 with those constants, and between 10.8049 and 12.0502 across the published spread of the constants. `pipe_friction.py` computes the crossing and grades itself on it.

## What the case writers put on a wall

| Field | Condition | Written by |
|---|---|---|
| `nut` | `nutUSpaldingWallFunction`, on every model, RAS and LES | `case_gen.py`, `compressible.py`, the rotating template |
| `k` | `kqRWallFunction` | the same |
| `omega` | `omegaWallFunction` | the same |
| `epsilon` | `epsilonWallFunction` | the same |
| `nuTilda` | `fixedValue 0` | `case_gen.py`, `compressible.py` |
| `alphat` | `compressible::alphatWallFunction`, `Prt 0.85` | `compressible.py` |

Spalding's law is written everywhere because it blends through all three regions. On a mesh that really is in the log layer it agrees with the plain high-Re form; on one that is not, the plain form extrapolates where nothing supports it. A study measured y+ from 40 to 1713 on an aerofoil O-grid that carried the plain form.

### The band each condition is written for

This is the table `wall.py` judges a finished run against.

| Condition | Valid y+ | Note |
|---|---|---|
| `nutUSpaldingWallFunction` | any | the blend written by default |
| `nutUBlendedWallFunction` | any | another blend |
| `nutkWallFunction` | 30 to 300 | plain high-Re Launder and Spalding |
| `nutUWallFunction` | 30 to 300 | the same, solved on U |
| `nutkRoughWallFunction` | 30 to 300 | with a roughness height |
| `nutkAtmRoughWallFunction` | 30 to 300 | atmospheric ground |
| `nutLowReWallFunction` | 0 to 5 | assumes the sublayer is resolved |

Note

A blended condition makes y+ a softer requirement, not an irrelevant one. If the answer is a friction drag, a heat flux or a separation point, a resolved sublayer is still worth more than any wall function. Real geometry always has y+ near zero at stagnation and separation points, so the useful question is what fraction of the area that matters sits in the valid range.

## Sizing the first cell

The a priori estimate the toolbox uses is the flat-plate one:

```
Re_x  = Re / 2
cf    = 0.0576 Re_x^-0.2
u_tau = U sqrt(cf / 2)
y+    = (first cell height / 2) u_tau / nu
```

Turned round, the first cell height for a target y+ is `2 y+ nu / u_tau`.

| Target | Use it for | What the mesh needs |
|---|---|---|
| y+ about 1 | friction drag, heat transfer, separation, transition, wall-resolved LES | first cell centre in the sublayer, several layers growing at about 1.2 |
| y+ 30 to 300 | quick external aerodynamics, ducts whose drop is losses rather than friction | first cell centre in the log layer |
| y+ 5 to 30 | avoid on purpose | only a blended condition survives it |

`case_gen.py` prints this estimate for the mesh it dresses. On an LES case it does so per wall, from the first-cell height `layer_report.py` measures off `constant/polyMesh`. It is an order of magnitude and has been very wrong: on one O-grid it said 1200 and the solution came back at 40 to 1713.

## Measuring it afterwards

```bash
python3 /work/.toolbox/wall.py /work/case                   # y+ per patch, and the fractions
python3 /work/.toolbox/wall.py /work/case --png yplus.png
python3 /work/.toolbox/layer_report.py /work/case --patch hull --ref /work/case_nolayers
```

`wall.py` reads whichever of three sources the run left, and labels which:

1. `postProcessing/yPlus/`, from OpenFOAM's own function object. Turbulent cases from `case_gen.py` carry it; `--yplus` asks for it at any model.
2. A written `yPlus` field, where every face has a value, so the fraction in each region is a real fraction.
3. `wallShearStress`, from which y+ is derived as `sqrt(tau) y / nu`. The viscosity comes from `constant/transportProperties` or `--nu` and is never defaulted.

A `yPlus` written at time 0 is an initial condition and is skipped unless you ask for it with `--time 0`.

`layer_report.py` answers a different question: how much of the wall carries a prism layer at all. It computes the first-cell height at every patch face from the mesh files, and compares it against the same wall meshed without layers (`--ref`) or a known spacing (`--wall-spacing`).

## Layer coverage is measured, never quoted

snappyHexMesh inserts prisms and then deletes them where a quality metric fails. On one hull it reached 88.6% on its first iteration and eroded to 66.7% by its fiftieth, printed 66.7%, and exited 0. cfMesh extrudes a sheet and optimises afterwards, and covered 100.0% of the same wall.

| Symptom | Usual response |
|---|---|
| Widespread collapse | fewer layers, or a gentler expansion ratio |
| Collapse at sharp features | lower `minThickness`, higher `featureAngle` |
| Collapse on tight curvature | one more level of surface refinement |
| Partial coverage away from the answer | often acceptable; say so in the report |
| Layers requested on a patch that is not named | no layer and no warning; check the `layers` entry |

cfMesh covers the wall but has no y+ control: the stack is sized from the local cell, so y+ is something to measure afterwards. snappyHexMesh is the only one of the two that takes an absolute first-layer thickness. [Meshing engines](https://tryreynolds.com/docs/guides/meshing-engines.md) compares them.

## Pitfalls

- **Grid studies with changing coverage.** One study had to be thrown away because coverage varied 75, 88 and 91% across its members while the friction ratio drifted from 1.009 to 1.159. It measured mesh-dependent wall treatment and called it discretisation error. Measure coverage on every member of a [mesh study](https://tryreynolds.com/docs/guides/mesh-independence.md).
- **A refinement ladder through the buffer layer.** On a hull, meshes landing between y+ 5 and 30 moved a form factor by 29% where the published round robin sees at most 4.5%.
- **A wall typed `patch`.** `gmshToFoam` types everything `patch`, so walls are retyped afterwards. Every template does this.
- **`relativeSizes` with a thick request.** A thickness given as a fraction of the local cell can be larger than the cell it has to fit in, and the layers vanish. ESI's own `airfoilWithLayers` settings gave 0% coverage on one hull for exactly this reason.

## Ask the agent

```
Mesh this hull for y+ about 1 and show me the layer coverage off the mesh, not off the
mesher's own table.
```

```
Before you quote the drag, tell me what fraction of the wetted area sits in the buffer layer.
```

## Related

[Turbulence models](https://tryreynolds.com/docs/guides/turbulence-models.md), [boundary conditions](https://tryreynolds.com/docs/guides/boundary-conditions.md), [simpleFoam](https://tryreynolds.com/docs/solvers/simplefoam.md), [pipe friction references](https://tryreynolds.com/docs/solvers/pipe-friction.md) and the [measuring scripts](https://tryreynolds.com/docs/toolbox/measuring.md). The study behind the wall-law numbers is [a correlation checked against its own claim](https://tryreynolds.com/studies/pipe-friction-and-the-wall.md).

## 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.
