Home / Insights / Chmltech Online Journal

Chmltech Online JournalVolume 106, Issue 31Research article

How Fine Does the Mesh Need to Be? Accuracy Against Computing Time in Three Process CFD Cases

Quak Foo LeeChief Technology Officer, Chmltech Ltd.Division of Clean Energy Technology Innovation · Vancouver, BC, Canada

Abstract

A finer mesh makes a CFD answer more accurate and more expensive. This paper measures how accuracy grows with computing time in three process cases run with OpenFOAM v1912 on one processor core: a lid-driven cavity with a spectral benchmark, the coolant channel of a half-pipe reactor jacket and a stirred reactor. In the cavity, second-order convection converged at an observed order of 1.8 to 2.0, and packing the same number of cells toward the walls raised it to 2.2 to 2.5; that mesh reached 1% error in 1.9 s of CPU time against 11 s for a uniform mesh. First-order upwind convection was still 9.62% off on 320 × 320 cells. The grid convergence index of Celik et al. covered the true error in 17 of 18 second-order three-mesh studies and missed once, by a factor of 1.01. The jacket and the reactor converged far more slowly, at orders of only about 0.5 to 1. The jacket coefficient rose by 7.1% over five meshes, and much of the rise came from the resolution next to the heated wall, even with y⁺ well below 1. The reactor's finest mesh, 2.5 h of CPU time, left an uncertainty of 8.0% in the power number, or 19% with the larger safety factor advised at such low orders; on projection, 1% would take years. The paper shows how to choose the coarsest mesh that meets a stated uncertainty and gives a calculator and a desktop package for the next level.

Keywords: computational fluid dynamics; mesh independence; grid convergence index; Richardson extrapolation; verification; OpenFOAM; computing cost; process engineering

1. Introduction

The CFD series on this site showed that the same problem gives different answers on different meshes, and that the answer settles as the mesh is refined [1]. The CFD papers in this journal each reported a mesh study: three meshes of a stirred reactor [2] and of three reactor jackets [3], with an observed order of convergence, an extrapolated value and a grid convergence index (GCI) [4]. In the trials of AI agents running CFD, every agent ran a mesh study without being asked [5]. The surrogate models of Issue 25 were trained on solved cases and carry whatever mesh error those cases have [6]. A mesh study says how far the answer on the finest mesh may be from the value an infinitely fine mesh would give. It does not say what the next step of accuracy will cost, and for a small company that is often the deciding question [7].

This paper asks how accuracy grows with computing time, and how an engineer should decide that a mesh is fine enough. Three cases were chosen to span the problems a process engineer meets. The first is a lid-driven cavity at a Reynolds number of 1,000, a laminar flow with a spectral benchmark accurate to seven digits [8]. Here the true error of every mesh is known, so the GCI can be checked. The second is the coolant channel of the half-pipe jacket solved in Issue 26 [3], a turbulent heat transfer case with no exact answer. The third is the stirred reactor of Issue 24 [2], a full three-dimensional case whose finest mesh already took hours. All runs used OpenFOAM v1912 [9] on one core, and every CPU time quoted is the solver's own.

2. Mesh Studies in Brief

A mesh study solves the same case on meshes of different fineness and watches a quantity \(\varphi\) that the design needs. Each mesh has a representative cell size \(h\), found from its number of cells \(N\) and the number of dimensions \(D\) the mesh is refined in, Eq. (1); a one-cell-thick slice counts as two-dimensional:

\[h = \left( \frac{1}{N} \right)^{1/D}, \qquad r_{21} = \frac{h_2}{h_1}, \qquad r_{32} = \frac{h_3}{h_2}\](1)

where mesh 1 is the finest and mesh 3 the coarsest. If the error falls as \(h^p\), the observed order \(p\) follows from the two changes \(\varepsilon_{21} = \varphi_2 - \varphi_1\) and \(\varepsilon_{32} = \varphi_3 - \varphi_2\), Eq. (2), with \(s\) the sign of \(\varepsilon_{32}/\varepsilon_{21}\); for equal ratios \(q\) is zero, otherwise Eq. (2) is solved by iteration [4]:

\[p = \frac{1}{\ln r_{21}} \left| \ln \left| \frac{\varepsilon_{32}}{\varepsilon_{21}} \right| + q(p) \right|, \qquad q(p) = \ln \frac{r_{21}^{\,p} - s}{r_{32}^{\,p} - s}\](2)

Richardson's extrapolation then estimates the value on an infinitely fine mesh [10], Eq. (3):

\[\varphi_{\mathrm{ext}} = \frac{r_{21}^{\,p}\, \varphi_1 - \varphi_2}{r_{21}^{\,p} - 1}\](3)

and the GCI of the fine mesh [4], Eq. (4), is an uncertainty band around \(\varphi_1\) meant to contain the exact answer:

\[\mathrm{GCI}_{\mathrm{fine}} = \frac{1.25\, \left| (\varphi_1 - \varphi_2)/\varphi_1 \right|}{r_{21}^{\,p} - 1}\](4)

The factor 1.25 is the safety factor that Celik et al. adopt for studies of three or more meshes [4], following Roache [11]. Roache first proposed a factor of 3 [12], and that larger value is still advised when the observed order is far below the formal order of the scheme, where the asymptotic behaviour the formula assumes is in doubt. The procedure needs the changes to shrink steadily. If they grow, or change sign, no order can be found and the study needs another mesh. Figure 1 sets out the steps as a decision. The GCI measures only the error of the mesh. It says nothing about the turbulence model, the boundary conditions or the geometry, which the earlier papers in this journal checked separately [3, 13].

