Anvil: An integration of artificial intelligence, sampling techniques, and a combined CAD-CFD tool

Harsh Vardhan, Umesh Timalsina, Michael Sandborn, David Hyde, Péter Völgyesi, Janos Sztipanovits

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.
Figure 1: The Anvil framework architecture, illustrating the integration of configuration, parametric CAD, optimizers, and CFD simulation.

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:

  1. Unmanned Underwater Vehicles (UUV): Optimized a 1-meter hull for minimal drag within a 50-iteration budget.
  2. Land Vehicles: Analyzed steady-state flow on "Cybertruck-style" geometries to identify drag points.
  3. Aerial Vehicles (UAV): Simulated complex quad-propeller winged drones at high speeds (50 m/s).
Figure 2: (a) CAD model of a UUV hull; (b) Velocity magnitude visualization; (c) Pressure field visualization from CFD results.

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

Abstract

In this work, we introduce an open-source integrated CAD-CFD tool, Anvil, which combines FreeCAD for CAD modeling and OpenFOAM for CFD analysis, along with an AI-based optimization method (Bayesian optimization) and other sampling algorithms. Anvil serves as a scientific machine learning tool for shape optimization in three modes: data generation, CFD evaluation, and shape optimization. In data generation mode, it automatically runs CFD evaluations and generates data for training a surrogate model. In optimization mode, it searches for the optimal design under given requirements and optimization metrics. In CFD mode, a single CAD file can be evaluated with a single OpenFOAM run. To use Anvil, experimenters provide a JSON configuration file and a parametric CAD seed design. Anvil can be used to study solid-fluid dynamics for any subsonic flow conditions and has been demonstrated in various simulation and optimization use cases. The open-source code for the tool, installation process, artifacts (such as CAD seed designs and example STL models), experimentation results, and detailed documentation can be found at https://github.com/symbench/Anvil.
BibTeX
@misc{vardhan2024anvil,
  author = {Harsh Vardhan and Umesh Timalsina and Michael Sandborn and David Hyde and Péter Völgyesi and Janos Sztipanovits},
  title = {{Anvil: An integration of artificial intelligence, sampling techniques, and a combined CAD-CFD tool}},
  year = {2024},
  eprint = {2407.02519},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.02519},
}
Figure