We develop a PyTorch-based Graph Network Simulator (GNS) that learns physics and predicts the flow behavior of particulate and fluid systems. GNS discretizes the domain with nodes representing a collection of material points and the links connecting the nodes representing the local interaction between particles or clusters of particles. The GNS learns the interaction laws through message passing on the graph. GNS has three components: (a) Encoder, which embeds particle information to a latent graph, the edges are learned functions; (b) Processor, which allows data propagation and computes the nodal interactions across steps; and (c) Decoder, which extracts the relevant dynamics (e.g., particle acceleration) from the graph. We introduce physics-inspired simple inductive biases, such as an inertial frame that allows learning algorithms to prioritize one solution (constant gravitational acceleration) over another, reducing learning time. The GNS implementation uses semi-implicit Euler integration to update the next state based on the predicted accelerations. GNS trained on trajectory data is generalizable to predict particle kinematics in complex boundary conditions not seen during training. The trained model accurately predicts within a 5\% error of its associated material point method (MPM) simulation. The predictions are 5,000x faster than traditional MPM simulations (2.5 hours for MPM simulations versus 20 s for GNS simulation of granular flow). GNS surrogates are popular for solving optimization, control, critical-region prediction for in situ viz, and inverse-type problems. The GNS code is available under the open-source MIT license at https://github.com/geoelements/gns.
我们开发了一种基于PyTorch的图网络模拟器(GNS),它能学习物理知识并预测颗粒和流体系统的流动行为。GNS通过节点离散化区域,节点代表一组物质点,连接节点的链路代表粒子或粒子簇之间的局部相互作用。GNS通过在图上传递信息来学习相互作用规律。GNS有三个组成部分:(a)编码器,它将粒子信息嵌入到一个潜在图中,边是学习到的函数;(b)处理器,它允许数据传播并计算跨步骤的节点相互作用;(c)解码器,它从图中提取相关动力学(例如粒子加速度)。我们引入了受物理启发的简单归纳偏差,例如一个惯性系,它允许学习算法优先选择一种解决方案(恒定重力加速度)而非另一种,从而减少学习时间。GNS的实现使用半隐式欧拉积分根据预测的加速度更新下一个状态。基于轨迹数据训练的GNS可推广用于预测训练期间未见过的复杂边界条件下的粒子运动学。训练后的模型能在其相关物质点法(MPM)模拟的5%误差范围内准确预测。预测速度比传统的MPM模拟快5000倍(MPM模拟需要2.5小时,而GNS模拟颗粒流只需20秒)。GNS替代模型在解决优化、控制、原位可视化的关键区域预测以及逆问题等方面很受欢迎。GNS代码在开源的MIT许可证下可在https://github.com/geoelements/gns获取。