A row of four boxes joined by arrows: three meshes; the same quantity from converged runs; the observed order p; the extrapolated value and the GCI, with a safety factor of 1.25, or 3 at low orders. An arrow leads down to a green box: compare the GCI with what the design needs, then use the fine mesh or refine once more, changing the mesh where it matters first. An orange box on the left notes the cost of each step finer: about 10 to 15 times per halving of the cell size in the 2D cavity, and 5 times for 2.5 times the cells in the 3D reactor, with a dashed arrow from the green box to it. 1. Three meshes Coarse, medium, fine; each about 1.3 to 2 times finer in every direction 2. Same quantity The number the design needs (h, Np, Δp), from converged runs 3. Observed order p From the two changes; monotonic and shrinking, or the study is not done 4. Extrapolate, GCI Richardson value and the GCI = Fs × change / (rᵖ − 1); Fs 1.25, or 3 at low p 5. Compare the GCI with what the design needs Smaller than the correlation or design margin: use the fine mesh. Larger: refine once more, or change the mesh where it matters (wall cells, scheme) before adding cells everywhere. Cost of each step finer 2D cavity: about 10 to 15 times the CPU time per halving of the cell size at these sizes; 3D reactor: 5 times for 2.5 times the cells. The last mesh costs more than the first two together.
Figure 1. A mesh study as a decision: three meshes, the same quantity, the observed order, the extrapolated value and the GCI, then a comparison with what the design needs. Each step finer costs several times more than the last.

3. The Three Cases

Table 1 lists the cases. Each was refined by a constant ratio in every direction, so that the procedure above applies.

Table 1. The three cases, the quantity watched in each and the meshes solved. All runs are steady, on one core.
CasePhysics and solverQuantityReferenceMeshesRatio per level
Lid-driven cavity, Re 1,000Laminar, simpleFoam; three mesh familiesMinimum horizontal velocity on the vertical centreline, \(u_{\min}\)−0.3885698 at \(y = 0.1717\), spectral [8]20² to 320², five per family2
Half-pipe jacket channelTurbulent, simpleFoam with wall-resolved k–ω SST [14]; periodic slice; temperature solved after the flow by a separate periodic eigen-solve in Python [3]Heat transfer coefficient on the vessel wall, h; pressure drop per metreNone exact; Gnielinski 5,986 W/m²K for a straight duct [15]8,008, 16,000, 31,944, 64,000, 128,776 cells√2 in-plane and first cell
Stirred reactor, pitched-blade turbineTurbulent, steady MRF with k–ε; one 90° sector [2]Power number NpNone exact; textbook 1.27 to 1.29 [2]72,891, 198,197 and 503,510 cellsAbout 1.4

3.1 Lid-driven cavity

The cavity is the case of the Part 3 post [1]: a unit square with the top wall sliding at unit speed, at a Reynolds number of 1,000, solved to steady state with initial residuals below 10⁻⁸ for pressure and 10⁻⁹ for velocity. Three families of meshes were run, each from 20 × 20 to 320 × 320 cells, doubling each time. The first family is uniform, with bounded second-order linear-upwind convection, as in the Part 3 post. The second uses the same scheme and the same number of cells, but packs them toward the walls, each half of each side growing fourfold toward the middle. The third is uniform with first-order upwind convection, still a common default for robustness. The error of each mesh is measured against the spectral value of Botella and Peyret [8]. The 20² to 160² uniform runs reproduce the Part 3 values to all printed digits; the same benchmark tested the browser solver of Issue 27 [16].

3.2 Half-pipe jacket channel

The jacket case is the Issue 26 model unchanged: a 20 mm periodic slice of the 3 in. half-pipe coil, with water at 1.44 m/s and the flow held by a body force [3]. The temperature is solved afterwards as a periodic fully developed field by Issue 26's own eigen-solver, a Python and SciPy program, not OpenFOAM. Issue 26 used three meshes, each √2 finer than the last in every direction of the cross-section and in the height of the first cell at the wall. Here the ladder runs one level coarser and one level finer, five meshes in all. The coarse, medium and fine meshes of Issue 26 gave the same coefficients as before. Two further ladders keep the cross-section of the medium level and thin only the cells at the walls, from a first cell of 6.0 to 1.5 µm. In the first, the cell counts stay fixed, so the cells also grow faster away from the wall as the first cell shrinks. In the second, the growth rate stays fixed at the medium mesh's, and cells are added near the walls instead (29,440 to 40,672 cells). The run stopped when the Nusselt number and friction factor changed by less than 0.1% over 1,000 iterations and the wall shear balanced the driving force within 2%.

3.3 Stirred reactor

The reactor case is the pitched-blade turbine of Issue 24, solved as one 90° sector of the 10 m³ tank with a moving reference frame for the impeller [2]. Its three meshes were not run again: they took 7.6 min, 29 min and 2.5 h of CPU time in Issue 24, and the same machine was used here. Their results are reanalysed with the same procedure as the other two cases.

3.4 How time was measured

