SpectraSim Documentation
Parameter · 08 Mesh

Number of prism layers

mesh.n_layers Step 08 · Mesh

The number of thin cell layers the mesher grows on the walls to resolve the boundary layer. On auto it follows the wall treatment and sizing, and with curvature sizing it is reduced until the stack fits into the wall cell.

Last updated

Theory

After snapping, the mesher pushes the mesh away from the walls and fills the gap with nn layers of prism cells whose thickness grows by the Expansion ratio rr from the wall outwards. All thicknesses are given relative to the size of the cell just outside the layers (relativeSizes true) (OpenFOAM user guide, 2026), so a wall on a coarser refinement level gets a proportionally thicker stack. Layers are grown on every wall, on both sides of every perforated wall (always: without them the wall layers leave a leak around the plate's rim) and on both sides of every internal wall when "layers on internal walls" is on (default).

The program describes the stack in one of two ways:

  • Curvature sizing with the wall function: by its FIRST layer. The first layer t1t_1 comes from the target y+y^+ (see Target y+) as a fraction of the finest wall cell hw=h0/8h_w = h_0/8, limited to 0.05-0.3; the stack is equation (1). On auto, nn starts at 6 and is reduced (never below 3) until the stack is at most 0.8 wall cells. A typed nn is kept and gets a warning when it does not fit. Layers thinner than 0.02 of the local cell are not added (minThickness).
  • Uniform sizing, or low-Re: by its LAST layer, tnt_n = 0.5 (wall function) or 0.1 (low-Re) of the wall cell; layer ii is tn/rn−it_n / r^{n-i}, equation (2). Here nn is not reduced; layers thinner than 0.1 of the local cell are not added.

Where a layer cannot be grown without breaking the mesh-quality limits, the mesher removes it locally and never puts it back. The layer stage works against relaxed limits from its first iteration (non-orthogonality 70°, no tetrahedral-decomposition test), equal to what quality gate 1 accepts, so layers are not removed for breaking a limit the gate does not enforce.

After meshing, the Mesh step reports the share of wall faces with at least one layer (gate 1), the layers built against those requested, the thickness achieved and the share of each port's rim that has layers (advisory rows).

Equations

δ=t1 rn−1r−1≤0.8 hw(n on auto, n≥3)\delta = t_1\,\frac{r^{n} - 1}{r - 1} \le 0.8\,h_w \quad (n\ \text{on auto},\ n \ge 3)
(1)
wheremeaningunit
δ\deltaThickness of the whole stackm
t1t_1First (wall) layer thickness, 0.05 hw≤t1≤0.3 hw0.05\,h_w \le t_1 \le 0.3\,h_wm
rrExpansion ratio-
nnNumber of layers-
hwh_wFinest wall cell, h0/8h_0/8m
ti=tnr n−i,δhw=∑i=1ntn/hwr n−i,tnhw=0.5 (wall function), 0.1 (low-Re)t_i = \frac{t_n}{r^{\,n-i}}, \qquad \frac{\delta}{h_w} = \sum_{i=1}^{n} \frac{t_n/h_w}{r^{\,n-i}}, \qquad \frac{t_n}{h_w} = 0.5\ \text{(wall function)},\ 0.1\ \text{(low-Re)}
(2)
wheremeaningunit
tit_iThickness of layer ii (1 = at the wall)m
tnt_nThickness of the outermost layerm

Default and rule

Default
auto: 6 (curvature, wall function, reduced to fit), 3 (uniform, wall function), 12 (low-Re)Computed by the programMeasured
Rule

Auto: 6 with curvature sizing and the wall function, then reduced to fit equation (1); 3 with uniform sizing and the wall function (stack 1.26 wall cells with r=1.2r = 1.2); 12 with low-Re (stack 0.62 wall cells with r=1.15r = 1.15, first layer 0.022 of the wall cell). Before an inlet flow is set, the curvature plan uses a fixed first layer of 0.075 wall cells (6 layers, r=1.2r = 1.2: a stack of 0.74).

Source

Six layers is the layer count of a reference mesh of case V1 (a 2.0 m multi-chamber muffler with a perforated pipe and three absorptive packings) made with another mesher.

The y⁺-driven plan was validated on three models (serial meshing), against a plan with a fixed first-layer fraction:

  • V3 (a two-inlet single-chamber muffler like V2, with smaller main ports): from 3.81 of 6 layers built (64 %) to 2.74 of 3 (91 %); rim layer coverage from 96 / 76 / 70 % to 96 / 90 / 100 %.
  • V4 (a 0.3 m expansion chamber with an extended inlet tube): from 4.11 of 6 (68 %) to 2.82 of 3 (94 %).
  • V1 with 6 layers typed: from 3.70 of 6 (62 %) to 4.92 of 6 (82 %); maximum non-orthogonality from 75.50° to 69.97°.

On both smaller models the first layer reached the 0.3 limit and auto fell from 6 to 3 layers, so part of the improvement is that fewer, thicker layers were requested. The 0.8 stack limit and the 0.05-0.3 first-layer range are the program's own choices, not measured optima. 12 layers for low-Re is the low end of the 12-15 layers commonly recommended for a resolved sublayer; no reference is cited for this guidance.

Valid range whole number; auto never below 3

Values

A whole number. Auto never goes below 3; a typed number is used as typed.

Gate 1

Fails when fewer than 80 % of the wall faces keep at least one layer. Advisory rows warn below 80 % of the requested layers built, 70 % of the intended thickness and 90 % of a port rim covered.

Thick stacks

A stack thicker than about one wall cell is often removed in corners and at port rims. If layers are lost, the first thing to try is one layer fewer (the Mesh step proposes it after a failed coverage check).

References 1

  1. OpenCFD Ltd. (2026). OpenFOAM user guide. openfoam.com. Web page