Latent Space Physics: Towards Learning the Temporal Evolution of Fluid Flow
Questions.
Motivation
- Numerical analysis based on the Navier-Stokes equations has a very high DoF at high resolutions, incurring large computational cost.
- Thus, the aim is to shorten simulation time by leveraging networks.
- While prior works remained limited to 2D or simple Lagrangian object prediction, the goal here is to predict the temporal evolution of the pressure field.
Contribution
- The first latent-space-based 3D fluid prediction
- 155x faster than a CG solver
- Applicable to fluids in general, including liquids and volumes
Method

Method Overview
\[\partial \mathbf{u}/\partial t + \mathbf{u}\cdot\nabla\mathbf{u} = -1/\rho\,\nabla p + \nu\nabla^2\mathbf{u} + \mathbf{g}\,,\ \ \nabla\cdot\mathbf{u} = 0,\]It starts with the Navier-Stokes equations. Since it is Eulerian, the advection term (\(\mathbf{u} \cdot \nabla \mathbf{u}\)) is present.
Dimension Reduction
A simple encoder-decoder structure is now built.
\[f_t\big(\mathbf{x}(t-nh),...,\mathbf{x}(t-h),\mathbf{x}(t)\big) \approx \big[\mathbf{x}(t+h),\ldots,\mathbf{x}(t+oh)\big].\]First, suppose some function \(f_t\) takes the physical property over the previous n timesteps and outputs predictions of the o future states of that property, from t+h to t+oh. And let the latent-space version of this function be \(\tilde{f}_t\).
Then the problem defined takes the following form:
\[\begin{aligned} \tilde{f}_t\big(f_e(\mathbf{x}(t-nh)),\ldots,f_e(\mathbf{x}(t))\big) &\approx \big[\mathbf{c}^{t+h},\ldots,\mathbf{c}^{t+oh}\big] \\ f_d\big(\big[\mathbf{c}^{t+h},\ldots,\mathbf{c}^{t+oh}\big]\big) &\approx \big[\mathbf{x}(t+h),\ldots,\mathbf{x}(t+oh)\big] \\ f_d\big(\tilde{f}_t(f_e(\mathbf{x}(t-nh)),\ldots,f_e(\mathbf{x}(t)))\big) &\approx f_t(\mathbf{x}(t-nh),\ldots,\mathbf{x}(t)) \end{aligned}\]Here \(f_e, f_d\) are the encoder and decoder respectively, and \(\mathbf{c} \in \mathbb{R}^{m_s}\) is a latent vector where \(f_e(\mathbf{x}(t)) = \mathbf{c}^t\).
Future States Prediction

Here, if \(\mathbf{c}\) is the vector corresponding to each timestep ‘t’, then to build a model that can predict temporal evolution, an LSTM encoder-decoder structure is likewise used once more within the latent space. Once the encoder \(\tilde{f_{t_e}}\) compresses to \([\mathbf{c}^{t-n}, … , \mathbf{c}^t] → \mathbf{d}\), the decoder \(\tilde{f_{t_d}}\) reconstructs the future latent vectors as \(\mathbf{d} → [\mathbf{c}^{t+1}, … , \mathbf{c}^{t+on}]\). Feeding this back through the full decoder allows the physical property \(\mathbf{x}\) at future times to be predicted (here \([\cdot , \cdot]\) denotes concatenation). However, this compression is temporal rather than spatial.
More concretely, the \(\mathbf{c}\) that have been compressed to \(m_s\) dim at a particular timestep are gathered and fed through the first encoder LSTM; the intermediate hidden-state outputs are discarded and the output of the last layer is used as \(\mathbf{d}\). This vector now holds the temporal context over the previous n timesteps. Then \(\mathbf{d}\) is simply copied o times and fed into the decoder. In this case the intermediate hidden-state outputs are also used, so the outputs from all o hidden states are taken and a conv1D is used to reconstruct back to \(m_s\) dimensions. This yields the latent-space vectors of the o future states.
Optimization
The loss function is designed as follows.
\[\min_{\theta_d,\theta_e}\vert f_d(f_e(\mathbf{x}(t)))-\mathbf{x}(t)\vert _2,\] \[\min_{\theta_t}\left\vert \tilde{f}_t\left(\mathbf{c}^{t-nh},\ldots,\mathbf{c}^{t-h},\mathbf{c}^t\right)-\left[\mathbf{c}^{t+h},\ldots,\mathbf{c}^{t+oh}\right]\right\vert _1.\]The first is for dimension reduction, the second for temporal evolution. The losses themselves are very simple. They compare the MSE of the typical prediction vs. GT. Here dimension reduction uses the L2 norm, and temporal evolution uses the L1 norm.
Dataset
Unfortunately there is no fluid benchmarking dataset yet. So the method for generating the GT data is described.
The base method uses the FLIP solver. Notably, the pressure (\(p_t\)) is split into hydrostatic pressure (\(p_s\)) + dynamic pressure (\(p_d\)). The former is determined linearly by fluid depth, while the latter is determined by the fluid’s advection and the resulting acceleration. In terms of the share of pressure force, \(p_s\) is large, but what determines splashes, vortices, etc. is \(p_d\). Therefore the pressure is separated so that the network focuses on \(p_d\).