Every flow-solver time quoted is the solver's own CPU time, the ExecutionTime that OpenFOAM writes to its log, on one core of a 2.3 GHz cloud processor; the jacket's temperature-solve times are Python process times of the same core. Wall-clock time is not used: the machine has two cores, and other work ran on the second core during these runs. Shared memory and cache still slow a run a little. The 80² and 160² uniform cavity runs took 6.8 s and 73 s here against 6.3 s and 87 s in the Part 3 post, so single times carry about 16% of noise. The ratios between meshes, which are what this paper uses, are steadier. CPU time also depends on the stopping rule. The jacket's rule asks for at least 1,000 further iterations after the result has settled, a fixed confirmation window that adds relatively more to the coarse meshes and so flattens the jacket's cost growth; on the finest mesh the coefficient had settled within 0.01% after 13 min of the 21 min reported (Table 3). The cavity's strict residual rule does the opposite: it costs relatively more on the fine meshes and steepens the cavity's cost growth.

4. Results

4.1 Lid-driven cavity

Table 2 and Figure 2 give the cavity results. On the uniform second-order meshes the error fell from 17.9% on 20² to 0.09% on 320², at an observed order of 1.8 to 2.0, close to the scheme's nominal two. Packing the cells toward the walls, where the velocity changes fastest, cut the error at every size and raised the order to 2.2 to 2.5: the 160² wall-packed mesh, 0.11% off in 61 s, nearly matched the 320² uniform mesh (0.09%, 18 min) at an eighteenth of its CPU time. The first-order upwind meshes converged at an order of only 0.45 to 0.81, still rising. Even on 320² they were 9.62% off, worse than the 40² second-order mesh. Upwind convection smears the flow like extra viscosity, and here that error swamps the benefit of more cells.

Table 2. Lid-driven cavity at Re 1,000: error in the minimum centreline velocity against the spectral benchmark, and solver CPU time, for each mesh family.
Cells per sideCellsUniform, second-orderPacked toward the wallsUniform, first-order
2040017.9%, 0.2 s16.9%, 0.2 s60.4%, 0.1 s
401,6004.46%, 0.8 s3.03%, 0.8 s44.2%, 0.2 s
806,4001.27%, 6.8 s0.53%, 3.1 s28.0%, 3.2 s
16025,6000.34%, 73 s0.11%, 61 s16.9%, 53 s
320102,4000.09%, 18 min0.02%, 17 min9.62%, 14 min
Two log–log charts. In (a) the uniform second-order line falls at close to the second-order slope, the wall-packed line lies below it and falls faster, and the first-order line falls slowly from 60% to about 10%. In (b) the same three lines against time: the wall-packed mesh crosses 1% in about two seconds, the uniform mesh in about ten, and the first-order line stays above 5% up to about a quarter of an hour, its last point. 1,000 10,000 100,000 Cells 0.01 0.1 1 10 100 Error in the minimum centreline velocity (%) order 1 order 2 (a) Error against mesh size Uniform, second-order (linearUpwind) Packed toward the walls, second-order Uniform, first-order (upwind) 0.1 s 1 s 10 s 1 min 10 min 1 h Solver CPU time, one core 0.01 0.1 1 10 100 Error in the minimum centreline velocity (%) (b) Error against computing time
Figure 2. Lid-driven cavity at Re 1,000: (a) error in the minimum centreline velocity against the number of cells, with lines of first and second order for reference; (b) the same error against solver CPU time on one core. The dashed line marks 1%.

CPU time grew faster than the number of cells: as cells to the power 1.8 for the uniform meshes and 2.1 for the wall-packed ones, fitted over the 80², 160² and 320² meshes. Each halving of the cell size multiplies the cells by four, and the solver needs more iterations to converge a finer mesh. Halving the cell size therefore cost about 13 times the CPU time on the uniform meshes. Predicting the 320² value from the three meshes before it, with Richardson's formula, gave it within 0.017% on the uniform meshes and 0.012% on the wall-packed ones. The wall-packed meshes reached 1% error in 1.9 s of CPU time and the uniform meshes in 11 s, 6 times longer. The first-order meshes needed about 11 min to reach 10%. For 1%, the projection of Section 5 gives about 604 days; it depends strongly on the order, which was still rising: at its formal order of 1 the same projection gives 74 days, and the full spread of reasonable choices runs from 74 days to 6 years. Read it as months to years, not as a date.

4.2 Does the GCI tell the truth?

The cavity is the one case here where the GCI can be tested, because the true error is known. Each family gives three three-mesh studies of three quantities: the minimum horizontal velocity and the maximum and minimum vertical velocities on the centrelines. Figure 3 plots the true error of the finest mesh in each study against its GCI. For the second-order meshes, where the observed order was close to the formal order of 2, the band contained the exact value in 17 of 18 studies. The one miss was small: uniform 20–80, u min: error 1.27% against a GCI of 1.26%. The band was not generous: in five of the nine wall-packed studies the true error was 90 to 99% of the GCI, so at a safety factor of 1.25 it was only just wide enough. On the three finest uniform meshes (80, 160 and 320 cells per side) the GCI was 0.12% against a true error of 0.089%, and the extrapolated value, −0.38860, was within 0.007% of the benchmark. For the wall-packed family the GCI was 0.026% against 0.024%. All 9 first-order studies were covered, but that says little: in three of them the observed order was close to zero and the GCI above 634%. On the finest first-order meshes the GCI was 19% on a mesh that was 9.6% off, with an observed order of 0.62, so it correctly warned that the answer was not yet worth using. The test supports the GCI where the observed order is near the formal order. It does not test it at the low orders of the jacket and the reactor.

