Learning Incompressible Fluid Dynamics from Scratch - Towards Fast, Differentiable Fluid Models that Generalize

Nils Wandel, Michael Weinmann, Reinhard Klein

Researchers have developed a novel way to train neural network fluid simulators without relying on any pre-existing simulation data. By enforcing the laws of physics directly through the loss function and predicting a "vector potential" to guarantee incompressibility, this new model achieves massive speedups over traditional solvers while generalizing to complex, unseen geometries.

The Challenge of Computational Fluid Dynamics

Computational Fluid Dynamics (CFD) is notoriously expensive. Traditional numerical solvers—essential for applications ranging from aerodynamic car design to weather prediction—are slow because they must iteratively solve complex partial differential equations (the Navier-Stokes equations) for every single timestep.

While Deep Learning (DL) offers a potential shortcut, most existing DL models suffer from three major flaws:

  1. Data Hunger: They typically require massive amounts of "ground truth" data generated by traditional solvers to learn effectively.
  2. Poor Generalization: A model trained on flow through a straight pipe often fails completely when presented with a curved pipe or a novel obstacle.
  3. Hybrid Complexity: Many models still rely on traditional solvers for critical parts of the simulation (like the "pressure projection" step), which negates much of the computational speed benefit.

To overcome these hurdles, researchers sought to create a model that learns fluid dynamics entirely from scratch (unsupervised), runs completely as a neural network, and generalizes to shapes it has never seen before.

Introducing $\vec{a}$-Net: A Physics-Constrained Framework

The authors propose a new framework called $\vec{a}$-Net. Its core innovations center around baking physical laws directly into the network's architecture and training process.

  • Physics-Constrained Learning: Instead of comparing predictions to ground-truth data, the model is trained by minimizing the "residuals" of the Navier-Stokes equations. If the predicted flow violates the laws of physics (e.g., mass isn't conserved or momentum is lost), the loss increases.
  • The Vector Potential Trick: To ensure the fluid is "incompressible" (meaning it doesn't spontaneously compress or expand), the network doesn't predict velocity ($\vec{v}$) directly. Instead, it predicts a vector potential ($\vec{a}$), where $\vec{v} = \text{curl}(\vec{a})$. Mathematically, the curl of any field is always divergence-free, meaning the network cannot physically produce a result that violates incompressibility.
  • Architecture: The framework utilizes a modified U-Net to map the current fluid state and domain geometry to the next state in a single forward pass.
U-Net architecture for fluid state prediction
  • Data Recycling Strategy: The authors maintain a "pool" of fluid states. During training, the network takes a state, predicts the next one, and then puts that new state back into the pool. This allows the network to learn from its own increasingly realistic simulations over time.

Training Without Data

Remarkably, the model requires no external datasets. Instead, it uses a "training pool" of randomized, procedurally generated 2D domains, such as randomly sized boxes and cylinders floating in pipes, or folded pipe systems with randomized flow speeds.

Despite this simple training environment, the model was successfully evaluated on complex geometries it had never seen during training, including airfoils, sharks, cars, and complex cave systems.

Key Insights

  • Hard-coding Physics vs. Soft Constraints: The authors found that predicting the vector potential (hard-coding incompressibility) was significantly more stable and accurate than simply adding a "divergence loss" term (a soft constraint) to a standard velocity-predicting network.
  • The Power of Locality: Why does a model trained on simple boxes and cylinders work on a complex shape like a shark? The authors argue that fluid dynamics are largely determined by local neighborhoods. Since the "nose" of a shark looks locally like a cylinder, the network can generalize basic physical interactions to complex global shapes.
  • The "Cold Start" Necessity: Periodically resetting the training environments to zero-velocity is crucial. Without this, the network forgets how to handle the beginning of a simulation and becomes unstable.
  • Differentiability is a Superpower: Because the entire solver is a neural network, you can backpropagate through the simulation. This allows for "optimal control"—for example, automatically calculating exactly how fast an inlet flow should be to achieve a specific vortex frequency behind an object.

Results and Performance

The $\vec{a}$-Net significantly outperforms traditional baselines like PhiFlow in both speed and accuracy.

  • Speed: The model is roughly 11x faster on a CPU and 40x faster on a GPU than the traditional iterative solver in PhiFlow.
  • Accuracy: Despite being much faster, the model achieved lower momentum and divergence losses than the baseline.
  • Physical Phenomena: The model successfully reproduced complex, real-world fluid effects like the Magnus effect (the force on a spinning object) and Kármán vortex streets (the repeating pattern of swirling eddies).
Simulated fluid flow at varying Reynolds numbers

The authors even demonstrated an interactive demo where users can move obstacles in real-time at 250 frames per second on a 100x300 grid, showcasing the model's stability and speed.

Limitations and Future Work

While highly effective, the current model has a Reynolds number ceiling; it struggles with highly turbulent flows where the gradients used for backpropagation can "explode," making the simulation unstable. Additionally, this paper focuses on 2D simulations. While extending the vector potential approach to 3D is theoretically possible, it would add significant computational complexity. Finally, future work could expand beyond Dirichlet boundary conditions (fixed velocity at walls) to incorporate Neumann conditions (fixed pressure gradients) or multi-phase fluids.

Summary updated

BibTeX
@inproceedings{wandel2021learning,
  author = {Nils Wandel and Michael Weinmann and Reinhard Klein},
  title = {{Learning Incompressible Fluid Dynamics from Scratch - Towards Fast, Differentiable Fluid Models that Generalize}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=tgzMpaj2xWe},
}
Figure