CFD Scientific Computing · OpenFOAM Automation & Tooling

RapidFOAM

A tool that turns a 3D model of a race-car part into a ready-to-run airflow simulation, sends it to the university supercomputer, and shows the results live in a web browser, so the team can test aerodynamic ideas without hand-editing simulation files.

Role / Type

Lead Developer & Maintainer

Timeline / Context

Rapidamente Formula Student, Chulalongkorn University (2026)

Core Skills & Tools

Python (stdlib), FastAPI, Three.js, OpenFOAM v2606, SLURM/MPI, CFD Validation

GitHub Repo

Visit Repo ↗

Project details

1. The Problem

Formula Student is a competition where university teams design and build a small race car. Our team, Rapidamente, adds wings and other bodywork to push the car into the ground at speed. That push is called downforce: it gives the tyres more grip in corners. The cost is drag, the air resistance that slows the car down on the straights. Good aerodynamics means getting as much downforce as possible for as little drag as possible.

Building and testing every idea in a wind tunnel is far too expensive for a student team. Instead, we use CFD (computational fluid dynamics): computer simulations of how air flows around the car. We use OpenFOAM, free and widely used simulation software that is powerful but hard to set up.

To simulate one part, the air around it has to be divided into millions of tiny 3D cells, called the mesh. The computer then calculates the airflow in every cell. Setting this up by hand means editing many separate configuration files, and every time the shape of a wing changes, many of those settings have to change too. It is slow, and it fails in quiet ways: a simulation can run for hours and give a wrong answer without any obvious error.

I built RapidFOAM to automate that setup without hiding what the simulation is doing. My goals were:

  • One simple input. A 3D model of the part plus a short settings file should be enough to describe a whole simulation.
  • Sensible settings chosen automatically. The size of the virtual wind tunnel, where to use finer cells, and how to treat the air right next to the surface should follow from the part's shape and speed.
  • Honest warnings. If the mesh is poor or a target was not met, the tool should say so clearly instead of quietly carrying on.
  • Two ways to use it. A command-line tool for running many cases in bulk, and a web app for setting things up visually and watching results arrive.
  • No lock-in. The output is ordinary OpenFOAM files that any engineer can open and inspect with standard tools.

2. How It Works

  • It reads the shape and builds the virtual wind tunnel. RapidFOAM reads the 3D model in one pass and measures its size and level of detail. From that it sizes a virtual wind tunnel around the part. It also adds finer cells where the air behaves in complicated ways: close to the surface, and in the wake, the turbulent trail of air behind the part. Three quality levels (fast, standard, and fine) trade speed against accuracy.

  • One plan, shown before anything runs. All of these decisions go into a single plan. The web app's preview and the files actually written come from that same plan, so what you see is what will be simulated. If an automatic setting will make the mesh much bigger, the tool reports that before anything is written.

  • It handles the air right next to the surface. The thin layer of air touching the car, called the boundary layer, matters a lot for both drag and downforce. It needs very thin cells stacked against the surface. RapidFOAM works out how thin those cells should be from the speed and size of the part. If the meshing software can't build them as thin as asked, RapidFOAM reports what it actually achieved and where, instead of pretending the target was met.

  • It watches the simulation while it runs. A simulation is a loop that refines its answer over thousands of steps. RapidFOAM tracks the drag and downforce at each step. It stops the run once the numbers have settled to within ±0.5%, and it stops a run early if the numbers start blowing up, saving the last good result instead of losing hours of computing time.

  • It checks its own work. After meshing, RapidFOAM measures mesh quality (for example, how distorted the cells are) and how much of the surface actually got the thin boundary-layer cells. After the simulation, it compares what was achieved with what was planned. Cars made of several parts get a separate force reading for each part, so you can see what each wing contributes.

  • A web app connected to a supercomputer. Big simulations need more computing power than a laptop has, so they run on the university's HPC cluster (a shared supercomputer). From the browser, the RapidFOAM web app lets you upload a 3D model, adjust settings with a live 3D preview, send the job to the cluster, and watch charts of drag, downforce, and health checks update every few seconds. Results are downloaded safely, so an interrupted transfer never leaves a half-written case.

  • Easy for other tools to drive. Other programs can create a simulation by passing in a few settings, with no files to edit by hand. My second project, RapidWing, uses this to send computer-generated wing designs through the same simulation setup automatically.

  • Safer by default. Several cautious settings are now on by default instead of being optional: extra detail in narrow gaps between wing elements, a clear failure when a run blows up instead of a run that only looks finished, and a longer default run length. Someone who writes a minimal settings file still gets the careful setup.

  • Tested like real software. The project has more than 540 automated tests for the Python code and 91 for the web app. They include checks that the generated simulation files don't change unexpectedly. The tests run automatically on Windows and Linux with every change. The project is past 300 commits; v1.7.1 is the latest release.