A log–log scatter with a diagonal line. Nearly all points lie below the line in a shaded band; one point sits just above it. The first-order points lie far to the right, with GCIs of tens to thousands of per cent. 0.1 1 10 100 1,000 GCI of the finest mesh in the triplet (%) 0.1 1 10 100 True error of that mesh (%) Error smaller than the GCI: the band covers it Error larger than the GCI Uniform, second-order (linearUpwind) Packed toward the walls, second-order Uniform, first-order (upwind) u min v max v min
Figure 3. True error of the finest mesh in each three-mesh study of the cavity against its GCI, for three quantities and three mesh families. Points below the line are covered by the GCI.

4.3 Half-pipe jacket channel

Table 3 and Figure 4 give the jacket results. Both the coefficient and the pressure drop rose with every refinement, and the steps shrank slowly. The coefficient rose by 7.1% from the coarsest to the finest mesh, and the observed order was 0.46, 0.75, 0.66 for successive triplets, well below the nominal two of the schemes. On the three finest meshes (levels 1, 2, 3) the extrapolated coefficient was 6,128 W/m²K with a GCI of 5.5%, and the extrapolated pressure drop 370.2 Pa/m with a GCI of 1.5%. For h, at an order this far below 2, Roache's larger safety factor of 3 is the safer choice; it gives a GCI of 13% [12]. The pressure drop converged at an order of 1.15; with the same factor its GCI would be 3.5%. The extrapolated coefficient sits +2.4% from the Gnielinski correlation for a straight duct on the hydraulic diameter [15], which is itself uncertain by about ±10% and does not see the cold corners of the half-pipe. The finest mesh, 128,776 cells and 21 min of CPU time, was still −4.2% from the extrapolated value. The slow convergence was at least regular: from levels 0 to 2 alone, Richardson's formula predicted 5,866 W/m²K for the next level, and the level-3 run gave 5,868 W/m²K. That tests the next step only; the extrapolated limit itself moved from 6,349 to 6,084 to 6,128 W/m²K over successive triplets. The temperature solve, run once on a converged flow, took 0.5 s to 25 s; the stopping rule repeats it after every 250 iterations, which added about 16% to the finest run.

Table 3. Half-pipe jacket channel: the refinement ladder. Every level refines the in-plane cells and the first-cell height by √2. Flow CPU is simpleFoam's to the stopping rule, with the CPU at which h had settled within 0.01% in brackets; the temperature solve (Python), run once on the converged flow, is listed separately.
LevelCellsFirst cell (µm)Max. y⁺h (W/m²K)Δp (Pa/m)Flow CPU (settled)Temperature CPU
−18,0088.50.435,481353.229 s (6.4 s)0.5 s
0 (Issue 26 coarse)16,0006.00.315,608356.363 s (24 s)1.3 s
1 (Issue 26 medium)31,9444.20.225,717360.62.5 min (34 s)3.6 s
2 (Issue 26 fine)64,0003.00.165,801363.86.5 min (3.4 min)10 s
3128,7762.10.115,868365.921 min (13 min)25 s
Two charts. In (a) the coefficient rises steadily with every refinement, the steps getting smaller only slowly, toward an extrapolated value above all the meshes; the Gnielinski line lies near it. In (b) both ladders rise together as the first cell is halved again and again, although y⁺ is already well below one on every run. 10,000 100,000 Cells 5,600 5,800 6,000 6,200 6,400 Heat transfer coefficient, vessel wall (W/m²K) Extrapolated 6,128 Gnielinski, straight duct 28.9 s 1.0 min 2.5 min 6.5 min 20.9 min (a) Refining everything 6.0 4.2 3.0 2.1 1.5 Height of the first cell at the wall (µm) 5,650 5,700 5,750 5,800 5,850 Heat transfer coefficient (W/m²K) y⁺ 0.31 y⁺ 0.22 y⁺ 0.16 y⁺ 0.11 y⁺ 0.08 Level 3: 128,776 cells (b) Medium cross-section, near-wall cells only Cell counts fixed (growth rate rises) Growth rate fixed (cells added at the walls)
Figure 4. Half-pipe jacket channel: (a) heat transfer coefficient on the vessel wall against the number of cells, with the CPU time of each run, the extrapolated value with its GCI band and the Gnielinski value for a straight duct; (b) the coefficient on the medium cross-section as the cells at the walls are made thinner, with the cell counts fixed (the growth rate rises) or the growth rate fixed (cells added), with the largest y⁺ of each run.

The two wall ladders explain much of the slow convergence (Figure 4b). With the cell counts fixed, thinning the first cell from 6.0 to 1.5 µm, two halvings, raised the coefficient from 5,639 to 5,874 W/m²K, 4.2%, in steps of +1.4%, +1.1%, +1.0%, +0.7%, and the largest y⁺ fell from 0.31 to 0.08. That ladder also raised the growth rate of the cells away from the wall, from 1.114 to 1.147. The fixed-growth ladder separates the two: holding the growth rate at 1.122 and adding cells instead, the same first cells gave 5,635 to 5,882 W/m²K, 4.4%, almost the same rise. In both ladders the number of cells within 50 µm of the wall, where y⁺ is below about 5 and much of the thermal resistance of water (Prandtl number about 5) sits, roughly doubled: from 6 to 12 with the counts fixed and from 6 to 14 with the growth fixed. So the drift follows the resolution next to the wall, the first cell and the cells just above it, not the growth rate; these runs cannot separate the first cell from its neighbours. With the first cell held at 6.0 µm, refining the cross-section from level 0 to level 1 raised h by only +0.5%; on that cross-section, thinning the first cell to the level-1 height raised it by +1.4%. Most of the +1.9% step between the two levels came from the cells at the wall. The thinnest first cell on the medium cross-section gave 5,874 W/m²K in 2.0 min of CPU time, more than the level-3 mesh of 128,776 cells gave (5,868 W/m²K) in 21 min, 10 times longer. By the usual rule, a first cell at y⁺ below 1 is fine enough for a wall-resolved model, and every one of these runs met it. The heat transfer coefficient did not agree. These runs do not show which part of the model causes the drift; the agents in Issue 28 met the same drift and chose different ways round it [5]. For heat transfer with this model, refine the cells at the heated wall on their own and watch the coefficient, rather than stopping at y⁺ = 1.

