# A GNN-BASED FRAMEWORK TO IDENTIFY FLOW PHENOMENA ON UNSTRUCTURED MESHES -PARCFD2023

L. Wang, Y. Fournier, Jf. Wald, Youssef Mesri

► To cite this version:

L. Wang, Y. Fournier, Jf. Wald, Youssef Mesri. A GNN-BASED FRAMEWORK TO IDENTIFY FLOW PHENOMENA ON UNSTRUCTURED MESHES -PARCFD2023. 33rd Parallel CFD International Conference, May 2023, Cuenca, Ecuador. hal-04510114

HAL Id: hal-04510114

https://hal.science/hal-04510114v1

Submitted on 18 Mar 2024

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons CC BY 4.0 - Attribution - International License
# A GNN-BASED FRAMEWORK TO IDENTIFY FLOW PHENOMENA ON UNSTRUCTURED MESHES – PARCFD2023

L. Wang*†, Y. Fournier†, JF. Wald† AND Y. Mesri*

* Electricité de France
Dpt. Fluid Mechanics, Energy, Environment (MFEE)
6 quai Watier, Chatou, France
lianfa.wang@edf.fr, yvan.fournier@edf.fr, jean-francois-j.wald@edf.fr

†Mines ParisTech — PSL University
Centre de mise en forme des matériaux (CEMEF)
06904, CS 10207 rue Claude Daunesse, Sophia Antipolis, France
youssef.mesri@mines-paristech.fr

**Key words:** Graph neural networks, Flow phenomenon identification, Unstructured mesh

**Abstract.** Driven by the abundant data generated from Computational Fluid Dynamics (CFD) simulations, machine learning (ML) methods surpass the deterministic criteria on flow phenomena identification in the way that is independent of case-by-case thresholds by combining the flow field properties and the topological distribution of the phenomena. The current most popular and successful ML models based on convolutional neural networks are limited to structured meshes and unable to directly digest the data generated from unstructured meshes which are more widely used in the real industrial CFD simulations. We propose a framework based on graph neural networks with the proposed Fast Gaussian Mixture Model as the convolution kernel and U-Net architecture to detect flow phenomena resided on a graph hierarchy generated by the algebraic multigrid method embedded in the open-source CFD solver, code_saturne. We demonstrate the superiority of the proposed kernel and U-Net architecture, along with the generality of the framework to unstructured mesh and unseen case on detecting the vortexes behind the backward-facing step. Our proposed framework can be trivially extended to detect other flow phenomena in 3D cases which is ongoing work.

## 1 INTRODUCTION

Flow phenomena identification is of great importance in Computational Fluid Dynamics (CFD) simulations of both engineering design and facility maintenance stages. For instance, thermal stratification may lead to thermal fatigue which damages elements in nuclear reactor circuits; generations of aerodynamic engineers endeavor to design the device to delay boundary-layer separation to decrease drag force; vortex detachment is the source of fluid induced vibrations which are detrimental to structures and produce
noise. Albeit its importance, no universal single criterion for a certain flow phenomenon makes it possible to precisely identify its position in CFD results since it depends on many factors including flow regime, specific geometry encountered and etc. On the other hand, many machine learning methods, especially those of computer vision which can detect topological features, have shown the great potential to overcome the aforementioned problems [1, 2]. In this article, we propose a GNN-based framework to identify flow phenomena in CFD results with the proposed Fast-GMM kernel and U-Net architecture which uses the graph hierarchy generated from Algebraic Multigrid method (AMG) from code_saturne, an open-source Finite Volume Method (FVM) based CFD software code_saturne, developed by Electricité de France (EDF).

# 2 Methodology

## 2.1 Fast Gaussian mixture model

In order to make the training more efficient and the identified vortex boundaries sharper, several simplifications are made to the original GMM kernel[3] by making an analogy to the traditional CNN kernel. The trainable directions $\mu_k$ are evenly distributed on circumferential directions, their distances are set to unit. The square of the normalized alignment between edge directions $\mathbf{e}_{ij}$ and trainable directions $\mu_k$ is used to further distinguish the well-aligned pairs from not-well-aligned pairs:

$$ \mathbf{w}_k(\mathbf{e}_{ij}) = \left[ \mathrm{Norm} \left( \exp \left( \frac{1}{2} (\mathbf{e}_{ij} - \mu_k)^T (\mathbf{e}_{ij} - \mu_k) \right) \right) \right]^2 \quad (1) $$

The proposed kernel is termed as Fast Gaussian Mixutre Model (Fast-GMM). We keep one direction in the template for the center node and evenly divide $2\pi$ into $k-1$ directions for the neighboring nodes. Since the following trainings done on graphs derived from 2D structured mesh where each center cell has eight neighboring cells, we set the hyperparameter $k = 9$ which is analogous to the 3 × 3 convolution kernel in CNNs.

## 2.2 Architecture

