SpectraSim Documentation
Parameter · 08 Mesh

Mesh sizing

mesh.sizing Step 08 · Mesh

The rule that turns the model into cell sizes for the mesher. Curvature (default) takes every size from the model itself and refines each wall where it curves; uniform puts the cell size of the smallest inlet or outlet on every wall.

Last updated

Theory

The mesher starts from a box of cubic background cells of size h0h_0 (blockMesh) and halves cells near the surfaces: a cell at refinement level ℓ\ell has size h0/2ℓh_0/2^{\ell}, equation (1). Each surface is given a level range (ℓmin,ℓmax)(\ell_{min}, \ell_{max}): every cell that the surface cuts is refined to ℓmin\ell_{min}, and a cell that sees surface intersections turning by more than resolveFeatureAngle is refined further, up to ℓmax\ell_{max} (OpenFOAM user guide, 2026). Between levels, nCellsBetweenLevels 3 keeps three cells per level, so the size changes gradually away from the wall.

Curvature sizing. The reference length is the hydraulic diameter of the whole fluid volume, equation (2), with the wetted area counting both sides of every internal and perforated wall. The background cell is a sixth of it, scaled by the fineness, equation (3). Every wall and baffle gets the level range (1,3)(1, 3): cells of h0/2h_0/2 on flat and gently curved walls, down to h0/8h_0/8 where the wall curves. The curvature threshold is 2/N2/N radians, equation (4): a cell of size hh on a wall of radius rr sees the surface turn by about h/rh/r, so the wall is refined until D/h≥ND/h \ge N, i.e. about NN cells across every pipe's own diameter D=2rD = 2r, as far as level 3 allows. Each inlet and outlet gets one level, chosen so that NN cells fit across its own hydraulic diameter, but never coarser than the finest wall level, equation (5).

Uniform sizing. The finest cell is the smallest inlet or outlet hydraulic diameter divided by NN; every surface is refined to that one level, equation (6), and resolveFeatureAngle stays at 30°. An internal wall narrower than that cell allows gets extra levels, so that its own diameter has at least 12N/1612N/16 cells across; the jet cylinders described below scale the same way.

