Boundary Graph Neural Networks for 3D Simulations

1 INTRODUCTION . Deep learning ( Krizhevsky et al. , 2012 ) dramatically changed scientific fields such as computer vision , natural language processing , or the medical sciences . More recently , deep learning research has been expanded towards physical simulations such as fluid dynamics , deformable materials , or aerodynamics ( Li et al. , 2018 ; Ummenhofer et al. , 2019 ; Sanchez-Gonzalez et al. , 2020 ; Pfaff et al. , 2020 ) . The progress of deep learning in physical simulations was often driven by Graph Neural Networks ( GNNs ) ( Scarselli et al. , 2009 ; Defferrard et al. , 2016 ; Kipf & Welling , 2017 ) , which proved effective when modeling interactions between many entities via forward dynamics ( Battaglia et al. , 2018 ) . Here we want to focus on learning practically relevant granular flow simulations . Granular flows are ubiquitous in nature and industrial processes . Pharmaceutical powders , plastic granulates , or rocks obtained by mining are just some examples of granular media that are used in industries and which are processed in a multitude of different flow states . Consequently , simulations of granular flow processes are required for the design of many industrial processes . Such simulations allow the optimization of devices and machinery in which particle flow is essential . These simulations are needed for a wide range of materials and material mixtures , which can have different cohesion or friction properties . The utilized machines constitute the boundary conditions for the considered granular flow processes . Many conventional simulation approaches , that are based on a solid mathematical theory and which take complex boundaries into account , model these boundaries by triangularizations . Therefore , industrial machinery is often represented by triangular meshes , which can be considered a standard geometric description in the engineering field . Figure 1 exemplarily visualizes triangularized surfaces for two standard components in industrial setups , namely a hopper ( left ) and a rotating drum ( right ) . In this work , we try to tackle the problem of accurately modeling granular processes when triangularized boundary surfaces are present . We therefore suggest a simple extension of conventional GNNs : Boundary Graph Neural Networks ( BGNNs ) . BGNNs dynamically modify graph structures to model interactions of particles and triangulated boundaries . This is achieved by inserting virtual nodes , adding edges and modifying node and edge attributes . We test the effectiveness of BGNNs on complex 3D granular flow simulations of hoppers and rotating drums . The data for BGNN training is obtained by precise but potentially time-consuming simulations . The accuracy of our BGNN models is measured via various aggregate quantities , namely averaged particle positions , flows , and mixing entropies . We ensure that our BGNN models have high simulation quality by requiring high accuracy of the models in terms of these aggregate quantities . BGNN predictions have the potential to be considerably faster than traditional granular flow simulation methods while keeping the same precision . Code , training and test data will be made public upon publication . The main contributions of this work are : • We introduce Boundary Graph Neural Networks ( BGNNs ) , which dynamically modify graph structures via boundary graph structures to allow an accurate modeling of particle interactions with triangularized boundaries . • We implement BGNNs for learning complex 3D granular flow simulations of hoppers and rotating drums . • We assess the BGNN simulation quality via the difference of relevant physical quantities between model predictions and simulations . We show that BGNNs are able to generalize granular flow dynamics over hundreds of thousands of timesteps while having the potential to be considerably faster than state-of-the-art simulation methods . 2 BACKGROUND . Dataset . Due to the fact that there are no governing equations for granular flow like the NavierStokes equations for fluid flow ( Faccanoni & Mangeney , 2013 ) , a method similar to molecular dynamics , the Discrete Element Method ( DEM ) ( Cundall & Strack , 1979 ) is used for simulating granular flow . The key idea of DEM is to represent granular media by discrete particles ( e.g . spheres or polyhedra ) , which interact by exchanging momentum using established contact models . LIGGGHTS ( Kloss et al. , 2012 , see App . A ) is an open-source DEM implementation , which is able to simulate particle flow for a wide range of materials and complex mesh-based wall geometries and , which therefore enables the simulation of many industrial processes . Consequently , we used LIGGGHTS to generate training , validation and test set simulation trajectories for granular flow within different hopper and rotating drum environments . Time transition model . We build our method upon Sanchez-Gonzalez et al . ( 2020 ) and use the semi-implicit Euler method to numerically integrate the equations of motion using model-predicted acceleration . The time-transition from time C to time C + 1 is given by ¤xC+1 = ¤xC + ΔC ¥xC and xC+1 = xC + ΔC ¤xC+1 , where x is the particle location , and ¤x the particle velocity . To calculate the time-transition xC+1 the particle acceleration ¥xC is predicted . Graph Neural Networks . We consider graphs G = ( V , E ) , with nodes E8 ∈ V and edges 48 9 ∈ E , where # -dimensional node features pE8 ∈ R # are attached to each of the nodes . Whether the graph G contains an edge between a pair of nodes ( E8 , E 9 ) depends on the distance between the nodes : 48 9 ∈ E ⇐⇒ 3 ( E8 , E 9 ) 6 cut-off , ( 1 ) where the cut-off radius is usually a hyperparamter of the model . Edges might have `` -dimensional edge features a8 9 ∈ R '' attached to each edge 48 9 . Graph networks are designed to learn from graph-structured data ( Scarselli et al. , 2009 ; Kipf & Welling , 2017 ; Defferrard et al. , 2016 ; Battaglia et al. , 2018 ) . Message passing networks ( Gilmer et al. , 2017 ) are a specific type of graph neural networks and usually consist of three different types of layers : node and edge feature embedding layers , the core message passing layers , and read-out layers . Message passing iteratively updates the embeddings of edges ( m8 9 ) and nodes ( h8 ) , i.e. , the embeddings of a8 9 and pE8 , at edge 48 9 and node E8 via : m′8 9 = q ( h8 , h 9 , m8 9 ) , h′8 = k ( h8 , 48 9 ∈E m ′ 8 9 ) , ( 2 ) where the aggregation 48 9 ∈E at node E8 in Eq . ( 2 ) is across all nodes that are connected to node E8 via an edge 48 9 . Typically represents a mean or max operation . The learnable functions q and k are commonly presented by Multilayer Perceptrons ( MLPs ) . Equation ( 2 ) describes in a compact form the computation and aggregation of messages , and the subsequent update of node embeddings . The final node embeddings are used for predictions via read-out layers . 3 BOUNDARY GRAPH NEURAL NETWORKS . Boundary Graph Neural Networks . We introduce Boundary Graph Neural Networks ( BGNNs ) for modeling the time transition dynamics in simulations within complex geometries . In BGNNs , each graph node E8 is associated to a particle with location xE8 , velocity ¤xE8 and acceleration ¥xE8 , which is similar to Sanchez-Gonzalez et al . ( 2020 ) . BGNNs modify and enhance the graph structure to include boundaries ( see Fig . 2 ) . BGNNs dynamically add =̃ virtual nodes Ẽ 9 ∈ Ṽ for boundary regions , iff the corresponding boundary region is within a cut-off radius to any other particle . We augment the set of edges E by boundary edges 4̃8 9 giving an enhanced edge set Ê with 48 9 ∈ E and 4̃8 9 ∈ Ẽ . Analogously to Eq . ( 1 ) , the existence of particle-particle edges 48 9 and particle-boundary edges 4̃8 9 is determined via : 48 9 ∈ E ⊆ Ê ⇐⇒ 3 ( E8 , E 9 ) 6 cut-off4 , ( 3 ) 4̃8 9 ∈ Ẽ ⊆ Ê ⇐⇒ 3̃ ( E8 , Ẽ 9 ) 6 cut-off4̃ . ( 4 ) Note , that the cut-off radii cut-off4 and cut-off4̃ are not necessarily the same , and , 3 : V ×V → R , while 3̃ : V × Ṽ → R , i.e . bidirectional edges are used between real nodes and unidirectional edges are used between real and virtual nodes . In order to include more information about boundary surfaces into particle-boundary interactions , # ̃-dimensional node features that encode information about the inclination of triangles in space are concatenated with the existing node features pE8 ∈ R # . Additionally , coordinate information is used both for existing nodes ( X = { xE0 , . . . , xE=−1 } ) as well as for virtual nodes ( X̃ = { x̃Ẽ0 , . . . , x̃Ẽ=̃−1 } ) . For virtual nodes , the additional coordinates x̃Ẽ9 are chosen such that they minimize the distance between points from boundaries and real particles . The resulting set of node features P̂ and node coordinates X̂ are : P̂ = { pE0 , . . . , pE=−1 , p̃Ẽ0 , . . . , p̃Ẽ=̃−1 } , X̂ = { xE0 , . . . , xE=−1 , x̃Ẽ0 , . . . , x̃Ẽ=̃−1 } , ( 5 ) where p̂8 ∈ R # + # ̃ and x̂8 ∈ R3 denote the elements of P̂ and X̂ , respectively . Similarly to above , message passing updates the embeddings of edges ( m̂8 9 ) and the embeddings of nodes ( ĥ8 ) via m̂′8 9 = q̂ ( ĥ8 , ĥ 9 , m̂8 9 ) , ĥ′8 = k̂ ( ĥ8 , 4̂8 9 ∈ Ê m̂ ′ 8 9 ) , ( 6 ) where the aggregation 4̂8 9 ∈ Ê at node E8 in Eq . ( 6 ) is across all real or virtual nodes that are connected to E8 via an edge 4̂8 9 . Similar to Gilmer et al . ( 2017 ) and Satorras et al . ( 2021 ) , we make use of pairwise distances ( x̂8 − x̂ 9 2 and x̂8 − x̂ 9 and deterministic functions thereof ) . These are for BGNNs between real and between real and virtual particles and we pass this information to the graph network as edge attributes â8 9 , for which an initial edge embedding m̂8 9 is determined via an edge embedding layer . The final node embeddings are used for the predictions via the read-out layers . For aggregation , we use the mean . The main challenges of the implementation of BGNNs are the modification of the graph structure towards a dynamic boundary graph structure to include boundary information via the introduction of modified edges 4̃8 9 , modified node features p̂8 , and coordinates for virtual nodes x̃Ẽ8 . In the following section , we discuss how 4̃8 9 , p̂8 , and x̃Ẽ8 are calculated . 4 DYNAMIC BOUNDARY GRAPH STRUCTURE . A boundary graph structure , which is a dynamic modification of the graph structure is needed for two reasons : ( i ) A static graph structure , which inserts many particles ( number proportional to the surface area ) for every boundary surface , may result in large computational costs in 3D scenes . ( ii ) For certain time frames , only some parts of the mesh might be relevant and computations can be saved . For example , as long as particles are in free fall in a container far away from the bottom , the mesh part describing the bottom is irrelevant for the next time step . One virtual particle is enough to describe particle boundary interactions . Every particle “ sees ” at most one virtual particle representing the boundary surface area , namely that particle which has the shortest distance . Since interaction strength decreases continuously with the distance , it is ensured that for every particle-boundary interaction that boundary point with the largest contribution is considered . Table 1 shows average numbers of nodes V , as well as average numbers of boundary edges Ẽ and the relative increase in edges ( ratio of the number of added wall edges to the total number of particle edges ) . The scalability of BGNNs would suffer if more than one particle per particle-boundary interaction surface was considered . A dynamic boundary graph structure is obtained in three stages : • Calculating distances between real particles and triangular boundary surface areas in order to decide if a virtual particle node needs to be inserted into the graph , and subsequently obtain additional edges 4̃8 9 • Obtaining positional coordinates for virtual nodes x̃Ẽ9 as representatives of the relevant fraction of the triangular surface area x̃Ẽ9 • Modifying node features p̃8 by including normal directions to facilitate the learning of geometric relationships between particles and boundary surfaces Modified edges 4̃8 9 via calculation of distances to boundaries . To obtain modified edges 4̃8 9 , boundary particles are dynamically inserted , but only if a real particle is close to the corresponding boundary . The insertion of unnecessary edges into the graph is avoided . Such edges would connect nodes of real and virtual particles , although they are far apart . To decide whether a virtual particle has to be inserted requires the calculation of distances between pairs of real particles and mesh triangles . Specifically , the squared distance between the particle center and the closest point on the mesh triangles is calculated ( adopted from ( Eberly , 1999 ) ) . For this purpose , a location on a triangle t is parametrized by two scalar values D and E ∈ R : t ( D , E ) = b + D e0 + E e1 , where D ≥ 0 , E ≥ 0 , and D + E 6 1 , b represents one of the nodes of the triangle , and , e0 and e1 are vectors from b towards the other two nodes ( see Fig . 3 ) . The minimal Euclidean squared distance @ of the point p to the triangle is given by the optimization problem : 3 = min D , E @ ( D , E ) = ‖t ( D , E ) − p‖2 ( 7 ) s.t . D ≥ 0 , E ≥ 0 , D + E 6 1 . The minimizing arguments D′ and E′ parametrize the closest point t ( D′ , E′ ) of the triangle to the point p. As indicated in Fig . 3 , seven cases have to be to distinguished : one case ( c0 ) in which t ( D′ , E′ ) is located within the ( closed ) triangle , three cases ( c1 , c3 , c5 ) in which t ( D′ , E′ ) is located on one edge of the triangle ( including the edge corner points as special cases ) , and three cases ( c2 , c4 , c6 ) in which t ( D′ , E′ ) is located on one of two edges ( including the triangle corner points as special cases ) . Whether a virtual particle is inserted is determined by Eq . ( 4 ) and the particle-triangle distance 3 . Positional coordinates x̃Ẽ9 for virtual nodes . After having modified the edges 4̃8 9 via the calculation of distances between real particles and triangular boundary surface areas , we now have to decide where to place the virtual particles on these boundary surface areas . For virtual particles the coordinates x̃Ẽ9 correspond to t ( D′ , E′ ) , i.e. , the closest points on the triangular boundary surface areas with respect to the interacting real particle . Modifying node features ? ̂8 by including boundary normal directions . Typical granular flow simulations comprise substantially more particle - particle interactions than particle - boundary interactions , which may impede the learning of particle - boundary interactions . In Kipf et al . ( 2018 ) the problem of qualitatively different interactions is addressed by introducing a dedicated message generating network for each interaction type . We avoid such extensions of our model by means of the following two approaches . First , we introduce additional node features , such that the neural network is able to distinguish the different types of nodes . Second , we adapt the weight initialization of the node feature embedding k̂ , such that the embedding network can be trained with larger values for the additional features . Consequently , the network can learn different dynamics for particle - particle and particle - boundary interactions . The additional node features are : ( i ) type feature , i.e. , a binary indicator of whether a node represents a particle that is real or virtual , and , in the latter case , ( ii ) the components of the normal vector ( see App . B for more information on an orientation-independent representation of the normal vectors ) of the triangular surface areas ( null vectors for real particles ) .

Summary: This paper presents a novel contribution to the use of Graph Neural Networks (GNN) in the simulation of 3D physical phenomena. This contribution consists of the optimization in the calculation of the interactions of the particles with the contour surfaces that allows to optimize the need to add nodes in these limits. The results show an acceleration of the simulation calculation without affecting the accuracy of the result.