4.4 Stirred reactor

Table 4 gives the reactor's three meshes from Issue 24. The power number rose from 1.137 to 1.177 to 1.205 at an observed order of 0.98, giving an extrapolated value of 1.28 and a GCI of 8.0% on the fine mesh, or 19% with the safety factor of 3, which suits an order this far below the scheme's formal order. The fine mesh had 2.5 times the cells of the medium one and took 5.2 times the CPU time: it needed 4,750 iterations to settle against 2,750. The pumping number changed by 0.7% and then 1.3% between meshes: the changes grew instead of shrinking, so no order could be found. The ratio of the dissipation integrated over the tank to the shaft power rose from 60% to 76% at an order of only 0.11, far from settled, as Issue 24 reported [2]. One more level on the same ladder, about 1.38 times finer in each direction, would have about 1.3 million cells. On the cost growth between the two finest meshes it would take about 12.8 h of CPU time, and if the order held it would give Np of about 1.225.

Table 4. Stirred reactor, pitched-blade turbine (Issue 24): the three meshes, with the GCI analysis repeated here.
MeshCells (sector)IterationsCPU timeNpNqDissipation / shaft power
Coarse72,8912,5007.6 min1.1370.82860%
Medium198,1972,75029 min1.1770.83468%
Fine503,5104,7502.5 h1.2050.84476%
Extrapolated (GCI)1.282 (8.0%)not definednot settled

4.5 All three cases on one time axis

Figure 5 puts the three cases on one chart of error against CPU time. For the cavity the error is the true error; for the jacket and the reactor it is the change from the extrapolated value, which is only an estimate. The online version is live: pick a case to step through its meshes, drawn with the flow, beside its point on the chart.

A log–log chart. The two second-order cavity lines fall steeply, crossing 1% within seconds. The first-order cavity line falls slowly and stays above 10%. The jacket line starts near 10% at under a minute and falls slowly to a few per cent at tens of minutes. The reactor line starts near 10% at minutes and reaches about 6% at two and a half hours. 0.1 s 1 s 10 s 1 min 10 min 1 h 10 h Solver CPU time, one core 0.01 0.1 1 10 100 Error (%): cavity against the benchmark; jacket and reactor against the extrapolated value Cavity, uniform Cavity, wall-packed Cavity, first-order Jacket h Reactor Np
Figure 5. Error against solver CPU time for all three cases: the cavity's three mesh families against the benchmark, and the jacket coefficient and the reactor power number against their extrapolated values. The dashed lines mark 10% and 1%. In the online version the figure is live: pick a case, or compare all, to step through the meshes from coarse to fine.

5. What Each Per Cent Costs

Table 5 and Figure 6 give the CPU time each case needed to reach an error of 10%, 5% and 1% against the best estimate of the exact value: the benchmark for the cavity, the extrapolated value for the jacket and the reactor. Inside the meshes run, the time is interpolated between runs. Beyond the finest mesh it is projected by one method throughout, also used in Table 6 and the appendix script: the observed order of the finest meshes and the growth of CPU time between the two finest meshes. Because such a projection reaches far beyond the meshes run, the table also gives the spread from the other reasonable choices: the cost growth fitted over the three finest meshes, the order of the next-coarser meshes and, for first-order upwind, its formal order of 1. Read the projections as orders of magnitude.

Table 5. Solver CPU time on one core to reach a stated error against the benchmark (cavity) or the extrapolated value (jacket, reactor). Projected values assume the observed order and the cost growth of the two finest meshes hold; the range in brackets is the spread of other reasonable choices.
Case10%5%1%
Cavity, packed toward the walls0.3 s0.5 s1.9 s
Cavity, uniform0.4 s0.8 s11 s
Cavity, first-order upwind11 minAbout 5.6 h, projected (3.0 h to 8.1 h)About 604 days, projected (74 days to 6 years)
Jacket h (periodic slice)35 s9.1 minAbout 23 days, projected (5 days to 23 days)
Reactor Np (3D sector)12 minAbout 6.5 h, projected (5.8 h to 6.5 h)About 4 years, projected (447 days to 4 years)
A horizontal bar chart on a log time axis. The two second-order cavity families reach 1% in seconds. The first-order cavity needs minutes for 10% and hours for 5%, and its projected 1% lies between months and years. The jacket reaches 5% in minutes; its projected 1% takes days to weeks. The reactor reaches 10% in minutes, a projected 5% in several hours and a projected 1% in years. 0.1 s 1 s 10 s 1 min 10 min 1 h 10 h 4 days 1 year 10 years Solver CPU time of the mesh that reaches it, one core Cavity, packed toward the walls Cavity, uniform Cavity, first-order upwind Jacket h (periodic slice) Reactor Np (3D sector) 0.3 s 0.4 s 11.4 min 35.1 s 12.5 min 0.5 s 0.8 s projected, 3.0 h to 8.1 h 9.1 min projected, 5.8 h to 6.5 h 1.9 s 10.6 s projected, 74 days to 6 years projected, 5 days to 23 days projected, 447 days to 4 years 10% 5% 1% Projected beyond the meshes run (bar: method of the paper; line: spread)
Figure 6. CPU time on one core of the mesh that reaches 10%, 5% and 1% in each case. Hatched bars are projected beyond the finest mesh run, with lines showing the spread of other reasonable choices.

