SpectraSim Documentation
Parameter · 08 Mesh

Cells across a pipe diameter

mesh.cells_across_diameter Step 08 · Mesh

How many cells the mesh puts across a flow passage. With curvature sizing: across the diameter of every pipe and port. With uniform sizing: across the smallest inlet or outlet, and that cell size is then used on every wall.

Last updated

Theory

Curvature sizing. NN sets the mesher's curvature threshold resolveFeatureAngle, equation (1). A cell of size hh on a wall of radius rr sees the surface turn by about h/rh/r radians; the mesher keeps refining a wall cell while the surface inside it turns by more than the threshold, up to the wall's finest level h0/8h_0/8 (OpenFOAM user guide, 2026). Refinement therefore stops at h≈2r/N=D/Nh \approx 2r/N = D/N, i.e. about NN cells across each pipe's own diameter DD, equation (2). A small pipe gets small cells and a large shell keeps large ones. Each inlet and outlet face is put on the level that fits NN cells across its own hydraulic diameter Dh=4A/PD_h = 4A/P, never coarser than the finest wall level (see Mesh sizing). The threshold is limited to 5-30°: below N≈4N \approx 4 it stays at 30°, and above N≈23N \approx 23 it stays at 5°, so values above 23 refine the curved walls no further.

Uniform sizing. The finest cell is the smallest port's hydraulic diameter divided by NN, equation (3), and every surface is refined to that cell size. On a large muffler with one small port this puts the small port's cell on every wall.

Both modes. The refinement targets of narrow internal pipes (uniform sizing: at least 12N/1612N/16 cells across their own diameter) and of the jet cylinders at the inlets (cells at most D/(10N/16)D/(10N/16)) scale with NN, so changing NN refines the whole mesh in proportion; both were tuned at N=16N = 16.

In uniform mode a mesh independence study varies NN (11, 16, 22), because that is the setting that changes the wall cell there; a fineness study is refused in that mode. In curvature mode the study varies the fineness instead, which scales every level-driven size by the same ratio (Celik et al., 2008).

Equations

θr=min⁡ ⁣(30∘, max⁡ ⁣(5∘, 2N rad))\theta_r = \min\!\left(30^\circ,\ \max\!\left(5^\circ,\ \frac{2}{N}\ \mathrm{rad}\right)\right)
(1)
hr≤θr ⇒ Dh≥2θr=N,h≥h08\frac{h}{r} \le \theta_r \ \Rightarrow\ \frac{D}{h} \ge \frac{2}{\theta_r} = N, \qquad h \ge \frac{h_0}{8}
(2)
wheremeaningunit
θr\theta_rresolveFeatureAngle (curvature sizing; 30° in uniform sizing)°
NNCells across a diameter-
hhWall cell size reached by curvature refinementm
rrLocal radius of the wallm
DDDiameter of the pipe, 2r2rm
h0h_0Background cell sizem
hw=Dh,minNh_w = \frac{D_{h,min}}{N}
(3)
wheremeaningunit
hwh_wWall cell size in uniform sizingm
Dh,minD_{h,min}Smallest hydraulic diameter, 4A/P4A/P, of all inlets and outletsm

Default and rule

Default
8
Rule

8 (preset "default"), i.e. θr=14.3°\theta_r = 14.3° with curvature sizing. A user-defined value is rounded to a whole number between 4 and 80.

Source

Validation meshes of case V1 (a 2.0 m multi-chamber muffler with a perforated pipe and three absorptive packings; the mesher cases set up with the curvature rule):

  • threshold 30° (N≈4N \approx 4): 577,357 cells in 249 s;
  • threshold 14.3° (N=8N = 8): 1,184,789 cells, layer coverage 96.1 %, maximum non-orthogonality 70.0°;
  • threshold 7.2° (N=16N = 16): did not finish within about 35 min.

The default of 8 is the program's choice based on these meshes; it has not been confirmed by a mesh independence study. With uniform sizing, a 90° pipe elbow gave pressure drops of 398, 473 and 451 Pa at 12, 16 and 24 cells across the diameter: the result is not monotonic, so a single mesh is no proof of a mesh-independent result. The threshold relation h/rh/r is the geometry of a chord on a circle; how the mesher applies the angle is described in its documentation (OpenFOAM user guide, 2026).

Valid range 4 to 80 (whole numbers); presets 4, 8, 12, 16, 24

Values

4 to 80 cells (checked when the setting is saved). Presets: 4 coarse, 8 default, 12 fine, 16 very fine, 24 reference for a mesh independence check.

Cost

Uniform sizing: the wall cells grow as N2N^2. Curvature sizing: only the curved walls are refined further, so the growth is smaller (V1: NN 4 to 8 doubled the cells). With curvature sizing above N=23N = 23 the curved walls are not refined further: the 5° floor of the threshold applies.

Not a convergence proof

Check the pressure drop with a mesh independence study before relying on it.

References 2

  1. Celik, I. B., Ghia, U., Roache, P. J. and Freitas, C. J. (2008). Procedure for estimation and reporting of uncertainty due to discretization in CFD applications. Journal of Fluids Engineering, 130(7), 078001. DOI 10.1115/1.2960953
  2. OpenCFD Ltd. (2026). OpenFOAM user guide. openfoam.com. Web page