The U-Net architecture first proposed by [4] is adopted because of three merits: 1) computational efficiency, 2) accuracy and 3) stability. A four-level 14-layer U-Net architecture, shown in Fig. 1a, is used for our model.

## 2.3 Graph generation

GNNs perform feature aggregating and updating on the graphs. The transformation from CFD mesh to graph is very straightforward. Each cell in a CFD mesh corresponds to one node in the graph. The edge between two nodes on the graph -corresponds to shared vertex in CFD mesh. The multiple levels in the U-net architecture need a hierarchy of coarsened graphs to down-sample and up-sample the input. We use the the AMG embedded in code_saturne to generate this hierarchy of graphs and the connectivity between two successive graphs. Fig. 1b shows a small portion of each graph generated from 2D
<figure><img src="image_2.png" /><figcaption>Figure 1: U-Net architecture (a) and graph hierarchy details (b).</figcaption></figure>

structured mesh for BFS case. It can be seen that the graphs are evenly coarsened.

## 3 Training and result

The velocity field was selected as the input and the label of the vortex was generated by an automatic vortex labeling algorithm based on random walking on the directed graph. All the models are trained on dataset formed by BFS CFD simulation results at 100 time points with structured mesh for 200 epochs. As shown in Table 1, the Fast-GMM-Unet model achieves highest values for three of four classification evaluation criteria. Its classification performance is comparable to that of CNN-Unet, higher than GMM-Unet and faster than all other GNN-based models.

<table><caption>Table 1: Performance summary of three architectures. (Among CNN-Unet, GMM-Unet, Simp-GMM Unet, SplineCNN-Unet: Green - highest value; Red - lowest value.)</caption><thead><tr><th>No.</th><th>Model</th><th>Accuracy</th><th>Precision</th><th>Recall</th><th>F1 score</th><th>Time/epoch</th></tr></thead><tbody><tr><td>1.</td><td>CNN-Unet</td><td>88.88±0.12</td><td>91.11±1.61</td><td>65.09±1.86</td><td>75.89±0.70</td><td>5.6±0.3s</td></tr><tr><td>2.</td><td>GMM-Unet</td><td>88.58±0.28</td><td>91.15±0.91</td><td>63.80±1.31</td><td>75.04±0.80</td><td>85.5±0.3s</td></tr><tr><td>3.</td><td>Fast-GMM-Unet</td><td>89.62±0.32</td><td>90.94±1.01</td><td>68.27±1.71</td><td>77.97±0.92</td><td>51.4±0.1s</td></tr><tr><td>4.</td><td>SplineCNN-Unet</td><td>88.79±1.20</td><td>89.99±2.91</td><td>65.68±3.05</td><td>75.91±2.78</td><td>125.8±0.1s</td></tr><tr><td>5.</td><td>GCN-Unet</td><td>77.74±1.08</td><td>66.50±1.68</td><td>35.06±7.83</td><td>45.32±7.25</td><td>62.3±0.8s</td></tr></tbody></table>

The vortices on structured mesh identified by different models are shown in Fig.2a. It is clear that the vortices identified by Fast-GMM and SplineCNN kernels are very close to those identified by CNN, while those identified by GMM kernel have diffused vortex boundary and GCN kernel fails to identify separate vortexes. There GNN-based models trained on dataset formed by structured mesh are directly applied to unstructured meshes, shown in Fig. 2b. It is clear that Fast-GMM kernel can identify the vortices with the closest morphology to the ground-truth. The proposed model can also identify Vortices on unseen cases which are not included here due to the page limit.
<figure><img src="image_3.png" /><figcaption>Figure 2: Comparison of the identified vortexes by different models with ground-truth on structured mesh (a) and unstructured mesh (b)</figcaption></figure>

# 4 CONCLUSIONS

We propose a GNN-based machine learning model with U-Net architecture and proposed Fast-GMM kernel to identify the flow phenomena on CFD meshes based on velocity field. The proposed model has the classification performance comparable to CNN model but accepts unstructured mesh. It also generalizes well to unseen cases. Extending current model to 3D cases and other flow phenomena is ongoing work.

# Acknowledgements

This work has been supported by French National Association of Technical Research (CIFRE 2020/0791).

# REFERENCES

[1] Yuekun Yang and Youssef Mesri. Learning by neural networks under physical constraints for simulation in fluid mechanics. *Computers & Fluids*, 248:105632, 2022.

[2] Lianfa Wang, Yvan Fournier, Jean-François Wald, and Youssef Mesri. Improving confidence on cfd by deep learning. In *33rd Parallel CFD International Conference*, 2022.

[3] Federico Monti, Davide Boscaini, Jonathan Masci, Emanuele Rodola, Jan Svoboda, and Michael M Bronstein. Geometric deep learning on graphs and manifolds using mixture model cnns. In *Proceedings of the IEEE conference on computer vision and pattern recognition*, pages 5115–5124, 2017.
[4] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In *International Conference on Medical image computing and computer-assisted intervention*, pages 234–241. Springer, 2015.