How andreweiner/machine-learning-applied-to-cfd works
Project Type and Purpose
• This is a specialized application that combines CFD with various ML techniques (supervised, unsupervised, and reinforcement learning).
• Its purpose is to showcase how ML algorithms can be integrated into different steps of CFD studies—whether pre-, run-time, or post-processing (such as geometry/mesh generation, dynamic boundary conditions, and result analysis).
File Structure
• The directory tree shows clear divisions:
• An “OpenFOAM” directory that contains CFD cases (e.g., “moving_boundary” and “moving_boundary_wedge”) and an “apps” folder hosting a custom PyTorch displacement application. These contain all the simulation setup files (case files, control dictionaries, mesh definitions, etc.) and source code for OpenFOAM’s integration of PyTorch.
• A “notebooks” folder that hosts multiple Jupyter notebooks and helper modules for ML experiments and analysis.
• A “data” folder with input datasets (CSV and pickle files) that are likely used for training and evaluation.
• Support files like the “runContainer.sh” script to launch a Docker container configured for OpenFOAM+PyTorch, and ancillary documentation and literature files.
Key Components
a. ML/Analysis Environment:
• Components: Jupyter Notebooks, Python libraries (NumPy, Pandas, PyTorch, Matplotlib, Scikit-Learn).
b. Simulation Environment (CFD):
• Components: OpenFOAM cases (“moving_boundary” & “moving_boundary_wedge”), custom application code (pyTorchDisplacement… files), dynamic mesh/control dictionaries.
• Role: Execute the CFD simulations integrating machine learning (for instance, runtime ML components for dynamic boundary conditions).
c. Data Management:
• Components: “data” directory (input CSV files, pickle models, regimes data).
• Role: Provide datasets for training ML models and for validating CFD simulations.
d. Execution/Deployment Environment:
• Components: Docker container (configured via runContainer.sh and a Docker image on Dockerhub) for compiling and executing OpenFOAM+PyTorch applications.
• Role: Ensure reproducible CFD simulation runs and proper integration with ML apps.
Relationships and Interactions
• Data flows from the “data” directory to both “notebooks” (for training/analysis) and the CFD cases (to set up simulation parameters or validate simulation results).
• The Jupyter environment processes and visualizes ML models coming from experiments on CFD data.
• CFD simulations run within the Docker-based OpenFOAM container may ingest ML predictions (from pyTorchDisplacement modules) that affect boundary conditions.
• Feedback loops could be indicated where CFD simulation outputs are further used to improve ML models in an iterative fashion.
Architectural Patterns
• Separation of concerns: Clear boundary between CFD simulation (OpenFOAM) and ML experimentation (Python notebooks and PyTorch code).
• Micro-environment encapsulation: The use of Docker for containerizing the OpenFOAM+PyTorch simulation environment.
• Modular design: Distinct folders for simulation cases, ML notebooks, and data, facilitating isolated development and testing of each piece.