Abstract
Anvil is a novel open-source Python framework that streamlines the integration of 3D design (CAD) and fluid dynamics simulation (CFD). By leveraging FreeCAD and OpenFOAM alongside AI-driven Bayesian Optimization, Anvil automates the traditionally manual and fragmented process of shape optimization. This framework enables engineers to discover high-performance designs with significantly fewer simulations, addressing major bottlenecks in tool interoperability and computational expense.
Introduction
In modern engineering, shape optimization—essential for designing aerodynamic vehicles or efficient underwater drones—is often a disjointed and costly endeavor. The workflow typically involves manual CAD modification, complex CFD setup, and iterative analysis, often requiring "human-in-the-loop" intervention for data transfer between incompatible tools. Furthermore, high-fidelity fluid simulations are computationally expensive, making exhaustive searches impractical. While commercial integrated suites exist, their high licensing fees often exclude many researchers. Anvil addresses these challenges by providing an automated, open-source "glue" between CAD, CFD, and optimization algorithms.
The Anvil Framework
Anvil operates across three primary modes: Data Generation, CFD Evaluation, and Shape Optimization. It integrates several key components into a unified pipeline:
- Parametric CAD (FreeCAD): Anvil utilizes "seed designs" where geometry is programmatically controlled via spreadsheets, allowing for automated shape morphing.
- Automated CFD (OpenFOAM): The framework automates meshing and solving. A standout feature is its "self-healing" auto-meshing, which detects simulation failures and iteratively refines the mesh until success is achieved.
- AI-Driven Optimization: Bayesian Optimization (via GpyOpt) is used to build surrogate models of the design space, intelligently selecting the most promising shapes to test next.
Implementation and Key Insights
A core innovation in Anvil is the use of FreeCAD’s internal spreadsheet functionality as an API. This standardizes the interaction between Python scripts and complex 3D geometry, bypassing the need to manage underlying topological constraints for every new design. Additionally, the framework uses JSON configuration files to define parameters, ensuring experiments are reproducible and standardized.
The efficiency of the system is largely due to its sampling methods. By employing Bayesian Optimization, Anvil can reach optimal designs with a fraction of the samples required by traditional methods. For instance, in underwater vehicle hull optimization, the system converged on an ideal shape in just 50 iterations.
Experimental Validation
The authors validated Anvil across multiple engineering domains, demonstrating its versatility:
- Unmanned Underwater Vehicles (UUV): Optimized a 1-meter hull for minimal drag within a 50-iteration budget.
- Land Vehicles: Analyzed steady-state flow on "Cybertruck-style" geometries to identify drag points.
- Aerial Vehicles (UAV): Simulated complex quad-propeller winged drones at high speeds (50 m/s).
Conclusion and Future Work
Anvil represents a significant step toward "hands-off" engineering automation. While currently limited to subsonic flows and problems with fewer than 20 dimensions, it provides a robust foundation for scientific machine learning and automated design. Future developments will focus on extending the physics models to transonic and supersonic regimes, implementing formal mesh convergence tests, and incorporating more advanced sampling techniques for higher-dimensional design spaces. The framework is fully open-source and available for the research community.
Summary updated