The dataset was constructed as follows.

Visualization of the surface, velocity, and pressure of the generated dataset.
Interval Prediction
Overall, a small trick is used. After the network continuously performs prediction \(i_p\) times, the solver is run once to correct the state, thereby preventing long-term error drift.
Result
Metric
Along with PSNR, the modified Hausdorff distance is used. When \(\phi_r, \phi_p\) are the reference and predicted surfaces respectively, the surface error is computed as follows:
\[e_h = \max\left(1/\vert S_p\vert \sum_{\mathbf{p}_1 \in S_p} \phi_r(\mathbf{p}_1), 1/\vert S_r\vert \sum_{\mathbf{p}_2 \in S_r} \phi_p(\mathbf{p}_2)\right)/\Delta x.\]The error compares the SDF average of point samples from the predicted surface and the reference surface, takes the max, and divides it by the grid spacing to compute the error in the simulation space.
Ablation

Comparison of the AE reconstruction performance itself.

Comparison of results in the full pipeline without interval prediction.
In both cases, introducing a VAE was attempted, but it can be seen that it actually degrades performance. Using pressure yields far better results than using velocity \(\mathbf{u}\).

- Fig. 7a, 7e: AE baseline. In terms of pure reconstruction error, \(p_t\) gave the best results.
- Fig. 7b, 7f: Pure prediction. There is no large performance gap compared to the baseline. That is, it shows the LSTM learned the temporal evolution well.
- Fig. 7c, 7d: Interval prediction. Compared to pure prediction, inserting solver steps in between reduces the error much more. It still feels like replacing the solver with model learning alone is not yet possible.
- Fig. 7g: Architecture. The hybrid (conv1D) structure is better than a fully recurrent structure.
- Fig 7h: Output steps. Increasing o, the number of timesteps predicted at once, causes no large performance difference, while it improves speed, so it is more efficient.
That said, in the end I am not sure whether one can say pressure split is genuinely effective. There is some back-and-forth in PSNR, but overall total pressure looks better. The authors acknowledge this too, and in Section 6 they use total pressure.
Discussion
- Eulerian vs Lagrangian: Eulerian. CNNs are better suited to grid-based discretization.
-
Mathematical similarity
A CNN kernel computes a weighted sum of neighboring values on a grid. This in itself is mathematically similar in form to the Finite Difference Method (FDM), which uses a weighted sum of neighboring points on a grid in fluid dynamics.
That is, what the CNN in this paper learns is itself a combination of differential operators for solving the fluid equations.
-
Regularity of the data structure
For grid data, neighbors are pre-defined. Thus memory access is fast and it is well suited to GPU parallel computation.
-
Translation Invariance
A CNN applies the same kernel by sweeping it over the entire image. Thus the fact that the governing equation gives identical fluid properties regardless of spatial position aligns with the model structure. This lets a CNN trained on a grid efficiently detect and predict local physical patterns regardless of position.
-
-
DoF of \(\mathbf{x}\)?
At \(128^3\) resolution, if \(\mathbf{x}\) is a scalar function, the DoF is \(128^3\). If it is a vector function (= velocity field), then at spatial resolution \(128^3\) the DoF is \(3 * 128^3\)
- Why strided conv instead of pooling?
- Pooling-based downsampling: useful for classification. Because minute information loss during compression is relatively less important for classification. However, the loss of small physical behaviors greatly affects solver accuracy.
- This was the mainstream trend in generative models at the time; it prevents checkerboard-pattern downsampling and facilitates reconstruction.
- Why use a CNN even though it is not image data?
- The structure is essentially the same. Image data has color information per pixel, and simulation parameters have physical information per grid cell.