# TGN: A Temporal Graph Network for Physics Prediction
## 1 Introduction  
Mesh-based simulations are central to the modeling of complex physical systems. Since the computational cost of such simulations is very expensive, more and more research has started to use mesh-based machine learning models to accelerate the numerical simulation of physical systems such as fluid dynamics [1, 2, 3], structural mechanics [4, 5], and quantum mechanics [6, 7]. AI-based prediction of physical systems is the process of analyzing past system states and training a simulator to predict future system states. However, the prediction of physical systems has been a challenging task due to its complex temporal and spatial dependence. Temporal dependence refers to the changes in system states over time, which are characterized by periodicity and trend. Spatial dependence refers to the changes in system states that are affected by the mesh topology, which is manifested as the interaction of physical quantities between neighboring mesh nodes. This spatial dependence is related to the discretization methods (Finite Difference, Finite Volume, or Finite Element) in CFD. In the mesh shown in Figure 1, we use the explicit finite difference method to solve the one-dimensional heat transfer equation, where the state of node \(i\) at moment \(n+1\) is governed by the state of node \(i\) and its neighboring nodes at moment \(n\). Graph neural networks are widely used for the prediction of physical systems on unstructured meshes. These methods encode simulated states into graphs and adaptivelyassign computations to spatial regions with strong gradients or where high accuracy is required [3; 8; 9; 10]. However, the majority of GNN-based prediction models for physical systems are designed as next-step prediction models. This means that they forecast the next state of a physical system based on its current state. When facing long-term time series forecasting (LTSF) tasks, next-step models inevitably suffer from severe error accumulation, even accompanied by drifting phenomena, and such drifting is difficult to mitigate. On the other hand, some current autoregressive prediction models have achieved great success in LTSF tasks, such as Recurrent Neural Networks (RNNs) [11], Transformer [12; 13; 14; 15; 16; 17], or simple linear models [18]. They can capture trending and periodic information from historical time series. For example, cylinder flows show periodic changes during the vortex shedding phase; their system states also trend over time, and the next system state is influenced by the system state at the previous moment or even longer. By utilizing this temporal information, they can greatly mitigate error accumulation and better maintain phase and conserved quantities [19; 20]. However, these methods only consider temporal dependence but ignore the topology of the mesh, making the changes of physical systems unconstrained by the physical space and thus failing to accurately predict system states. In this paper, based on GNNs and linear models, we design a graph space encoder (GSE) and a time encoder (AutoLinear). The GSE leverages message passing to aggregate information but introduces several enhancements, such as employing multiple basis functions to map the messages, combining multiple headers, and utilizing multiple aggregators. The AutoLinear embeds the decomposition blocks used in Autoformer as internal operators and employs lineal models to extract periodic and trending information from time series. This design allows AutoLinear to progressively decompose intermediate results throughout the forecasting process, capturing future time information. We propose a hybrid method, named TGN, by combining GSE and AutoLinear. TGN is utilized for spatiotemporal modeling of complex physical systems on unstructured meshes. First, GSE performs multiple rounds of message passing on the input system state sequence to aggregate the local information into node representations, thus obtaining a graph sequence with spatial characteristics.