Four lessons follow. First, a better mesh beats a bigger one. Putting cells where the flow changes fastest cut the cavity's cost to 1% by a factor of 6, and a second-order scheme instead of first-order made 1% reachable at all. Second, the order of convergence decides the price of accuracy. Halving the error costs a factor of \(2^{D\alpha/p}\) in CPU time, where \(\alpha\) is the growth of cost with cells. In 2D with \(p = 2\) and the uniform cavity's growth, that is a factor of about 3.8; in 3D with \(p = 1\) and the reactor's growth it is about 39. Third, in turbulent and three-dimensional cases 1% is usually out of reach and not needed. The jacket and the reactor converged at orders near 1, so their uncertainty falls slowly, and the correlations a process design is checked against carry ±10 to ±20% [3, 13]. A GCI of 5% is then a reasonable target, provided it is computed with the safety factor of 3 that such low orders call for, since the cavity test did not cover them. Fourth, the mesh study itself is cheap compared with its finest mesh. Because each level costs several times the last, the two coarser meshes add only about 7% to the finest mesh's time in the cavity, 25% in the reactor and 43% in the jacket, whose cost grew more slowly with cells.

6. The Finest Mesh on Your Own PC

The workspace that produced these results has two shared cores and runs of a few hours at most. A desktop PC can go one level further on each case, and the download sets that up. Table 6 lists the runs, with the CPU time estimated by the projection method of Section 5, the memory from the peaks measured here, and the value that extrapolation predicts. The predictions use the same formula that, from the three meshes before each finest mesh here, predicted the finest within 0.043% in the jacket and 0.017% in the second-order cavity. A desktop core is often faster than this workspace's, so the times are likely to be upper estimates. Memory was measured on the meshes run here and scaled up: the flow solver needed 0.16 GB for the 320² cavity and 0.27 GB for the level-3 jacket, but the jacket's Python temperature solve needed 2.0 GB on level 3, growing slightly faster than the cells. That solve, not the flow solver, sets the jacket's memory. The reactor's figure covers the flow solver only; snappyHexMesh, which builds its mesh, usually needs more, so allow at least twice as much. The jacket's level-4 mesh has 256,000 cells; the reactor's cell count is an estimate, since its background mesh of 917,280 cells is refined further at the impeller when it is built. At the time of publication these runs had not been made. When they are, the results will be added to this paper as an update, and the predictions in Table 6 will be tested against them.

Table 6. The next level of each case, packaged to run on a desktop PC (Linux, or Windows with WSL, and OpenFOAM v1912). CPU time is estimated for one core of this workspace. Memory is the peak estimated from measurements here: the flow solver, or for the jacket the larger Python temperature solve; for the reactor, snappyHexMesh needs more.
RunCellsEstimated CPU timeEstimated memory (GB)Predicted value
Cavity, packed toward the walls, 640 × 640409,6004.6 h0.5u min −0.38854, 0.007% from the benchmark
Cavity, uniform, 640 × 640409,6004.4 h0.5u min −0.38850, 0.019% from the benchmark
Half-pipe jacket, level 4256,0001.1 h4.3 (temperature solve)h about 5,922 W/m²K
Stirred reactor, extra-fine1.32 million12.8 h2.3 (solver only)Np about 1.225

7. Limits of the Study

Three cases cannot cover every flow a process engineer meets; flows with separation, free surfaces or reactions converge in their own ways. The CPU times come from one shared cloud core, with another job on the second core, and carry the noise noted above; parallel runs on several cores scale differently and were not tested. Desktop memory was scaled from runs here, not measured on the desktop meshes. Only the cavity has an exact answer, so the GCI was tested only where the observed order was near the formal order; the jacket and the reactor converge at much lower orders, where the safety factor is a choice, not a tested value. For the jacket and the reactor the error is measured against the extrapolated value, which carries its own uncertainty and moved between triplets, and the projections beyond the finest mesh assume that the observed order and cost growth hold, which they may not: they are orders of magnitude. The wall ladders show that the jacket coefficient follows the resolution next to the wall, but not which part of the model causes it. The reactor meshes were not rerun; their times come from Issue 24 on the same machine. The stopping rules of each case affect its cost. Finally, a mesh study measures only the error of the mesh, not that of the model or the geometry.

