Machine Learning for Optimized Mesh Generation

Computational Fluid Dynamics (CFD) and other computational sciences rely heavily on mesh generation for accurate simulations. Traditional methods of mesh optimization, such as goal-oriented adaptive mesh refinement, can be computationally expensive. Machine learning offers a promising alternative for generating optimal meshes efficiently. This article explores the application of machine learning, specifically artificial neural networks (ANNs) and deep neural networks (DNNs), to predict optimal mesh densities and guide mesh generation software.

The Importance of Meshes in Computational Science

Meshes are essential for representing 3D assets in various applications. In CFD, simulations often require fine and complex meshes to accurately resolve physical effects. The efficiency of CFD algorithms is directly related to the quality of the underlying mesh discretization, making optimal mesh generation crucial. Unstructured meshes are commonly used in CFD, computational mechanics, and finite element (FE) and finite volume (FV) methods for solving partial differential equations (PDEs), especially in domains with complex geometries.

Traditional Mesh Generation and its Limitations

The conventional approach to obtaining high-quality meshes involves multiple steps. Initially, a solution is computed on a coarse uniform mesh. Then, a post-processing step, known as a posteriori error estimation, is performed. This involves solving auxiliary problems to estimate the local error in the initial solution. These local errors are used to determine areas where the mesh density needs to be increased (mesh refinement) or decreased (mesh coarsening). A new mesh is generated based on this error estimate, and a new FE solution is computed. This process may be repeated until a satisfactory solution is achieved.

A necessary requirement for efficient a posteriori error estimators is that they should be relatively cheap to compute while providing reliable information about the error in a computed solution. However, even with efficient error estimators, this iterative process can be computationally demanding.

Machine Learning Approach to Mesh Generation

To improve the efficiency of non-uniform mesh generation, a data-driven method can be used. This method involves computing and saving high-quality mesh density distributions obtained by FEM, followed by accurate error estimation, as a pre-processing step. Once a model learns from this data, it can predict a good mesh density distribution without needing an FE solution and error estimator.

Read also: Revolutionizing Remote Monitoring

The framework developed is based around training an artificial neural network (ANN) to guide standard mesh generation software, based upon a prediction of the required local mesh density throughout the domain. The training regime that is proposed is based upon the use of a posteriori error estimation.

MeshingNet: A Deep Learning Model for Mesh Density Prediction

A DNN model, MeshingNet, can be used to learn from the a posteriori error estimate on an initial coarse uniform mesh and predict non-uniform mesh density for refinement. This eliminates the need for solving an FE system or computing an a posteriori error estimate during the mesh generation process. MeshingNet is trained using an accurate error estimation strategy, which can be computationally expensive but is only performed offline. After training, MeshingNet can quickly generate high-quality meshes using standard software.

The goal is to provide a standard FE solver with a high-quality mesh, as greater variation in the quality of predictions can be tolerated for the mesh than for the solution itself.

Training Data and Network Architecture

The training data is generated by computing high-accuracy solutions (HASs) on high-density uniform meshes (HDUMs) and lower accuracy solutions (LASs) on low-density uniform meshes (LDUMs). An a posteriori error distribution E(X) is computed based upon interpolation between these solutions, and the area upper bound A(X) is computed for refinement. The training data is enriched by combining different geometries with different parameters and boundary conditions (BCs).

MeshingNet takes as input the geometry, BCs, and material properties, and outputs the predicted local area upper bound A(X). The mapping is learned by MeshingNet. After training, MeshingNet is used to predict A(X) over a new geometry with a LDUM. The final mesh is generated by refining the LDUM non-uniformly, guided by the predicted target local area upper bound.

Read also: Read more about Computer Vision and Machine Learning

Two types of DNNs are considered: a fully connected network (FCN) and two residual networks (ResNets). To improve and accelerate training, two ResNets are experimented with to enhance FCN. Residual connections can help resolve the vanishing gradient problem in deep networks and improve training.

Flexibility and Integration

MeshingNet is designed to be agnostic about both the mesh generator and the particular FE/FV solver used. It is intended to work with existing methods. The a posteriori error can be computed using any user-defined norm.

Meshtron: An Autoregressive Mesh Generator

Meshtron is an autoregressive model that generates mesh tokens and provides a data-driven solution for generating intricate, artist-like meshes. It uses an Hourglass Transformer architecture and sliding window attention to save computation and memory. The control input of Meshtron is implemented with cross-attention, making it easily adaptable to other types of inputs such as images and additional control parameters. Meshtron generates meshes of detailed, complex 3D objects at unprecedented levels of resolution and fidelity, closely resembling those created by professional artists.

Machine Learning on Meshes: A Course Overview

A course on machine learning techniques on meshes would cover the fundamentals, starting with an introduction to machine learning on regular structures (e.g., images) and their generalization to the irregular mesh structure. The focus is on techniques directly defined on surface triangle meshes, which are commonly used in graphics. The course would cover the building blocks of a mesh convolutional neural network, including convolution, pooling, regularization, and loss functions, and how to apply convolutional networks to classic geometry processing tasks such as geometric texture synthesis, shape classification, and subdivision.

Example: Mesh CNN for Classification

A basic example of using mesh CNN to classify meshes involves defining a mesh CNN consisting of convolution layers, global pooling, and fully connected layers. In each mesh convolution, the input is a n-dimensional function defined on each edge. The first step in mesh convolution is to re-index this function into a format for fast convolutions. Mesh convolution can then be performed with 2D convolution, where each convolution filter has size n by 5 and outputs a scalar value. The rest of the pipeline is similar to image-based classification networks.

Read also: Boosting Algorithms Explained

Case Study: 2D Wind Tunnel Simulations

The concept of using machine learning for mesh generation can be validated using 2D wind tunnel simulations. By training a convolutional network on a dataset of optimized meshes, the network can predict optimal mesh densities given arbitrary geometries. For example, using a training set of 20,000 simulations, accuracies of more than 98.7% can be achieved. The resulting predictions of optimal meshes can then be used as input for any mesh generation and CFD tool.

Potential Challenges and Considerations

Despite the potential benefits, there are challenges to consider. One concern is the cost of AI-assisted meshing. While AI could automate mesh generation, companies may charge a premium for this service, potentially negating any cost savings. Additionally, developing AI-assisted tools for CFD requires overcoming technical barriers and may take time. There is also the question of whether AI for meshing is more difficult than non-AI approaches, especially with the emergence of Physics-Informed Neural Networks (PINNs). Furthermore, some argue that if an AI could create geometry in the first place, it would be more beneficial for CAD applications.

tags: #machine #learning #mesh #generation

Popular posts: