[{"data":1,"prerenderedAt":458},["ShallowReactive",2],{"content-query-To9TAWiuUQ":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"body":13,"_type":452,"_id":453,"_source":454,"_file":455,"_stem":456,"_extension":457},"/news/en/2768","en",false,"","Idea Sharing (37): An Analysis on Learning Mesh-Based Simulation with Graph Networks","Mesh-based simulations are the core of complex physical system modeling.","2023-08-29","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2023/09/14/0b42eb758e454cd393328e7fd432b079.png","news",{"type":14,"children":15,"toc":449},"root",[16,24,30,35,40,48,53,88,93,164,230,235,242,249,254,284,352,375,380,385,392,408,413,418,423,428,439],{"type":17,"tag":18,"props":19,"children":21},"element","h1",{"id":20},"idea-sharing-37-an-analysis-on-learning-mesh-based-simulation-with-graph-networks",[22],{"type":23,"value":8},"text",{"type":17,"tag":25,"props":26,"children":27},"p",{},[28],{"type":23,"value":29},"1. Background",{"type":17,"tag":25,"props":31,"children":32},{},[33],{"type":23,"value":34},"Mesh-based simulations are the core of complex physical system modeling. Because it is very expensive to run high-dimensional scientific simulations, we need to adapt the mesh resolution and powerful numerical integration methods to strike a balance between accuracy and efficiency. And using AI to quickly obtain flow field information based on geometric shapes becomes particularly important. In high-performance computing, there are structured meshes and unstructured meshes for computing in complex scenarios. For actual engineering scenarios, as shapes become complex, unstructured meshes gradually become the mainstream in numerical computing. Given that the interior nodes in an unstructured mesh have varying neighborhoods, and may be of different shapes, the unstructured mesh cannot be converted into a regular tensor for representation, and therefore, geometry and flow fields cannot be mapped by using convolutional neural networks (CNNs). Graph neural networks (CNNs), instead, need to be used to process such unstructured data. DeepMind introduced MeshGraphNets[1] to predict flow fields in unstructured meshes.",{"type":17,"tag":25,"props":36,"children":37},{},[38],{"type":23,"value":39},"2. Network Architecture",{"type":17,"tag":25,"props":41,"children":42},{},[43],{"type":17,"tag":44,"props":45,"children":47},"img",{"alt":7,"src":46},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2023/09/14/5e5d538a47da4fae89add76003071ddf.png",[],{"type":17,"tag":25,"props":49,"children":50},{},[51],{"type":23,"value":52},"Figure 1 MeshGraphNets network architecture",{"type":17,"tag":25,"props":54,"children":55},{},[56,58,64,66,71,73,78,80,86],{"type":23,"value":57},"The model uses the Encoder-Processor-Decoder architecture for training and can be repeatedly iterated to generate long-term trajectories during inference. For the input mesh ",{"type":17,"tag":59,"props":60,"children":61},"strong",{},[62],{"type":23,"value":63},"M(t) (M(t) = (V, E^M))",{"type":23,"value":65},", which indicates that the simulation mesh at time ",{"type":17,"tag":59,"props":67,"children":68},{},[69],{"type":23,"value":70},"t",{"type":23,"value":72}," has ",{"type":17,"tag":59,"props":74,"children":75},{},[76],{"type":23,"value":77},"V",{"type":23,"value":79}," nodes and ",{"type":17,"tag":81,"props":82,"children":83},"em",{},[84],{"type":23,"value":85},"E^M",{"type":23,"value":87}," edges, the encoder transforms the mesh into a graph, adding extra world-space edges. The processor updates all node and edge embeddings through several rounds of message passing along mesh edges and world edges. The decoder extracts the features of each node and updates the mesh to generate M(t+1) at the next time",{"type":17,"tag":25,"props":89,"children":90},{},[91],{"type":23,"value":92},"2.1 Encoder",{"type":17,"tag":25,"props":94,"children":95},{},[96,98,103,105,110,112,116,118,122,124,128,130,134,136,141,143,148,150,155,157,162],{"type":23,"value":97},"The encoder encodes the current mesh ",{"type":17,"tag":59,"props":99,"children":100},{},[101],{"type":23,"value":102},"M(t)",{"type":23,"value":104}," into a multi-graph ",{"type":17,"tag":59,"props":106,"children":107},{},[108],{"type":23,"value":109},"G = (V, E^M, E^M)",{"type":23,"value":111},". Mesh nodes are demoted as ",{"type":17,"tag":59,"props":113,"children":114},{},[115],{"type":23,"value":77},{"type":23,"value":117},", and connection lines between the mesh modes are edges ",{"type":17,"tag":59,"props":119,"children":120},{},[121],{"type":23,"value":85},{"type":23,"value":123},". The two can be used to calculate the internal dynamics of the mesh. For Lagrangian systems, world edges ",{"type":17,"tag":59,"props":125,"children":126},{},[127],{"type":23,"value":85},{"type":23,"value":129}," are added to learn the external dynamics, such as (self-) collision and contact. World edges ",{"type":17,"tag":59,"props":131,"children":132},{},[133],{"type":23,"value":85},{"type":23,"value":135}," are created by spatial proximity: that is, given that the minimum radius of the mesh edges is ",{"type":17,"tag":59,"props":137,"children":138},{},[139],{"type":23,"value":140},"r^W",{"type":23,"value":142},", we add a world edge between nodes ",{"type":17,"tag":59,"props":144,"children":145},{},[146],{"type":23,"value":147},"i",{"type":23,"value":149}," and ",{"type":17,"tag":59,"props":151,"children":152},{},[153],{"type":23,"value":154},"j",{"type":23,"value":156}," if ",{"type":17,"tag":59,"props":158,"children":159},{},[160],{"type":23,"value":161},"|x(i)-x(j)| \u003C r^W",{"type":23,"value":163},", excluding node pairs already connected in the mesh.",{"type":17,"tag":25,"props":165,"children":166},{},[167,169,174,176,181,183,188,190,195,197,202,204,208,209,214,216,221,223,228],{"type":23,"value":168},"Then, we encode the features into graph nodes and edges. To achieve spatial equivariance, positional features are provided as relative edge features. We encode the relative displacement vector ",{"type":17,"tag":59,"props":170,"children":171},{},[172],{"type":23,"value":173},"u(i)(j) = u(i)-u(j)",{"type":23,"value":175}," in the mesh space and its norm ",{"type":17,"tag":59,"props":177,"children":178},{},[179],{"type":23,"value":180},"|u(i)(j)|",{"type":23,"value":182}," into the mesh edges ",{"type":17,"tag":59,"props":184,"children":185},{},[186],{"type":23,"value":187},"e(i)(j)^M∈E^M",{"type":23,"value":189},", and then encode the relative world-space displacement vector ",{"type":17,"tag":59,"props":191,"children":192},{},[193],{"type":23,"value":194},"x(i)(j)",{"type":23,"value":196}," and its norm ",{"type":17,"tag":59,"props":198,"children":199},{},[200],{"type":23,"value":201},"|x(i)(j)|",{"type":23,"value":203}," into ",{"type":17,"tag":59,"props":205,"children":206},{},[207],{"type":23,"value":187},{"type":23,"value":149},{"type":17,"tag":59,"props":210,"children":211},{},[212],{"type":23,"value":213},"e(i)(j)^W∈E^W",{"type":23,"value":215},", respectively. The remaining dynamic features ",{"type":17,"tag":59,"props":217,"children":218},{},[219],{"type":23,"value":220},"q(i)",{"type":23,"value":222}," are encoded into node features ",{"type":17,"tag":59,"props":224,"children":225},{},[226],{"type":23,"value":227},"v(i)",{"type":23,"value":229},".",{"type":17,"tag":25,"props":231,"children":232},{},[233],{"type":23,"value":234},"Finally, the above features are encoded into a latent vector with a length of 128, and the network structure is multi-layer perceptron (MLP).",{"type":17,"tag":25,"props":236,"children":237},{},[238],{"type":17,"tag":44,"props":239,"children":241},{"alt":7,"src":240},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2023/09/14/d35c7e13196d451b84f4096f25422a83.png",[],{"type":17,"tag":25,"props":243,"children":244},{},[245],{"type":17,"tag":44,"props":246,"children":248},{"alt":7,"src":247},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2023/09/14/ec9abed3d78e4ab28bf8fcbd9f17f761.png",[],{"type":17,"tag":25,"props":250,"children":251},{},[252],{"type":23,"value":253},"2.1 Decoder and State Updater",{"type":17,"tag":25,"props":255,"children":256},{},[257,259,264,266,270,272,276,278,283],{"type":23,"value":258},"To predict the state at time ",{"type":17,"tag":81,"props":260,"children":261},{},[262],{"type":23,"value":263},"t+1",{"type":23,"value":265}," from the input at time ",{"type":17,"tag":81,"props":267,"children":268},{},[269],{"type":23,"value":70},{"type":23,"value":271}," moment, the decoder uses an MLP to convert the latent node features ",{"type":17,"tag":59,"props":273,"children":274},{},[275],{"type":23,"value":227},{"type":23,"value":277}," after the final processing into one or more output features ",{"type":17,"tag":59,"props":279,"children":280},{},[281],{"type":23,"value":282},"p(i)",{"type":23,"value":229},{"type":17,"tag":25,"props":285,"children":286},{},[287,289,293,295,299,301,306,308,312,314,319,321,326,328,332,334,338,340,344,346,351],{"type":23,"value":288},"We can take the output features ",{"type":17,"tag":59,"props":290,"children":291},{},[292],{"type":23,"value":282},{"type":23,"value":294}," as higher-order derivatives of ",{"type":17,"tag":59,"props":296,"children":297},{},[298],{"type":23,"value":220},{"type":23,"value":300}," and integrate them to calculate the dynamical quantity ",{"type":17,"tag":59,"props":302,"children":303},{},[304],{"type":23,"value":305},"q(i)^(t+1)",{"type":23,"value":307}," of the next step by using a forward-Euler integrator with △t=1. For first-order systems, the output ",{"type":17,"tag":59,"props":309,"children":310},{},[311],{"type":23,"value":282},{"type":23,"value":313}," is integrated once to update ",{"type":17,"tag":59,"props":315,"children":316},{},[317],{"type":23,"value":318},"q(i)^(t+1) = p(i) + q(i)^t",{"type":23,"value":320},"; while for second-order systems, the integration happens twice: ",{"type":17,"tag":59,"props":322,"children":323},{},[324],{"type":23,"value":325},"q(i)^(t+1) = p(i) + 2q(i)^t – q^(t-1)",{"type":23,"value":327},". The additional output features ",{"type":17,"tag":59,"props":329,"children":330},{},[331],{"type":23,"value":282},{"type":23,"value":333}," are also used to predict auxiliary quantities such as pressure and stress. Finally, the output mesh nodes ",{"type":17,"tag":59,"props":335,"children":336},{},[337],{"type":23,"value":77},{"type":23,"value":339}," are updated using ",{"type":17,"tag":59,"props":341,"children":342},{},[343],{"type":23,"value":305},{"type":23,"value":345}," to generate ",{"type":17,"tag":59,"props":347,"children":348},{},[349],{"type":23,"value":350},"M^(t+1)",{"type":23,"value":229},{"type":17,"tag":25,"props":353,"children":354},{},[355,357,361,363,367,369,374],{"type":23,"value":356},"We train our dynamic model by supervising the output features ",{"type":17,"tag":59,"props":358,"children":359},{},[360],{"type":23,"value":282},{"type":23,"value":362}," of each node. The decoder calculates a L2 loss between ",{"type":17,"tag":59,"props":364,"children":365},{},[366],{"type":23,"value":282},{"type":23,"value":368}," and groundtruth ",{"type":17,"tag":59,"props":370,"children":371},{},[372],{"type":23,"value":373},"p(i)`",{"type":23,"value":229},{"type":17,"tag":25,"props":376,"children":377},{},[378],{"type":23,"value":379},"3. Test Results",{"type":17,"tag":25,"props":381,"children":382},{},[383],{"type":23,"value":384},"The authors of this paper evaluated this model on systems with different underlying PDEs, including cloth, structural mechanics, incompressible and compressible fluids. The edge length of the dataset AIRFOIL ranges from 2 x 10^-4 m to 3.5 m. In addition, we simulated meshes whose resolution is dynamically changed during a trajectory.",{"type":17,"tag":25,"props":386,"children":387},{},[388],{"type":17,"tag":44,"props":389,"children":391},{"alt":7,"src":390},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2023/09/14/ef981021c842424f94c375052f02f6b2.png",[],{"type":17,"tag":25,"props":393,"children":394},{},[395,397,406],{"type":23,"value":396},"The above table shows the performance and precision comparison between MeshGraphNets and traditional methods used in different datasets. For different datasets, MeshGraphNets delivers hundreds of times better performance. However, as the number of simulation steps increases, errors accumulate, results fluctuate, and the accuracy decreases accordingly. This problem is resolved in DeepMind's ICLR paper ",{"type":17,"tag":398,"props":399,"children":403},"a",{"href":400,"rel":401},"https://arxiv.org/abs/2201.00911",[402],"nofollow",[404],{"type":23,"value":405},"Predicting Physics in Mesh-reduced Space with Temporal Attention",{"type":23,"value":407}," in 2022.",{"type":17,"tag":25,"props":409,"children":410},{},[411],{"type":23,"value":412},"MeshGraphNets also generalizes well outside the training distribution, with respect to underlying system parameters, mesh shapes, and mesh sizes. This is because the architecture using relative coding on graphs has been proved to be very conducive to generalization. In the AIRFOIL dataset, the model is verified at steeper angles (-35° to 35° vs. -25° to 25° in the training set) and higher Mach number (0.7 to 0.9 vs. 0.2 to 0.7 in the training set). In both cases, the predictions remain reasonable and RMSE increases slightly from 11.5 (training) to 12.4 for steeper angles and 13.1 for higher Mach number. In addition, a model is trained on the FLAGDYNAMIC variant dataset, where the wind speed and direction change between trajectories, but remain unchanged in each trajectory. During inference, the model allows free change of the wind speed and direction. This shows that the physical laws learned by this model can infer untrained parameter ranges.",{"type":17,"tag":25,"props":414,"children":415},{},[416],{"type":23,"value":417},"4. Summary",{"type":17,"tag":25,"props":419,"children":420},{},[421],{"type":23,"value":422},"MeshGraphNets is a general mesh-based method that can accurately and effectively model a wide range of physical systems. It has good generalization capability and can be scaled up during inference. This method can achieve more efficient simulation than traditional solvers, and is useful for design optimization or optimal control tasks because it is differential. The emergence of MeshGraphNets will trigger better and updated network architectures for fast prediction of flow fields in structured and unstructured meshes, laying a solid foundation for further reducing accumulated errors and improving generalization.",{"type":17,"tag":25,"props":424,"children":425},{},[426],{"type":23,"value":427},"References",{"type":17,"tag":25,"props":429,"children":430},{},[431,433],{"type":23,"value":432},"[1] Pfaff T, Fortunato M, Sanchez-Gonzalez A, et al. Learning mesh-based simulation with graph networks[J]. arXiv preprint arXiv:2010.03409, 2020. ",{"type":17,"tag":398,"props":434,"children":437},{"href":435,"rel":436},"https://arxiv.org/abs/2010.03409",[402],[438],{"type":23,"value":435},{"type":17,"tag":25,"props":440,"children":441},{},[442,444],{"type":23,"value":443},"[2] Han X, Gao H, Pfaff T, et al. Predicting physics in mesh-reduced space with temporal attention[J]. arXiv preprint arXiv:2201.09113, 2022. ",{"type":17,"tag":398,"props":445,"children":447},{"href":400,"rel":446},[402],[448],{"type":23,"value":400},{"title":7,"searchDepth":450,"depth":450,"links":451},4,[],"markdown","content:news:en:2768.md","content","news/en/2768.md","news/en/2768","md",1776506046084]