DNS databaseCFD group · Sapienza University of Rome
DNS database › Codes

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

Codes2023Sergio Pirozzoli, Paolo Orlandi, Alessandro Ceci

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.

Natural stretching for closed channel flow at Re_τ = 1000 with the recommended parameters (j_b = 16, Δy_w⁺ = 0.05, α = 1
Natural stretching for closed channel flow at Re_τ = 1000 with the recommended parameters (j_b = 16, Δy_w⁺ = 0.05, α = 1.25, c_η = 0.8; N = 238 cells from each wall to the centreline), produced by natural_stretching.py --flow channel --retau 1000 --plot. (a) Wall distance y⁺ versus grid index j from the wall; (b) local spacing Δy⁺ versus y⁺; (c) spacing in Kolmogorov units Δy⁺/η⁺ with η⁺ = c_η y⁺^(1/4), an estimate valid only above the buffer layer; dashed red line: target α = 1.25. Grey lines: y⁺ = 50, edge of the buffer layer.

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

FileDescriptionSize
natural_stretching.pyIncompressible 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.zipCompressible 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:

S. Pirozzoli, P. Orlandi (2021). Natural grid stretching for DNS of wall-bounded flows. J. Comput. Phys. 439, 110408.
doi:10.1016/j.jcp.2021.110408
@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}
}
A. Ceci, S. Pirozzoli (2023). Natural grid stretching for DNS of compressible wall-bounded flows. J. Comput. Phys.: X 17, 100128.
doi:10.1016/j.jcpx.2023.100128
@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.