-
-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the FOAMFlask wiki!
FOAMFlask is an attempt to make a yet another lightweight web-based GUI for managing and running OpenFOAM tutorials and simulations. It allows users to easily select a tutorial, set a case directory, and execute OpenFOAM commands directly from a browser.
- Web interface for OpenFOAM case management.
- Persistently store the CASE_ROOT across sessions.
- Load and copy tutorials from the OpenFOAM tutorials directory.
- Run common OpenFOAM commands (
blockMesh,simpleFoam,pimpleFoam) with live output. - Color-coded console output for stdout, stderr, info, and tutorial messages.
- Fully compatible with OpenFOAM 2506 (adjustable for other versions).
- Clone the repository:
git clone https://github.com/dhruvhaldar/FOAMFlask
cd FOAMFlask- Install dependencies:
pip install -r requirements.txt- Run the server:
python app.py-
Access the web interface: Open your browser and navigate to
http://localhost:5000. -
Set a case directory: Enter a path for your simulation cases. Click
Set Case Dir. -
Set OpenFOAM root directory: Enter a path for your OpenFOAM root directory. Click
Set OpenFOAM Root. -
Load a tutorial: Select a tutorial from the dropdown. Click
Load Tutorial. The tutorial will be copied to your selected case directory. -
Run OpenFOAM commands: Use the buttons (blockMesh, simpleFoam, pimpleFoam) to execute commands. Live output is shown in the console panel.
FOAMFlask/
├── app.py # Main Flask application
├── case_config.json # Stores the last used CASE_ROOT
├── static/
│ ├── FOAMFlask_frontend.html # HTML template
│ └── js/FOAMFlask_frontend.js # JavaScript logic
├── my-py-env/ # Optional: local Python virtual environment
├── requirements.txt # Python dependencies
└── README.md # This file

FOAMFlask is released under the GPLv3 License.
FOAMFlask includes a powerful realtime plotting system that visualizes OpenFOAM simulation data as it runs.
- Universal Compatibility: Works with all OpenFOAM cases (incompressible, compressible, multiphase, etc.)
- Automatic Field Detection: Automatically detects and plots available fields (p, U, nut, nuTilda, k, epsilon, omega, T, etc.)
- Realtime Updates: Plots update every 2 seconds during simulation
-
Multiple Plot Types:
- Pressure vs Time
- Velocity components (Ux, Uy, Uz) and magnitude
- Turbulence properties (nut, nuTilda, k, epsilon, omega)
- Residuals (logarithmic scale)
-
Aerodynamic Analysis (optional):
- Pressure coefficient (Cp)
- 3D velocity profiles
- Load a tutorial case
- Click "Show Plots" to enable realtime plotting
- Run your OpenFOAM command (blockMesh, simpleFoam, etc.)
- Watch the plots update in realtime
- For aerodynamic cases, click "Show Aero Plots" for additional analysis
The plotting system uses:
- Plotly.js for interactive browser-based plots (no external software needed)
-
Custom OpenFOAM parser in
realtime_plots.pythat reads field files - Flask API endpoints for serving plot data
- Automatic field parsing for both uniform and nonuniform fields
python3 -m venv my-python313-venv-linuxpython -m venv my-python313-venv-winsource my-python313-venv-linux/bin/activatemy-python313-venv-win\Scripts\activate./my-python313-venv-linux/bin/python3.13 -m pip install -r requirements.txt.\my-python313-venv-win\Scripts\python.exe -m pip install -r requirements.txt./my-python313-venv-linux/bin/python3.13 app.py.\my-python313-venv-win\Scripts\python.exe app.pyGithub-flavored Markdown is already generated under docs directory as app.md and build_utils.md.
To generate Python-related API documentation, run the following command:
python -m pdoc --html --force --output-dir docs app.py
python -m pdoc --html --force --output-dir docs build_utils.py
Stored under docs directory as app.html and build_utils.html