Every simulation group has the folder. It holds a dozen scripts with names like extract_peaks_v3_FINAL.py, each one written late in some project to pull a handful of numbers out of solver output before a design review. They all do roughly the same thing: find the run directories, decode a results file, walk to a few channels, reduce each one to a scalar, print the answers.
Nobody plans to build a post processing system out of copies of that script. It happens one deadline at a time. This article is about getting out: what the script pile actually costs, how to script the job properly if scripting is the right call for you, and what changes when result extraction stops being code at all.
The obvious cost is the hour it takes to write each script. That is the cheapest part. The real bill arrives later, in four installments:
Scripting is sometimes the right answer, and when it is, the difference between a liability and an asset is structure. The rules that hold up in practice:
extract.py that the whole group installs beats forty copies. Give it an owner and a version number.The skeleton, independent of any particular solver ecosystem:
from pathlib import Path
import pandas as pd
from readers import read_channel # your pinned, shared reader
CHANNELS = {
"peak_disp": ("nodout/42/z_displacement", "peak"),
"peak_stress": ("elout/1105/von_mises", "peak"),
}
rows = []
for run_dir in sorted(Path("runs").glob("eval_*")):
row = {"run": run_dir.name}
for name, (path, reduce) in CHANNELS.items():
series = read_channel(run_dir, path)
row[name] = series.max() if reduce == "peak" else series
rows.append(row)
pd.DataFrame(rows).to_parquet("results.parquet")
Done this way, scripting works. It is also a real software project now: it needs review, versioning, tests against known results, and an owner. Budget for that honestly, because the folder of copies is what happens when you do not.
The other route is to stop describing how to read results and just declare what you want. In a workflow tool, a result reader is a node you configure instead of code you write: point it at the result files with a glob pattern, browse the channel hierarchy it discovers, pick the channels you care about, and choose a reduction for each, a peak for a constraint check or the full time series for a curve match.
Three things change that no script pile can match:
| Situation | Better route |
|---|---|
| Forensic deep dive into one strange run | Script it. Interactive exploration wants a notebook. |
| Exotic or in house result format no tool reads | Script it, once, as a shared library. |
| Results feeding reports on a repeating schedule | Either works; the tool avoids the maintenance tax. |
| Results feeding DOE, optimization, or sensitivity studies | Declarative reader. The loop must close by itself. |
Automating post processing is not really about saving the hour of parsing. It is about what becomes possible once results flow without hands. The moment a peak displacement is a wire instead of a copied number, it can feed an objective. The study that took a week of manual iterations becomes an overnight run with 150 solver calls placed by an optimizer, and the engineer's job moves up a level: from moving numbers between files to deciding what the numbers should be.
That is the loop worth building, whichever route you take to it.
// TRY IT ON YOUR OWN MODELS
Visual node graph studies, DOE and surrogate optimization, native solver results readers, and cluster execution. Free beta, or Pro from $99 a month.
See plans product tour →