Key Takeaway

"Automating simulations isn't mainly about writing files for the user. It's about building in the engineering knowledge of what can go wrong, and then being open about every assumption: what was actually achieved, where the mesh is weak, and why a result should or shouldn't be trusted. An automated result is only useful if an engineer can check it and get the same answer again."

3. Results and What I Learned

RapidFOAM is the airflow simulation tool for the Rapidamente Formula Student team at Chulalongkorn University. It has been used to study individual parts and half of the full car (the car is symmetric, so simulating one half saves time) on meshes with millions of cells. A change to a part's shape is now a small settings change and one command, and every result keeps a copy of the settings that produced it.

What testing showed:

  • Large tests found real problems. A batch of 24 full-car simulations, about 10 million cells each, showed that one meshing setting let badly distorted cells through. Every one of the 24 meshes was rated "Bad". Tightening that setting brought the meshes back to acceptable quality.

  • One change at a time. In nine runs on the same car, I changed one setting per run to see what really improved the boundary-layer cells. Only one change helped: it raised the share of the surface covered by the full boundary layer from 44% to 50% without hurting mesh quality. Getting coverage to at least 50% removed a 2–4% error in the predicted downforce. What remains is about 1.3% of variation between meshes.

  • Comparing against real measurements. I re-ran six well-known test cases and compared the results with reference data. The Ahmed body, a simple car-like block that researchers use to test simulations, was run at four rear-slope angles and compared with published wind-tunnel measurements.

    • At 25°, the simulation fully settled and the predicted drag was within 1.6% of the measured value.
    • At 0°, the drag came out 9% high, which is inside the allowed margin of 12%. But the run didn't fully settle: the drag had steadied, while the downforce kept wobbling by about 1%.
    • At 12.5° and 35°, the drag came out 12% and 11% high, just outside the allowed margins of 12% and 10%, so they count as fails. These runs also didn't fully settle. Over-predicting drag like this is a known weakness of this type of simulation when the airflow breaks away from the surface.
    • A simple wing passed within its tolerance against classic textbook data, with lift about 7% and drag about 10% below the estimate.
    • A wing close to the ground passed as a sanity check, but there is no wind-tunnel data to compare it with.
    • The mesh-quality check still flags small local problems in five of the six meshes, such as patchy boundary-layer cells on the Ahmed body's support stands. So these numbers are a solid starting point, not a final word.
  • Checking the checker. Re-reading the original papers showed the measurements did not include the stands that hold the model up. Comparing against our total, stands included, had made our drag look 9–11% worse than it was, so the comparison now uses the body alone. I also found that the mesh-quality rating marked every normal mesh "Bad". I recalibrated it on 48 real wing meshes so it now separates harmless features from cells that are actually broken.

Validation summary: left, Ahmed body drag at four slant angles, RapidFOAM versus published wind-tunnel data; right, two wing cases shown as a percentage of their reference values with acceptance bands
Validation summary from the latest benchmark run (click to enlarge). Left: drag on the Ahmed body at four rear-slope angles. The red dashed line is the published wind-tunnel data, green is RapidFOAM scored on the body alone, and blue includes the support stands. Right: the wing cases as a percentage of their reference value; the shaded boxes show the allowed margin. The ground-effect wing's reference is a sanity estimate, not a wind-tunnel measurement.

RapidFOAM does not replace engineering judgement. Its first estimate of how thin the boundary-layer cells need to be can be 30–40% off on a real car, which is exactly why it measures what was actually achieved after every run and reports it next to the target. The 3D model still has to be clean and closed, and settings still need checking for each new case. RapidFOAM makes those limits visible and then gets out of the way: its output is standard OpenFOAM that any engineer can open, inspect, and run without it.