8. Conclusions

  • On a laminar case with a known answer, the grid convergence index covered the true error in 17 of 18 second-order three-mesh studies and missed once, by a factor of 1.01, though often only just. It can be trusted as a guide where the changes shrink steadily at close to the scheme's formal order; at lower orders use a safety factor of 3.
  • The order of convergence sets the cost of accuracy. Second-order convection on a mesh packed toward the walls reached 1% in the cavity in 1.9 s of CPU time, a uniform mesh in 11 s; first-order convection was still 9.62% off after 14 min, and on projection would need months to years for 1%.
  • In the half-pipe jacket the coefficient rose by 7.1% over five meshes, and much of the rise came from the resolution next to the heated wall, even with y⁺ well below 1. For heat transfer, refine the wall cells on their own and watch the coefficient.
  • In the three-dimensional reactor, 2.5 h of CPU time left an uncertainty of 8.0% in the power number (19% with a safety factor of 3); one more level would take about 12.8 h, and 1% would take years on projection.
  • Set the uncertainty the design needs first, about 5% where the answer will be compared with a correlation, and choose the coarsest mesh that meets it. Improve where the cells are and the scheme before adding cells everywhere.

9. Appendix: A Mesh Study Calculator

The script below takes three or more meshes of one case, each with its cell count, the quantity of interest and the CPU time. It applies the procedure of Celik et al. [4] to the three finest and reports the observed order, the extrapolated value and the GCI. It then estimates the cells, CPU time and expected GCI of one more level, and the cost of bringing the error against the extrapolated value down to a target, by the projection method of Section 5. For the jacket's three finest meshes and a 1% target it reports an order of 0.66, a GCI of 5.5% and a projected 23 days, as in Table 5. The download also holds the cavity and jacket case writers, the reanalysis of the reactor study, every case's set-up, results and gzipped solver logs, the script that rebuilds every table in this paper and the desktop package.

Mesh study calculator: observed order, extrapolated value, GCI, and the cost of going finer (Python 3, standard library only).
"""Mesh study calculator: observed order, extrapolated value, GCI, and the cost of going finer
(Chmltech Online Journal, Vol. 106, Issue 31, appendix). Python 3, standard library only.

Give three or more meshes of the same case, coarse to fine, each with its cell count, the quantity you need and the
solver CPU time. The script applies the grid convergence index procedure of Celik et al. (2008) to the three finest
meshes, then uses the observed order and the cost growth between the two finest meshes to estimate what one more
level would cost, and what it would cost to bring the error against the extrapolated value down to a target. This is
the projection method of the paper (Tables 5 and 6). The GCI is about 1.25 times that error when the order holds.
A projection far beyond the meshes run is an order-of-magnitude guide only: it assumes the order and cost growth hold.

Usage:
    python3 meshcost_appendix.py --dim 2 --target 1 \\
        16000,5608.4,63  31944,5716.8,148  64000,5800.8,387
Each mesh is cells,value,cpu_seconds. --dim is 2 for a 2D or one-cell-thick slice case, 3 for a full 3D mesh.
--target is the error you need against the extrapolated value, in per cent (default 5).
"""
import argparse, math


def gci3(phi1, phi2, phi3, r21, r32, fs=1.25):
    e21, e32 = phi2 - phi1, phi3 - phi2
    if e21 == 0 or e32 == 0: return None
    s = 1.0 if e32 / e21 > 0 else -1.0
    p = abs(math.log(abs(e32 / e21))) / math.log(r21)
    for _ in range(200):
        try: q = math.log((r21 ** p - s) / (r32 ** p - s))
        except ValueError: break
        pn = abs(math.log(abs(e32 / e21)) + q) / math.log(r21)
        if abs(pn - p) < 1e-10: p = pn; break
        p = pn
    out = dict(p=p, monotone=s > 0, converging=abs(e21) < abs(e32), change=abs(e21 / phi1))
    if out["monotone"] and out["converging"]:
        out["ext"] = (r21 ** p * phi1 - phi2) / (r21 ** p - 1)
        out["gci"] = fs * out["change"] / (r21 ** p - 1)
    return out


def main():
    ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
    ap.add_argument("meshes", nargs="+", help="cells,value,cpu_seconds, coarse to fine")
    ap.add_argument("--dim", type=int, default=3)
    ap.add_argument("--target", type=float, default=5.0, help="target error against the extrapolated value, per cent")
    a = ap.parse_args()
    m = []
    for s in a.meshes:
        parts = s.split(",")
        if len(parts) != 3:
            raise SystemExit(f"each mesh needs three values, cells,value,cpu_seconds (got '{s}')")
        try: m.append(tuple(float(x) for x in parts))
        except ValueError: raise SystemExit(f"could not read '{s}' as three numbers: cells,value,cpu_seconds")
    if len(m) < 3: raise SystemExit("give at least three meshes")
    (n3, f3, t3), (n2, f2, t2), (n1, f1, t1) = m[-3:]
    r21, r32 = (n1 / n2) ** (1 / a.dim), (n2 / n3) ** (1 / a.dim)
    g = gci3(f1, f2, f3, r21, r32)
    print(f"Refinement ratios r21 = {r21:.3f}, r32 = {r32:.3f}")
    if g is None:
        print("Two meshes gave the same value: no order can be found. Check convergence of each run."); return
    print(f"Observed order p = {g['p']:.2f}; change fine to medium = {g['change'] * 100:.2f}%")
    if "gci" not in g:
        print("The changes do not shrink steadily (" + ("oscillating" if not g["monotone"] else "growing") + "): no GCI is defined.")
        print("Run a finer mesh, or check that every run converged and that the meshes are refined the same way."); return
    print(f"Extrapolated value = {g['ext']:.6g}; GCI of the fine mesh = {g['gci'] * 100:.2f}%  (fine value {f1:.6g})")
    alpha = math.log(t1 / t2) / math.log(n1 / n2) if t2 > 0 and n1 != n2 else 1.0
    n_next, t_next = n1 * r21 ** a.dim, t1 * (r21 ** a.dim) ** alpha
    gci_next = g["gci"] / r21 ** g["p"]
    print(f"CPU time grows as cells^{alpha:.2f}. One more level (r = {r21:.2f}): about {n_next:,.0f} cells, "
          f"{t_next / 3600:.2f} h of CPU, expected GCI about {gci_next * 100:.2f}%")
    err = abs(f1 - g["ext"]) / abs(g["ext"])
    print(f"Fine mesh is {err * 100:.2f}% from the extrapolated value.")
    if err * 100 <= a.target:
        print(f"The fine mesh already meets the {a.target:g}% target.")
    else:
        n_t = n1 * (err * 100 / a.target) ** (a.dim / g["p"])
        t_t = t1 * (n_t / n1) ** alpha
        print(f"To reach {a.target:g}% from the extrapolated value: about {n_t:,.0f} cells and {t_t / 3600:,.1f} h of CPU "
              f"({t_t / 86400:,.1f} days), if the order and cost growth hold. Treat this as an order of magnitude.")


