Creating a New Solver in OpenFOAM: Implementing AMR Mesh Refinement for Combustion Simulations
Combustion simulations are computationally demanding, especially when high resolution is required in critical regions like flame fronts or areas with steep gradients. Refining the entire mesh is often inefficient and costly. That’s where Adaptive Mesh Refinement (AMR) comes in a technique that dynamically refines only the regions that need it, saving computational resources while maintaining accuracy.
In this article, I’ll walk you through how I implemented AMR functionality into OpenFOAM’s solver, creating a new solver called .
The Problem: Why AMR?
Combustion simulations often require high resolution in localized areas, such as flame fronts or regions with high velocity gradients. However, refining the entire mesh is computationally expensive. AMR solves this by dynamically refining only the critical regions and coarsening the rest, ensuring optimal resource utilization.
The Solution: Creating amrReactingFoam
The goal was to integrate AMR functionality from into . Here’s how it was done:
1. Adding AMR Features
The dynamic mesh refinement algorithms and mesh update functions from were integrated into . Key changes in the source code included:
2. Including Necessary Libraries
The and files were updated to include the required libraries for dynamic mesh handling:
3. Introducing a New Scalar Field
A new scalar field for the velocity gradient was added to serve as a refinement criterion:
Compiling the New Solver
The new solver was compiled using OpenFOAM’s build system:
Copy to .
Modify and .
Compile with .
Testing the Solver: Case Setup and Results
The solver was tested using the tutorial. Key steps included:
1. Modifying the Dynamic Mesh File
The file was updated to enable AMR:
2. Results
The results, visualized in ParaView, demonstrated effective mesh refinement in regions with high velocity gradients. A side-by-side comparison of the mesh with and without AMR highlighted the solver’s capabilities.
Why This Matters
The implementation of AMR in is a game-changer for combustion simulations. By enabling localized mesh refinement, reduces computational costs while maintaining high accuracy in critical regions. This is particularly valuable for large-scale simulations, where efficiency is crucial.
Future Work
While is already a powerful tool, there’s always room for improvement. Future enhancements could include:
Dynamic Load Balancing: Optimizing parallel computation by evenly distributing the computational load across processors.
Support for Complex Combustion Models: Extending the solver to handle advanced scenarios like turbulent flame propagation or multi-phase reactions.
Conclusion
Creating was a challenging but rewarding project. By integrating AMR functionality into , we’ve developed a solver that combines computational efficiency with high accuracy, making it a valuable tool for combustion simulations. I’m excited to see how this work can be further improved and applied to real-world problems.
If you’re working on similar projects or have questions about implementing AMR in OpenFOAM, feel free to reach out. Let’s keep pushing the boundaries of computational fluid dynamics!
Acoustics | Aeroacoustics | Measurements | Wind turbine | PhD candidate | CFD | Casual academic | Learning advisor
7moThanks for sharing
Combustion Aero Engineer @TEI - TUSAŞ Engine Industries, Inc.
7moGreat work! A problem with current reactingFlow solver is to access reaction rates of chemical mechanisms. Reaction rate gradients of certain heat-release reactions could be an ideal way to detect flame front and drive amr. does your future plan include such investigations?
Thermofluids / Computational modelling & CFD | Advanced Researcher - Eurecat
7moWhat do you think are good candidates to set the refinement criterion for combustion simulations? I am thinking about the gradient of the temperature... or something related to the local temperature + pressure + fuel fraction, which automatically refines if the cell is about to enter to combustion.... what do you think?
Computational Fluid Dynamics | Scientific Computing
7moAMR tutorial in OpenFOAM: https://github.com/OpenFOAM/OpenFOAM-dev/tree/master/tutorials/incompressibleVoF/damBreak3D Runtime load balancing (which can be combined with AMR): https://github.com/OpenFOAM/OpenFOAM-dev/tree/master/tutorials/multicomponentFluid/aachenBomb You can use the velocity gradient magnitude field by using grad() function object on U, and mag() function object on grad(U), and specifying mag(grad(U)) field in dynamicMeshDict.