In both modes each inlet gets a refinement cylinder 5 diameters long and 0.75 diameter in radius, running into the fluid, refined until its cells are at most D/(10N/16)D/(10N/16); the background box extends max⁡(3h0,0.02 dbox)\max(3h_0, 0.02\,d_{box}) beyond the model (dboxd_{box} the diagonal of the model's bounding box). The hydraulic diameter of a port is 4A/P4A/P of its exported surface.

Before meshing, the program estimates the final cell count from the wetted area, equation (7), and sets the mesher's cell limit maxGlobalCells from the peak count during castellation, equation (8), which is when the limit actually applies. The estimate is shown on the Mesh step and saved in the run folder.

Equations

hℓ=h02ℓh_\ell = \frac{h_0}{2^{\ell}}
(1)
wheremeaningunit
hℓh_\ellCell size at refinement level ℓ\ellm
h0h_0Background (level-0) cell sizem
ℓ\ellRefinement level-
L=4VSw,Sw=S+SbL = \frac{4V}{S_w}, \qquad S_w = S + S_b
(2)
h0=L6 (2)−(F−3)h_0 = \frac{L}{6}\,\left(\sqrt{2}\right)^{-(F-3)}
(3)
θr=min⁡ ⁣(30∘, max⁡ ⁣(5∘, 2N rad))\theta_r = \min\!\left(30^\circ,\ \max\!\left(5^\circ,\ \frac{2}{N}\ \mathrm{rad}\right)\right)
(4)
ℓport=min⁡ ⁣(4, max⁡ ⁣(3, ⌈log⁡2h0NDh⌉))\ell_{port} = \min\!\left(4,\ \max\!\left(3,\ \left\lceil \log_2 \frac{h_0 N}{D_h} \right\rceil\right)\right)
(5)
wheremeaningunit
LLReference length: hydraulic diameter of the fluid volumem
VVFluid volume enclosed by the exported surfacem³
SSArea of every exported surfacem²
SbS_bArea of the internal and perforated walls (counted a second time: both sides are wetted)m²
SwS_wWetted aream²
FFFineness, 1 to 5-
θr\theta_rresolveFeatureAngle given to the mesher°
NNCells across a diameter-
ℓport\ell_{port}Refinement level of an inlet or outlet face-
DhD_hHydraulic diameter of the port, 4A/P4A/Pm
hw=Dh,minN,h0=hw 2F−1h_w = \frac{D_{h,min}}{N}, \qquad h_0 = h_w\,2^{F-1}
(6)
wheremeaningunit
hwh_wWall cell size (uniform sizing: every surface)m
Dh,minD_{h,min}Smallest hydraulic diameter of all inlets and outletsm
Ncells≈max⁡ ⁣(Nbg, 3.3 Swh2+0.8 n SLh2),h=h04(max⁡(N,4)5.5)−0.4 (curvature),h=hw (uniform)N_{cells} \approx \max\!\left(N_{bg},\ 3.3\,\frac{S_w}{h^2} + 0.8\,n\,\frac{S_L}{h^2}\right), \qquad h = \frac{h_0}{4}\left(\frac{\max(N,4)}{5.5}\right)^{-0.4}\ \text{(curvature)},\quad h = h_w\ \text{(uniform)}
(7)
maxGlobalCells=max⁡ ⁣(CF, 1.5(Nbg+4 Swhf2))\mathrm{maxGlobalCells} = \max\!\left(C_F,\ 1.5\left(N_{bg} + 4\,\frac{S_w}{h_f^2}\right)\right)
(8)
wheremeaningunit
NcellsN_{cells}Estimated final cell count-
NbgN_{bg}Number of background cells in the box-
nnNumber of prism layers-
SLS_LWetted area that receives layersm²
hhEffective wall cell for the estimatem
hfh_fFinest surface cell (h0/8h_0/8 curvature, hwh_w uniform)m
CFC_FFixed floor of the limit: 0.3, 0.7, 1.5, 3 and 6 million cells for fineness 1 to 5-

Default and rule

Default
curvatureMeasured
Rule

Curvature. Case files saved before the sizing setting existed (they carry a fineness or cells-across value but no sizing) open as uniform and mesh exactly as they did; a new case and every save from the Mesh step state the sizing explicitly.

Source

The rule was developed on case V1 (a 2.0 m multi-chamber muffler with a perforated pipe and three absorptive packings; 40 mm smallest outlet):

  • Uniform sizing at 16 cells across meshed every wall with 2.5 mm cells: 4,957,834 cells and 3,658 s of the mesher.
  • Curvature sizing at its defaults, same pipeline: 1,042,226 cells and 686 s, layer coverage 93.0 %, maximum non-orthogonality 73.86° on 17 faces; quality gate 1 passed.

The divisor 6 and the level range (1,3)(1, 3) were taken from a mesher case whose wall sizes matched a reference mesh of the same muffler made with another mesher; they have not been varied. On case V4 (a 0.3 m expansion chamber with an extended inlet tube) a flow solution on both meshes gave a pressure drop of 17.63 Pa (curvature, 278,987 cells) against 17.24 Pa (uniform, 274,916 cells), +2.3 %.

The cell-count constants 3.3, 0.8 and 4 were obtained separately from the logs of eight finished meshes: castellated cells 2.6-3.8, prism cells 0.6-0.97 per layer and peak 0.84-0.98 of the formula, all per Sw/h2S_w/h^2. The level and feature-angle mechanics are the mesher's (OpenFOAM user guide, 2026).

Valid range curvature | uniform

Choice

Curvature or uniform. The meaning of Fineness and Cells across a pipe diameter changes with it.

Estimate

The cell estimate was within 0.85-1.17 of the real count on the eight calibration meshes and 29 % high on the first curvature mesh of V1. Not covered by a measurement: low-Re meshes (12 layers) and models with more than 24 % of their area in baffles.

Untested constants

The divisor 6, the wall level range (1,3)(1, 3) and the port levels of curvature sizing come from one model and were not varied. Check the pressure drop with a mesh independence study before relying on it.

References 1

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