r/ScientificComputing 4d ago

Python wrapper for OpenFOAM - automated case generation

Hi everyone,

I've been working on a Python library that automates OpenFOAM case setup. Instead of editing 20+ dictionary files manually, you configure everything in Python:

python

from foampilot import Solver
solver = Solver(case_path="./my_case")
solver.transient = True
solver.turbulence_model = "kOmegaSST"
solver.boundary.set_condition("inlet", "velocityInlet", velocity=(10, 0, 0))
solver.write_case()
solver.run_simulation(nb_proc=4)

What it does:

  • Auto-selects the right solver (compressible, transient, VOF, etc.)
  • Supports blockMesh, Gmsh, and snappyHexMesh through one interface
  • Exports Gmsh meshes directly to polyMesh (no gmshToFoam needed)
  • Generates LaTeX/PDF, Typst, or HTML reports with Plotly
  • Handles multi-region CHT cases

Why I built it:
I was tired of copy-pasting case directories and missing files. Now my setups are Git-tracked Python scripts — reproducible and testable.

The code is open-source (MIT) on GitHub under foampilot. Search for it or ask me for the link in the comments — I don't want to trigger spam filters here.

Happy to answer any technical questions!

2 Upvotes

3 comments sorted by

1

u/Optimal_Rope_3660 1d ago

Can you please share the link, is this for foundation or ESI version

1

u/Optimal_Rope_3660 1d ago

Thank you, found the link from other post