Learning Mesh-Based Simulation with Graph Networks

1 INTRODUCTION . State-of-the art modeling of complex physical systems , such as deforming surfaces and volumes , often employs mesh representations to solve the underlying partial differential equations ( PDEs ) . Mesh-based finite element simulations underpin popular methods in structural mechanics [ 31 , 48 ] , aerodynamics [ 13 , 34 ] , electromagnetics [ 32 ] , geophysics [ 35 , 39 ] , and acoustics [ 26 ] . Meshes also support adaptive representations , which enables optimal use of the resource budget by allocating greater resolution to regions of the simulation domain where strong gradients are expected or more accuracy is required , such as the tip of an airfoil in an aerodynamics simulation . Adaptive meshing enables running simulations at accuracy and resolution levels impossible with regular discretization schemes [ 8 , 27 ] ( Figure 3b ) . Despite their advantages , mesh representations have received relatively little attention in machine learning . While meshes are sometimes used for learned geometry processing [ 9 ] and generative models of shapes [ 15 , 29 ] , most work on predicting high-dimensional physical systems focuses on grids , owing to the popularity and hardware support for CNN architectures [ 19 ] . We introduce a method for predicting dynamics of physical systems , which capitalizes on the advantages of adaptive mesh representations . Our method works by encoding the simulation state into a graph , and performing computations in two separate spaces : the mesh-space , spanned by the simulation mesh , and the Euclidean world-space in which the simulation manifold is embedded ( see Figure 3a ) . By passing messages in mesh-space , we can approximate differential operators that underpin the internal dynamics of most physical systems . Message-passing in world-space can estimate external dynamics , not captured by the mesh-space interactions , such as contact and collision . Unstructured irregular meshes , as opposed to regular grids , support learning dynamics which are independent of resolution , allowing variable resolution and scale at runtime . By learning a map of desired resolution over the mesh ( sizing field ) , together with a local remesher , our method can even adaptively change ∗equal contribution Videos of all our experiments can be found at https : //sites.google.com/view/meshgraphnets the discretization during rollouts , budgeting greater computational resources for important regions of the simulation domain . Together , our method allows us to learn the dynamics of vastly different physical systems , from cloth simulation over structural mechanics to fluid dynamics directly from data , providing only very general biases such as spatial equivariance . We demonstrate that by using mesh-space computation we can reliably model materials with a rest state such as elastics , which are challenging for meshfree prediction models [ 37 ] . MESHGRAPHNETS outperform particle- and grid-based baselines , and can generalize to more complex dynamics than those on which it was trained . 2 RELATED WORK . Modelling high-dimensional physics problems with deep learning algorithms has become an area of great research interest in fields such as computational fluid dynamics . High resolution simulations are often very slow , and learned models can provide faster predictions , reducing turnaround time for workflows in engineering and science [ 16 , 6 , 49 , 20 , 1 ] . Short run times are also a desirable property for fluid simulation in visualization and graphics [ 46 , 41 , 47 ] . Learned simulations can be useful for real-world predictions where the physical model , parameters or boundary conditions are not fully known [ 12 ] . Conversely , the accuracy of predictions can be increased by including specialized knowledge about the system modelled in the form of loss terms [ 43 , 23 ] , or by physics-informed feature normalization [ 40 ] . The methods mentioned above are based on convolutional architectures on regular grids . Although this is by far the most widespread architecture for learning high-dimensional physical systems , recently there has been an increased interest in particle-based representations , which are particularly attractive for modelling the dynamics of free-surface liquids and granular materials . Ladicky et al . [ 22 ] use random forests to speed up liquid simulations . Various works [ 24 , 42 , 37 ] use graph neural networks ( GNNs ) [ 38 , 4 ] to model particle-based granular materials and fluids , as well as glassy dynamics [ 3 ] . Learned methods can improve certain aspects of classical FEM simulations , e.g . more accurate handling of strongly nonlinear displacements [ 25 ] or learned elements which directly map between forces and displacements [ 10 ] . Finally , dynamics of high dimensional systems can be learned in reduced spaces . Holden et al . [ 18 ] performs PCA decomposition on cloth data , and learns a correction model to improve accuracy of subspace simulation . These models are however very domain-specific , and the expression range is limited due to the use of the linear subspace . There is increased attention in using meshes for learned geometry and shape processing [ 9 , 29 , 17 ] . But despite mesh-based simulations being the tool of choice in mechanical engineering and related disciplines , adaptive mesh representations have not seen much use in machine learning for physics prediction , with a few notable exceptions [ 5 , 2 ] . Belbute-Peres et al . [ 5 ] embed a differentiable aerodynamics solver in a graph convolution ( GCN ) [ 21 ] prediction pipeline for super-resolution in aerodynamics predictions . Our method has similarities , but without a solver in the loop , which potentially makes it easier to use and adapt to new systems . In Section 5 we show that MESHGRAPHNETS are better suited for dynamical prediction than GCN-based architectures . Finally , Graph Element Networks [ 2 ] uses meshes over 2D grid domains to more efficiently compute predictions and scene representations . Notably they use small planar systems ( < 50 nodes ) , while we show how to scale mesh-based predictions to complex 3D systems with thousands of nodes . 3 MODEL . We describe the state of the system at time t using a simulation mesh M t = ( V , EM ) with nodes V connected by mesh edges EM . Each node i ∈ V is associated with a reference mesh-space coordinate ui which spans the simulation mesh , and additional dynamical quantities qi that we want to model . Eulerian systems ( Figure 2c , d ) model the evolution of continuous fields such as velocity over a fixed mesh , and qi sample these fields at the mesh nodes . In Lagrangian systems , the mesh represents a moving and deforming surface or volume ( e.g . Figure 2a , b ) , and contains an extra world-space coordinate xi describing the dynamic state of the mesh in 3D space , in addition to the fixed mesh-space coordinate ui ( Figure 3a ) . 3.1 LEARNING FORWARD DYNAMICS . The task is to learn a forward model of the dynamic quantities of the mesh at time t+1 given the current mesh M t and ( optionally ) a history of previous meshes { M t−1 , ... , M t−h } . We propose MESHGRAPHNETS , a graph neural network model with an Encode-Process-Decode architecture [ 4 , 37 ] , followed by an integrator . Figure 1 shows a visual scheme of the MESHGRAPHNETS architecture . Domain specific information on the encoding and integration can be found in Section 4 . Encoder The encoder encodes the current mesh M t into a multigraph G = ( V , EM , EW ) . Mesh nodes become graph nodes V , and mesh edges become bidirectional mesh-edges EM in the graph . This serves to compute the internal dynamics of the mesh . For Lagrangian systems , we add world edges EW to the graph , to enable learning external dynamics such as ( self- ) collision and contact , which are non-local in mesh-space.1 World-space edges are created by spatial proximity : that is , given a fixed-radius rW on the order of the smallest mesh edge lengths , we add a world edge between nodes i and j if |xi − xj | < rW , excluding node pairs already connected in the mesh . This encourages using world edges to pass information between nodes that are spatially close , but distant in mesh space ( Figure 3a ) . Next , we encode features into graph nodes and edges . To achieve spatial equivariance , positional features are provided as relative edge features . We encode the relative displacement vector in mesh space uij = ui−uj and its norm |uij | into the mesh edges eMij ∈ EM . Then , we encode the relative world-space displacement vector xij and its norm |xij | into both mesh edges eMij ∈ EM and world edges eWij ∈ EW . All remaining dynamical features qi , as well as a one-hot vector indicating node type , are provided as node features in vi . Finally , the concatenated features above are encoded into a latent vector of size 128 at each node and edge , using the encoder MLPs M , W , V for mesh edges eMij , world edges e W ij , and nodes vi respectively . See sections 4 and A.1 for more details on input encoding . Processor The processor consists of L identical message passing blocks , which generalize GraphNet blocks [ 36 ] to multiple edge sets . Each block contains a separate set of network parameters , and is applied in sequence to the output of the previous block , updating the mesh edge eMij , world edge eWij , and node vi embeddings to e ′M ij , e ′W ij , v ′ i respectively by e′ M ij ← fM ( eMij , vi , vj ) , e′ W ij ← fW ( eWij , vi , vj ) , v′i ← fV ( vi , ∑ j e′ M ij , ∑ j e′ W ij ) ( 1 ) where fM , fW , fV are implemented using MLPs with a residual connection . Decoder and state updater For predicting the time t+1 state from the time t input , the decoder uses an MLP δV to transform the latent node features vi after the final processing step into one or more output features pi . We can interpret the output features pi as ( higher-order ) derivatives of qi , and integrate them using a forward-Euler integrator with ∆t = 1 to compute the next-step dynamical quantity qt+1i . For firstorder systems the output pi is integrated once to update qt+1i = pi + q t i , while for second-order integration happens twice : qt+1i = pi + 2q t i − qt−1 . Additional output features pi are also used to make direct predictions of auxiliary quantities such as pressure or stress . For domain-specific details on decoding , see Section 4 . Finally , the output mesh nodes V are updated using qt+1i to produce M t+1 . For some systems , we dynamically adapt the mesh after each prediction step ; this is explained in the following section . 1From here on , any mention of world edges and world coordinates applies only to Lagrangian systems ; they are omitted for Eulerian systems . 3.2 ADAPTIVE REMESHING . Adaptive remeshing algorithms generally consist of two parts : identifying which regions of the simulation domain need coarse or fine resolution , and adapting the nodes and their connections to this target resolution . Only the first part requires domain knowledge of the type of physical system , which usually comes in the form of heuristics . For instance , in cloth simulation , one common heuristic is the refinement of areas with high curvature to ensure smooth bending dynamics ( Figure 3b ) , while in computational fluid dynamics , it is common to refine around wall boundaries where high gradients of the velocity field are expected . In this work we adopt the sizing field methodology [ 27 ] . The sizing field tensor S ( u ) ∈ R2×2 specifies the desired local resolution by encoding the maximally allowed oriented , edge lengths in the simulation mesh . An edge uij is valid if and only if uTijSi uij ≤ 1 , otherwise it is too long , and needs to be split2 . Given the sizing field , a generic local remeshing algorithm can simply split all invalid edges to refine the mesh , and collapse as many edges as possible , without creating new invalid edges , to coarsen the mesh . We denote this remeshing process as M ′ = R ( M , S ) . Learned remeshing To leverage the advantages in efficiency and accuracy of dynamic remeshing , we need to be able to adapt the mesh at test time . Since remeshing requires domain knowledge , we would however need to call the specific remesher used to generate the training data at each step during the model rollout , reducing the benefits of learning the model . Instead , we learn a model of the sizing field ( the only domain-specific part of remeshing ) using the same architecture as in Section 3.1 and train a decoder output pi to produce a sizing tensor for each node . At test time , for each time step we predict both the next simulation state and the sizing field , and use a generic , domainindependent remesher R to compute the adapted next-step mesh as M t+1 = R ( M̂ t+1 , Ŝt+1 ) . We demonstrate this on triangular meshes , Section A.3 describes the simple generic remesher that we use for this purpose . While the sizing field is agnostic to the mesh type , other mesh types may require different local remeshers ; for tetrahedral meshes a method such as Wicke et al . [ 45 ] could be used , while quad meshes can simply be split into triangular meshes .

Summary: This paper presents a graph-network-based architecture for learning to perform mesh-based simulations, which can be run more efficiently than the full, "ground-truth" simulations. The experiments demonstrate that the proposed method is able to learn to simulate a wide range of different physical scenarios. Moreover, the presented results also demonstrate an ability to generalize to configurations different from the one seen in training.