Natural grid stretching for DNS of wall-bounded flows
Python scripts to design the wall-normal grid of DNS of incompressible (pipe, channel, open channel, boundary layer) and compressible wall-bounded flows
The natural stretching blends uniform grid spacing next to the wall with spacing proportional to the local Kolmogorov length scale in the outer wall layer, where η⁺ ≈ c_η y⁺^(1/4). In terms of the grid index j counted from the wall, y⁺(j) = [Δy_w⁺ j + (¾ α c_η j)^(4/3) (j/j_b)²] / [1 + (j/j_b)²], with j_b the index at which the two behaviours blend and α the target outer-layer spacing in Kolmogorov units. For large Re_τ the number of points from the wall to the outer edge is N_y ≈ 4/(3 α c_η) Re_τ^(3/4), i.e. 237 points at Re_τ = 1000 and 1333 at Re_τ = 10 000 with the recommended parameters j_b = 16, Δy_w⁺ = 0.05, α = 1.25, c_η = 0.8 (Pirozzoli & Orlandi 2021).
natural_stretching.py (numpy only) builds the grid for pipe flow (nodes from the axis to the wall), closed channel flow (symmetric grid from wall to wall, N cells per half-channel), open channel flow and boundary layers. The node distribution is rescaled so that the last node falls exactly on the outer boundary; by default N is the smallest number of cells for which y⁺(N) ≥ Re_τ. This is the grid routine of the finite-difference solver PipeFlow (main development branch), which the script reproduces to round-off for pipe and channel. It writes a node table (index, coordinate, wall distance, y⁺, Δy⁺, Δy⁺/η⁺) and, optionally, a figure. Example: python3 natural_stretching.py --flow channel --retau 5200 --out grid.dat --plot grid.png
For compressible flows the same mapping is applied in semi-local units y* = y⁺ (ρ/ρ_w)^(1/2) μ_w/μ, in which η* = (κ y*)^(1/4) holds as in incompressible flow; the outer constant α* is tuned so that the physical spacing never exceeds the target Δy⁺/η⁺ (Ceci & Pirozzoli 2023). The mean density and viscosity profiles are estimated for the given Mach number, Reynolds number and wall temperature with the method of Kumar & Larsson (2022). This is implemented in HYPERGRID (https://github.com/a-ceci/HYPERGRID, GPL-3.0); the archive below is a snapshot of version 2.0.0 with fixes for current SciPy and for Re_θ < 425, plus a command-line driver, natural_stretching_compressible.py. The driver ends the grid exactly at the boundary-layer edge and tunes α* over the whole grid, which HYPERGRID's own grid routine does not always do; the differences are listed in MIRROR_NOTES.txt. Example (flow conditions of case M2 of the paper): python3 natural_stretching_compressible.py --mach 2 --redelta2 2110 --te 169.44 --adiabatic --out grid.dat --plot grid.png
The calculator on this page computes the incompressible grid directly in the browser and lets you download it.

Grid calculator (incompressible)
Natural stretching of Pirozzoli & Orlandi (2021), computed in your browser with the same formula as natural_stretching.py and PipeFlow.
For the compressible version use the Python package below: it needs the estimated mean density and viscosity profiles.
Data files
All files can also be browsed in the directory listing. The README.txt contains this documentation in plain text.
Other files
| File | Description | Size |
|---|---|---|
| natural_stretching.py | Incompressible natural stretching (pipe, symmetric closed channel, open channel, boundary layer); single file, needs numpy (matplotlib for --plot). Run with --help for the options. GPL-3.0. | 9.6 kB |
| HYPERGRID-2.0.0.zip | Compressible natural stretching: snapshot of HYPERGRID 2.0.0 (A. Ceci, V. Kumar, J. Larsson, S. Pirozzoli; upstream https://github.com/a-ceci/HYPERGRID, GPL-3.0) with fixes for SciPy ≥ 1.14 and Re_θ < 425 and the command-line driver natural_stretching_compressible.py; see MIRROR_NOTES.txt inside. Needs numpy and scipy. | 59.2 kB |
Figures

How to cite
If you use these data, please cite:
@article{pirozzoli_21grid,
author = {Pirozzoli, Sergio and Orlandi, Paolo},
title = {Natural grid stretching for {DNS} of wall-bounded flows},
journal = {J. Comput. Phys.},
volume = {439},
pages = {110408},
year = {2021},
doi = {10.1016/j.jcp.2021.110408}
}@article{ceci_23,
author = {Ceci, Alessandro and Pirozzoli, Sergio},
title = {Natural grid stretching for {DNS} of compressible wall-bounded flows},
journal = {J. Comput. Phys.: X},
volume = {17},
pages = {100128},
year = {2023},
doi = {10.1016/j.jcpx.2023.100128}
}License: GPL-3.0. Questions and corrections: sergio.pirozzoli@uniroma1.it.