if __name__ == "__main__":
    main()

References

  1. Lee, Q. F. (2026). The CFD mesh: Why the same problem gives different answers. Chmltech Insights (CFD series, Part 3). www.chmltech.com/post/the-cfd-mesh-why-the-same-problem-gives-different-answers
  2. Lee, Q. F. (2026). CFD of a stirred reactor: Three impellers against textbook power and pumping numbers. Chmltech Online Journal, 106(24). www.chmltech.com/post/cfd-of-a-stirred-reactor-three-impellers-against-textbook…
  3. Lee, Q. F. (2026). Heat transfer in plain, dimple and half-pipe jackets: CFD against the correlations. Chmltech Online Journal, 106(26). www.chmltech.com/post/heat-transfer-in-plain-dimple-and-half-pipe-jackets-cfd-a…
  4. Celik, I. B., Ghia, U., Roache, P. J., Freitas, C. J., Coleman, H., & Raad, P. E. (2008). Procedure for estimation and reporting of uncertainty due to discretization in CFD applications. Journal of Fluids Engineering, 130(7), 078001. 10.1115/1.2960953
  5. Lee, Q. F. (2026). Can an AI agent set up and run a CFD case? Fifteen attempts at five problems in OpenFOAM. Chmltech Online Journal, 106(28). www.chmltech.com/post/can-an-ai-agent-set-up-and-run-a-cfd-case-fifteen-attempt…
  6. Lee, Q. F. (2026). AI surrogate models for CFD: Answers in milliseconds instead of hours, and where they fail. Chmltech Online Journal, 106(25). www.chmltech.com/post/ai-surrogate-models-for-cfd-answers-in-milliseconds-and-w…
  7. Lee, Q. F. (2026). Buy, outsource or build: What CFD costs a small company. Chmltech Insights (CFD series, Part 6). www.chmltech.com/post/buy-outsource-or-build-what-cfd-costs-a-small-company
  8. Botella, O., & Peyret, R. (1998). Benchmark spectral results on the lid-driven cavity flow. Computers & Fluids, 27(4), 421–433. 10.1016/S0045-7930(98)00002-4
  9. OpenCFD Ltd. (2019). OpenFOAM v1912 release notes. OpenCFD. www.openfoam.com/news/main-news/openfoam-v1912
  10. Richardson, L. F., & Gaunt, J. A. (1927). The deferred approach to the limit. Philosophical Transactions of the Royal Society of London, Series A, 226, 299–361. 10.1098/rsta.1927.0008
  11. Roache, P. J. (1997). Quantification of uncertainty in computational fluid dynamics. Annual Review of Fluid Mechanics, 29, 123–160. 10.1146/annurev.fluid.29.1.123
  12. Roache, P. J. (1994). Perspective: A method for uniform reporting of grid refinement studies. Journal of Fluids Engineering, 116(3), 405–413. 10.1115/1.2910291
  13. Lee, Q. F. (2026). Can you trust it? Checking CFD against hand calculations. Chmltech Insights (CFD series, Part 5). www.chmltech.com/post/can-you-trust-cfd-checking-it-against-hand-calculations
  14. Menter, F. R. (1994). Two-equation eddy-viscosity turbulence models for engineering applications. AIAA Journal, 32(8), 1598–1605. 10.2514/3.12149
  15. Gnielinski, V. (1976). New equations for heat and mass transfer in turbulent pipe and channel flow. International Chemical Engineering, 16(2), 359–368.
  16. Lee, Q. F. (2026). A flow solver in the browser: The lattice Boltzmann method behind the live CFD figures. Chmltech Online Journal, 106(27). www.chmltech.com/post/a-flow-solver-in-the-browser-the-lattice-boltzmann-method…

How to cite this article

Lee, Q. F. (2026). How Fine Does the Mesh Need to Be? Accuracy Against Computing Time in Three Process CFD Cases. Chmltech Online Journal, 106(31). https://www.chmltech.com/post/how-fine-does-the-mesh-need-to-be-accuracy-against-computing-time-in-three-process-cfd-cases

Chmltech Online Journal · Vol. 106, Issue 31

Download the PDF

How Fine Does the Mesh Need to Be? Accuracy Against Computing Time in Three Process CFD Cases

We use your details to record this request and may follow up about it. See our privacy notice.