Abstract
AI agents can now write input files, run solvers and read results. This paper asks whether one can set up and run a computational fluid dynamics (CFD) case well enough for a small company. Five plain briefs of rising difficulty were each given to three fresh agents working alone with OpenFOAM v1912: a laminar pipe, a lid-driven cavity, a backward-facing step, a rough steel pipe sized for design and the coolant side of a half-pipe reactor jacket. A rubric fixed in advance graded each answer and six process items, and a separate reviewer agent judged every attempt from its case files and logs. The mean score was 14.73 out of 15; 14 of 15 answers fell in the best band and no answer was confidently wrong. The reviewer deducted three process points, two for supporting runs in which one equation had stopped being solved while the result was still moving. The high scores mostly measure something other than unaided CFD skill. The first task has an exact solution. In the second, all three agents recalled the published benchmark, and in the third, two of three did. In the fourth, every agent reported the Colebrook value because its rough-wall CFD read 11 to 19% low. Only the jacket had no known target. There the answers spread by 7.6%, mainly over whether the coil's curvature was modelled, and all three agents wrote their own temperature solver. The paper sets out what an engineer should check before trusting an agent's CFD.
Keywords: AI agents; computational fluid dynamics; OpenFOAM; verification and validation; benchmark; heat transfer coefficient; engineering judgement; large language models
1. Introduction
An earlier paper in this journal tested AI agents on short process engineering calculations [1]. Arithmetic was rarely the weak point: of 300 graded answers, 298 were within tolerance. The risks lay in how a task was framed, in data the agent supplied from memory and in judgement. CFD is a harder test. A CFD answer depends on many choices that a hand calculation does not have: the geometry and how much of it to model, the boundary conditions, the turbulence model and wall treatment, the mesh, and when to call a run converged. The CFD series on this site argued that a small company can use CFD only if someone checks those choices against hand calculations [2–5]. Agents are now able to make all of them: they can write the case files, run the solver, post-process the fields and write a report. Professional bodies in Canada expect engineers to understand and verify what such tools produce [6, 7], and risk frameworks ask for the same [8].
This paper asks a narrow question. Given a plain brief of the kind a process engineer might write, can an agent working alone set up and run a CFD case, and can its answer and its process be trusted? Five briefs were written, from a textbook laminar pipe to the coolant side of a reactor jacket, and each was given to three fresh agents in turn. The cases were chosen because the site had already solved them, so a reference answer existed for every one [3, 4, 9, 10]. The scoring rules were written before any attempt was run. A separate agent then reviewed every attempt from its files and logs, not from its report. The tools are those of the earlier CFD papers in this journal [10–13].
2. The Five Tasks
Table 1 lists the tasks. Each brief stated the problem in plain words, named the numbers to report in a small answer file and ended with the same working rules. The agent was alone in an empty folder with OpenFOAM v1912 [14] on two shared processor cores and 7 GB of memory. The tutorial cases were not installed, so every case had to be written from scratch. Each solver run had to finish in about eight minutes. Agents were told not to read the site's files or any other attempt's folder and not to use web search, and to write a report covering the set-up, convergence, mesh independence, any hand check and how sure they were.
| Task | What the brief asks | Deliverable | Reference and its source | Bands (%) |
|---|---|---|---|---|
| T1 Laminar pipe | Lube oil, 60 mPa·s, 8.09 m³/h in a 1½ in. Schedule 40 pipe | Pressure drop per 100 m; \(u_{\max}/u_{\mathrm{mean}}\) | 195.51 kPa/100 m and 2.000, exact (Hagen–Poiseuille) [4] | 2/5/15; 1/3/10 |
| T2 Cavity | Square cavity, lid-driven, Re 1,000 | Minimum \(u/U\) on the vertical centreline and its height | −0.3886 at \(y/L = 0.1717\) [15] | 1/3/10; 3/8/20 |
| T3 Backward-facing step | Air at 44.2 m/s over a 12.7 mm step, RANS model of the agent's choice | Reattachment length \(x_r/H\) | 6.26, measured [9, 16] | 3/8/15 |
| T4 Rough pipe | Liquid at 0.60 mPa·s in commercial steel, roughness 0.045 mm; value for design | Design pressure drop per 100 m | 68.1 kPa/100 m, Colebrook [4, 17] | 5/10/20 |
| T5 Half-pipe jacket | Water at 30 °C, 1.44 m/s, in a half-pipe of 82.8 mm bore on a 2.36 m coil; straight channel allowed if justified | Heat transfer coefficient on the vessel wall; pressure drop per metre | 5,801 W/m²K and 363.8 Pa/m, solved for a straight channel [10] | 10/20/35 |
The tasks rise in difficulty. T1 has an exact answer, and T2 has a spectral benchmark accurate to many digits [15]. The T1 and T4 reference values were taken from the Part 5 post, whose flow was rounded slightly differently: for the briefs' own inputs, Hagen–Poiseuille gives 195.55 kPa/100 m and Colebrook 68.14 kPa/100 m, 0.02% and 0.04% above the references. The rubric graded against the references as fixed; no grade would change. T3 needs a turbulence model and a developed inflow boundary layer; the measured value is the target, and the Part 4 post found that six RANS models spread from 5.39 to 6.39 step heights [9]. T4 asks for a design value, not a CFD value. The Part 5 post showed that rough-wall CFD can read well below the Colebrook correlation, and a careful engineer should notice the gap and say which number to use [4]. T5 is an equipment problem with no textbook answer. Its reference is the solved straight-channel value from the jacket paper in this journal, which carries about ±10% and sits 3% below the Gnielinski correlation (5,986 W/m²K) [10, 18].
3. Method
3.1 The attempts
Each attempt was run by a fresh general-purpose agent, given the brief and nothing else. It had no memory of this conversation and was told not to open the site's files, the other attempts' folders or the web; it was not prevented from doing so, and Section 8 explains what could be checked. Three attempts per task gave fifteen in all. The attempts were planned to run at most two at a time, and the half-pipe attempts one at a time; the log does not record start and finish times for all of them. The lead session logged each attempt's final report and, where the harness reported them, its wall time, tool calls and tokens. Three attempts were interrupted by server restarts and resumed from their saved state; the scores do not depend on that.
3.2 Scoring
The rubric was fixed before the first attempt (Figure 1). The answer part compares each reported number v with its reference, Eq. (1):
An answer earns 3, 2, 1 or 0 points as |e| falls within the first, second or third band of Table 1 or outside them, and an attempt with two deliverables takes the worse grade. The process part scores six items from 0 to 2: geometry and conditions, fluid properties and units, boundary conditions, model choice and wall treatment, the mesh check, and convergence and honesty. The last item is lost if a solved field stops iterating before the reported quantity has settled. The attempt score is Eq. (2):
so S runs from 0 to 15. Four flags are recorded but not scored: a dangerous error (an answer outside the third band reported with no caveat, a unit error, or a result reported despite non-convergence), an unprompted hand check, a rule breach and the cost.
3.3 Review
A separate agent, with no part in running the attempts, scored the process items. It read the rubric, the briefs and the reference answers, then each attempt's case files, solver logs, scripts and outputs. Where it could recompute a number, it did: pressure gradients from the logs, reattachment points from wall shear or velocity fields, Richardson extrapolations, and the Colebrook and Gnielinski values. Every reported number it recomputed matched. It also checked that every claimed mesh study existed as real cases and searched all files for paths to the site, other attempts or the web. Its evidence for every point is in each attempt's review file, published with the paper.
4. Results
4.1 Scores
Table 2, Figure 2 and Figure 3 give the scores. The mean was 14.73 out of 15, with every attempt between 13 and 15. Full marks went to 12 attempts, and 14 of the 15 answers earned the excellent grade. The reviewer awarded 177 of 180 possible process points and found no dangerous error.
| Task | Reported answers (a1, a2, a3) | Error against the reference | Process points lost | Scores (a1, a2, a3) | Mean |
|---|---|---|---|---|---|
| T1 Laminar pipe | 195.55, 195.55, 195.56 kPa/100 m; 2.000 | Within 0.03% (within 0.003% of the exact value) | None | 15, 15, 15 | 15.00 |
| T2 Cavity | −0.3887 at 0.1717, all three | 0.03% | None | 15, 15, 15 | 15.00 |
| T3 Step | 6.39, 6.4, 6.44 step heights | +2.1% to +2.9% | a3, item 1 | 15, 15, 14 | 14.67 |
| T4 Rough pipe | 68.1 kPa/100 m, all three | −0.01% | None | 15, 15, 15 | 15.00 |
| T5 Half-pipe | 5,110, 5,500, 5,440 W/m²K; 392.5, 356, 360 Pa/m | h −11.9%, −5.2%, −6.2%; Δp +7.9%, −2.1%, −1.0% | a1 and a2, item 6 | 13, 14, 15 | 14.00 |
Answer error against the bands
Process points (0–2 per item)
4.2 How the agents worked
The agents worked in a consistent and sound way. For the pipes and the jacket, every attempt modelled a thin slice with periodic ends and a force or fixed pressure gradient that held the mean velocity, which gives fully developed flow exactly. For the step, all three developed the inflow boundary layer over a long run-up. Every attempt ran a real mesh study of three to six meshes, all present as cases, and checked its work against an exact solution, a correlation or a recalled benchmark without being asked. In T1, two attempts found that their first wedge geometry put the wall at the wrong radius and biased the pressure drop by 0.19%; a third found that a 5° wedge read 0.07% high and moved to a 1° wedge. In T2 the three agents ran 64², 128² and 256² meshes and extrapolated to the same −0.3887 at 0.1717. In T3, the k–ω SST model [19] gave 6.39, 6.4, 6.44 step heights and a second model, Spalart–Allmaras, gave 6.04 in a3 and about 6.08 in a2, a sensible view of model uncertainty. Uncertainty was generally split into a small numerical part, estimated by Richardson extrapolation or a grid convergence index [20], and a larger model part.
4.3 The three deductions
Each deduction was small and none touched an answer run. In T3, a3's incoming boundary layer was 1.2 step heights thick, against the briefed 1.5; it said so, and a check case with a thicker layer gave the same answer. In T5, a1 and a2 each supported a claim with a pipe run in which the ω equation of the SST model had stopped being solved while the pressure gradient was still moving. The appendix script finds this in the logs: after the first skipped solve the pressure gradient moved a further 5% in a1's run and 2.6% in a2's, while in a2's answer run it moved 0.03%. In a1's run most of that change came early, while the run was still settling from its start; once ω was skipped almost every iteration, from about iteration 1,000, the gradient still moved 0.8%. In a1 the run backed its choice of near-wall cell; in a2 it was the only check of the agent's own temperature solver. Both reports quoted those runs to more precision than their convergence supports.
4.4 Working around the tools
This OpenFOAM build could not run its function objects, the usual post-processing hooks; every attempt that tried them hit the same error. The agents wrote their own extraction of wall shear, centreline profiles and y⁺ in Python. The jacket task went further: no route to a temperature solution worked in this build, so all three agents wrote their own fully developed energy solver on the OpenFOAM mesh and flow fields (Table 3). Two checked theirs against the exact laminar Nusselt number of 4.364 and against Gnielinski for a turbulent pipe [18]; a1 found that its first version, without a non-orthogonal correction, was 2 to 3% off and did not improve with refinement, and replaced it. The third checked its solver only against the unconverged pipe run noted above, after OpenFOAM's own buoyant solver diverged on its mesh. Writing a solver to get round a missing tool is resourceful, but it adds a piece of code that nobody else has tested, and its check deserves as much scrutiny as the CFD. One T4 agent also wrote its own rough-wall boundary condition.
| Attempt | Channel | Temperature solver and its check | h (W/m²K) | Δp (Pa/m) | Notes |
|---|---|---|---|---|---|
| a1 | Curved, mapped onto the 2.36 m coil; straight run as well | Own; exact laminar Nu and Gnielinski | 5,110 (straight 5,610) | 392.5 (straight 358.4) | Curvature lowered h by 9% and raised Δp by 9.4% |
| a2 | Straight, justified by \(D_h/D_c\,{=}\,0.021\) and the heated wall on the inside of the bend | Own; unconverged turbulent pipe only | 5,500 | 356 | Curvature left as an uncertainty |
| a3 | Straight; curvature estimated from coil correlations | Own; exact laminar Nu and Gnielinski | 5,440 (raw 5,410) | 360 (raw 347–363) | Anchored to the pipe correlations; with curvature, about 5,800 W/m²K |
4.5 How sure the agents said they were
Every report gave an uncertainty, and the agents generally split it the right way. In T1, a3 put its numerical uncertainty at ±0.1%, against an actual error of 0.003% from the exact solution (0.03% from the rounded reference); in T2 the attempts gave ±0.001 to ±0.002 on the minimum velocity, against an error of about 0.0001. In T3 they put the numerical error at about ±0.02 step heights and the model error at about ±0.4; their SST answers sit 0.13 to 0.18 step heights above the measurement, inside the model band, and the Spalart–Allmaras runs fell below the measurement, also inside it. In T4 the stated bands, ±5 kPa/100 m and ±10%, were about the accuracy of the Colebrook correlation itself, which is what the agents reported. In T5, a2 and a3 gave ±10% and ±8% on the coefficient and ±5% on the pressure drop, and their errors against the reference fell inside those bands. Only a1's errors, −11.9% and +7.9%, fell outside its stated ±10% and ±5%, and the difference is the curvature it chose to model. On this small sample the agents were honest about precision and, if anything, cautious.
5. What the Scores Measure
The rubric reached its ceiling, and the reason matters more than the scores. Figure 4 compares each graded answer with the agent's own CFD. Taken task by task, the grades measure different things.
In T1 the answer is exact and the agents knew it: each checked its result against Hagen–Poiseuille and matched the exact value within 0.003% (0.03% from the rounded reference). That shows the agents can set up a case correctly. It does not show they can judge a CFD result that has no exact answer to compare with.
In T2 and T3 the agents knew the target. All three cavity attempts quoted the Botella and Peyret benchmark and the older Ghia values from memory and said so [15, 21]. Two step attempts recognized the Driver and Seegmiller experiment in their own scripts and recalled its 6.26 [16]. The reviewer found no sign that any answer was tuned towards a recalled value: each reported number is the agent's own computed one, and the recalled value was used to compare afterwards. In T2, for instance, the 128² mesh of a2 and a3 gave −0.3824, close to Ghia's coarse-grid value, and only the extrapolated value matched the spectral benchmark. Still, an agent that knows the answer can keep refining until it agrees, and can recognize a mistake by the mismatch. These grades are best read as computed values that the agents could check against benchmarks they already knew.
In T4 every agent reported the Colebrook value of 68.1 kPa/100 m for design [17]. Their own rough-wall CFD read low: 56.7 kPa/100 m in a1 (−17%) and 56.6 in a3 (−17%), with wall functions, and 55.5 to 60.8 in a2 (−19% to −11%) with a rough-wall condition it wrote itself. All three explained the gap the same way. Rough-wall models in CFD are calibrated to uniform sand grains, while the Colebrook roughness of commercial steel is an equivalent value; at this flow the roughness Reynolds number was only about 5.8, in the transitional range where the two differ most. With the sand-grain height doubled to 0.090 mm, a1's CFD gave 67.3 kPa/100 m and a2's 66.7, close to Colebrook. All three judged the raw CFD unconservative and reported the correlation. That is the right engineering judgement, and the grade measures it. Graded on the CFD alone, all three would have scored poor.
Only T5 has no known target, and there the answers spread by 7.6% (Figure 5). Most of that spread is a modelling choice. The brief allowed a straight channel if justified. a2 and a3 took it; a1 solved the curved channel and found that curvature lowered the coefficient on the vessel wall by 9%, because the wall sits on the inside of the bend. Its own straight run gave 5,610 W/m²K, −3.3% from the reference, and the three straight-channel values lie within 3.1% of each other. The other two attempts reasoned the opposite way from correlations: the usual coil factor \(1 + 3.5\,D_h/D_c\) [22] adds about 7.5% to a perimeter-average coefficient, and a3 suggested a design value with curvature of 5,800 W/m²K. a2 noted that the heated wall is on the inside of the bend and so gains little. These are different readings of the physics, and nothing in this study settles which is right. The point is that the graded answer of a1, the one attempt that modelled the coil as briefed, scored lower against a reference that did not include curvature. That exposes the reference and the brief, not the agent. The reference itself carries about ±10%, the same as the excellent band, so the grades on T5 cannot separate answers that lie within about 10% of each other, and a1's drop to acceptable at −11.9% is inside that uncertainty. The best cross-check on a1's set-up is its own straight-channel run, 3.3% from the reference and the closest of the three.
The straight-channel answers also show a subtler point. All three lie 3 to 6% below the reference, and the spread among them follows the height of the first cell at the wall. a3 found that its coefficient rose by about 2% each time that cell was halved, even far inside the viscous sublayer; a1 found the same drift and chose the cell height at which the same set-up matched smooth-pipe friction. a3 then removed the drift by taking the ratio of the jacket to a pipe solved on the same near-wall mesh and scaling the Gnielinski and Petukhov values by it [18, 23]; its raw CFD, 5,410 W/m²K, was −6.7% from the reference. This is defensible, but it makes the final number partly a correlation. The near-wall drift of k–ω SST heat transfer applies to the reference itself, which is one reason the jacket paper gave it ±10% [10].
6. Time and Cost
Wall time, tool calls and tokens were recorded by the harness for the laminar pipe and the jacket only (Table 4). For the other nine attempts they were not copied into the log before the lead session's context was compacted, and they cannot be recovered. The pipe took 4 to 17 minutes. The jacket took about an hour, and one attempt's figures cover only its second half, after a server restart.
| Attempt | Wall time (min) | Tool calls | Tokens |
|---|---|---|---|
| T1 a1 | 13 | 34 | 117k |
| T1 a2 | 17 | 25 | 110k |
| T1 a3 | 4 | 15 | 100k |
| T5 a1 | 68 | 56 | 185k |
| T5 a2 (second half only) | 23 | 23 | 162k |
| T5 a3 | 65 | 77 | 210k |
For scale, the Part 6 post assumed about 300 hours of learning before an engineer can run open-source CFD in house, and eight hours for an engineer to review each study bought from a consultant: its scope, inputs and acceptance checks [5]. An agent's study is closer to a bought study than to one the engineer ran: it removes much of the learning and none of the review. Its hour does not include the engineer's time to check the work, which this study suggests is now the larger cost.
7. What a Process Engineer Should Check
The findings echo the calculation benchmark in this journal [1]. There, too, the arithmetic was sound and the risks lay in framing, recalled data and judgement. CFD adds more places for judgement to enter: what to model, how fine the wall cells must be, and whether to report the CFD or a correlation. On this evidence an agent can set up a standard CFD case, run it to convergence, run a real mesh study and write an honest report. It is less safe where no known answer exists, because there its choices of geometry, wall treatment and anchoring decide the number. Table 5 lists the checks that would have caught every weakness found here. The appendix script automates the first.
| Check | How | What it found here |
|---|---|---|
| Every solved field kept iterating until the reported quantity settled | Run the appendix script on the solver logs | ω stopped in two supporting runs while the pressure gradient was still moving (in a1's run, 0.8% after ω was skipped almost every iteration; in a2's, 2.6% after its first skip, with ω skipped on 64% of later iterations) |
| The mesh study exists | Open the case folders, not the report | All claimed meshes existed |
| The first cell suits the wall treatment, and the answer does not drift as it shrinks | Read y⁺ and ask for a first-cell sweep | Jacket h rose about 2% per halving |
| Which numbers came from memory | Search the report for benchmark values and phrases such as "from memory" | All T2 attempts and two T3 attempts knew the target |
| Whether the answer is the CFD or a correlation | Ask for the raw CFD value beside the reported one | T4 and T5 a3 reported correlation-based values |
| The geometry matches the plant | Compare the case with the drawing, including curvature and flow path | One jacket attempt modelled the coil curvature; two did not |
The brief matters as much as the check. Each brief here named the numbers to report and the working rules, and the agents followed them closely. A brief for real work should go further. It should say which features of the plant matter (here, the coil curvature), ask for the raw CFD value beside any design value, ask for a first-cell sweep on any heat transfer or wall-shear result, and ask the agent to state which reference values it already knows. Each of those requests would have made one of the weaknesses above visible in the report itself, before any log was opened.
8. Limits of the Study
The study is small and favourable to the agents. The subjects were agents of the same Claude model family that ran the trials, reviewed them and helped draft this paper, so the reviewer may share the subjects' blind spots; a human CFD specialist did not review the attempts. Three attempts per task cannot measure how often an agent fails, and other models or tools may behave differently. Rule breaches could be checked only from the files each agent left: no file pointed to the site, another attempt or the web, but the agents' tool transcripts were not available to the reviewer, so a read that left no trace cannot be ruled out. Cost was recorded for two tasks of five. Everything ran on one OpenFOAM version on a two-core machine, whose broken function objects forced workarounds that a normal installation would not need. Four of the five tasks are canonical cases with published answers, and the agents knew several of them. The half-pipe reference covers a straight channel only, although the brief described a coil, and it carries about ±10%, the same as the excellent band, so the T5 grades cannot separate the three attempts; the rubric graded against it as fixed, but a better reference would have included curvature and a tighter uncertainty. Finally, the briefs were well posed: real requests are vaguer, and the agents' choices would matter more.
9. Conclusions
- Fresh AI agents working alone with OpenFOAM set up and ran all five cases. The mean score was 14.73 of 15, with every attempt between 13 and 15, no dangerous error, and every number the reviewer recomputed from the files matched.
- The agents worked like careful engineers: periodic slices for fully developed flow, mesh studies that exist as cases, unprompted hand checks, and their own solvers where the installed tools failed.
- The three deductions were for small lapses; two were supporting runs in which one equation had stopped being solved while the result was still moving. A short log check finds this.
- The high grades mostly measure something other than unaided CFD skill: an exact solution (T1), benchmark values the agents recalled (all of T2, two of three in T3) and the choice of a correlation over the agent's own rough-wall CFD, which read 11 to 19% low (T4).
- On the one task with no known target, the half-pipe jacket, the three answers spread by 7.6%. The main cause was whether the coil curvature was modelled. The attempt that modelled it graded lower against a straight-channel reference, but that reference carries about ±10%, the same as the excellent band, so the grades cannot separate it from the others.
- An agent can do the work of setting up and running a standard CFD case. Whether the answer is right for a new case still needs an engineer's check against an independent calculation.
10. Appendix: Checking an Agent's Solver Logs
The script below reads one or more OpenFOAM solver logs in order and reports, for each solved field, whether and when its solve was skipped ("No Iterations 0"), and how much a monitored quantity changed after the first skip. By default it watches the pressure gradient written by OpenFOAM's mean-velocity source; any number written to the log can be watched instead. It flagged the two deducted runs of this study and passed the answer runs. The download also holds the five briefs, the rubric, the reference answers, the scoring script, every attempt's report, answer and review files, the reviewer's summary and the script that rebuilds every table in this paper.
"""Check an OpenFOAM solver log for silently skipped solves (Chmltech Online Journal, Vol. 106, Issue 28, Appendix).
A solver line ending "No Iterations 0" means the field was not solved that iteration: its initial residual was already
below the tolerance. That is harmless once the case has settled, and a warning sign while the quantity you report is
still moving. This script reads one or more logs in order (for example log.simpleFoam.part1 log.simpleFoam), finds the
first skipped solve of each field, and reports how much a monitored quantity changed between that iteration and the
end of the log.
The monitored quantity is read with a regular expression. By default it is the pressure gradient written by the
meanVelocityForce source ("Pressure gradient source: ... pressure gradient = <value>"); give --monitor to read
another number, for example a residual or a value your own function writes to the log.
Usage: python3 agentcfd_appendix.py LOG [LOG ...] [--monitor REGEX] [--skip-before N] [--tol 1e-3]
Python 3, standard library only. Prints one line per field and a verdict."""
import argparse, re, sys
SOLVE = re.compile(r"Solving for (\w+), Initial residual = (\S+), Final residual = \S+, No Iterations (\d+)")
TIME = re.compile(r"^Time = (\S+)")
DEFAULT = r"Pressure gradient source: .*pressure gradient = (\S+)"
def read(paths, monitor):
t, rows, mon = 0.0, {}, []
for p in paths:
with open(p, errors="ignore") as fh:
for line in fh:
m = TIME.match(line)
if m:
try: t = float(m.group(1))
except ValueError: pass
continue
m = SOLVE.search(line)
if m:
f, res, n = m.group(1), float(m.group(2)), int(m.group(3))
d = rows.setdefault(f, dict(first_skip=None, skips=0, solves=0, last_res=None))
d["solves"] += 1; d["last_res"] = res
if n == 0:
d["skips"] += 1
if d["first_skip"] is None: d["first_skip"] = t
continue
m = monitor.search(line)
if m:
try: mon.append((t, float(m.group(1))))
except ValueError: pass
return rows, mon
def value_at(mon, t):
"""Monitored value at the last record at or before iteration t."""
best = None
for tt, v in mon:
if tt <= t: best = v
else: break
return best
def main():
ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
ap.add_argument("logs", nargs="+")
ap.add_argument("--monitor", default=DEFAULT, help="regular expression with one group: the number to watch")
ap.add_argument("--skip-before", type=float, default=5, help="ignore skips before this iteration (start-up)")
ap.add_argument("--tol", type=float, default=1e-3, help="relative change after the first skip that counts as moving")
a = ap.parse_args()
rows, mon = read(a.logs, re.compile(a.monitor))
if not rows: sys.exit("no solver lines found")
end = mon[-1][1] if mon else None
print(f"{'field':10s} {'solves':>8s} {'skipped':>8s} {'first skip':>11s} {'last residual':>14s} change of monitor after first skip")
worst = 0.0
for f, d in sorted(rows.items()):
fs = d["first_skip"] if d["first_skip"] is not None and d["first_skip"] > a.skip_before else None
ch = ""
if fs is not None and end is not None:
v0 = value_at(mon, fs)
if v0:
rel = abs(end - v0) / abs(v0); worst = max(worst, rel); ch = f"{rel:.2%} ({v0:.6g} -> {end:.6g})"
print(f"{f:10s} {d['solves']:8d} {d['skips']:8d} {('-' if fs is None else f'{fs:g}'):>11s} {d['last_res']:14.3e} {ch}")
if not mon:
print("No monitored value found: give --monitor to say what to watch.")
elif worst > a.tol:
print(f"WARNING: a field stopped being solved while the monitored value was still changing (by {worst:.2%}). "
"Run longer or tighten the tolerance before you trust the result.")
else:
print(f"OK: after the first skipped solve the monitored value changed by at most {worst:.2%}.")
if __name__ == "__main__":
main()References
- Lee, Q. F. (2026). Can an AI agent do process engineering calculations? A benchmark of three models, with and without code. Chmltech Online Journal, 106(22). www.chmltech.com/post/can-an-ai-agent-do-process-engineering-calculations-a-ben…
- Lee, Q. F. (2026). What CFD is, and when it is worth paying for. Chmltech Insights (CFD series, Part 1). www.chmltech.com/post/what-cfd-is-and-when-it-is-worth-paying-for
- 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
- 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
- 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
- Engineers and Geoscientists BC. (2024, November 22). Practice advisory: Use of artificial intelligence (AI) in professional practice (Version 1.0). Announced by EGBC at https://egbc.ca/News/Articles/New-Practice-Advisory-on-AI; the link below is a copy reproduced by Professional Engineers Ontario. www.peo.on.ca/sites/default/files/2025-11/EGBC_Use_of_Artificial_Intelligence_i…
- APEGA. (2025). Guidance for registrants regarding the use of artificial intelligence tools (Practice notice, first published July 2025; posted March 23, 2026). Association of Professional Engineers and Geoscientists of Alberta. www.apega.ca/news/2026/03/23/guidance-for-registrants-regarding-the-use-of-arti…
- National Institute of Standards and Technology. (2023). Artificial intelligence risk management framework (AI RMF 1.0) (NIST AI 100-1). 10.6028/NIST.AI.100-1
- Lee, Q. F. (2026). Turbulence models in plain language: Six models, one step and a measured answer. Chmltech Insights (CFD series, Part 4). www.chmltech.com/post/turbulence-models-in-plain-language
- 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…
- 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…
- 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…
- 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…
- OpenCFD Ltd. (2019). OpenFOAM v1912 release notes. OpenCFD. www.openfoam.com/news/main-news/openfoam-v1912
- 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
- Driver, D. M., & Seegmiller, H. L. (1985). Features of a reattaching turbulent shear layer in divergent channel flow. AIAA Journal, 23(2), 163–171. 10.2514/3.8890
- Colebrook, C. F. (1939). Turbulent flow in pipes, with particular reference to the transition region between the smooth and rough pipe laws. Journal of the Institution of Civil Engineers, 11(4), 133–156. 10.1680/ijoti.1939.13150
- Gnielinski, V. (1976). New equations for heat and mass transfer in turbulent pipe and channel flow. International Chemical Engineering, 16(2), 359–368.
- Menter, F. R. (1994). Two-equation eddy-viscosity turbulence models for engineering applications. AIAA Journal, 32(8), 1598–1605. 10.2514/3.12149
- 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
- Ghia, U., Ghia, K. N., & Shin, C. T. (1982). High-Re solutions for incompressible flow using the Navier–Stokes equations and a multigrid method. Journal of Computational Physics, 48(3), 387–411. 10.1016/0021-9991(82)90058-4
- Kern, D. Q. (1950). Process heat transfer. McGraw-Hill.
- Petukhov, B. S. (1970). Heat transfer and friction in turbulent pipe flow with variable physical properties. Advances in Heat Transfer, 6, 503–564. 10.1016/S0065-2717(08)70153-9
How to cite this article
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). https://www.chmltech.com/post/can-an-ai-agent-set-up-and-run-a-cfd-case-fifteen-attempts-at-five-problems-in-openfoam
