Introduction
Fluid simulation is a cornerstone of modern computer graphics, essential for creating realistic visual effects in films, games, and engineering visualizations. These simulations are governed by the incompressible Navier-Stokes equations, which describe how fluids move under various forces. While significant progress has been made in accelerating pressure projection—the step that ensures fluid incompressibility—the viscosity step remains a major computational bottleneck.
Viscosity represents the internal friction of a fluid, determining whether it flows like water or oozes like honey. Traditionally, solving for these viscous forces requires solving massive systems of linear equations. In 3D environments, these systems can be up to eight times larger than those required for pressure, leading to substantial latency in interactive applications. This paper introduces a novel, data-driven approach that replaces these expensive iterative solvers with a fast, deep-learning-based alternative.
Methodology
The Simulation Pipeline
The proposed framework integrates a U-Net-based convolutional neural network (CNN) into the standard fluid simulation loop. The pipeline begins with particle-to-grid mapping and the application of external forces. The core innovation lies in replacing the traditional variational viscosity solver with a trained model that predicts the velocity change ($\Delta u_t$) due to viscosity.
Symmetric MAC Grid
A primary challenge in applying CNNs to fluid simulation is the structure of the Marker-and-Cell (MAC) grid. Standard MAC grids are staggered, storing different velocity components at different spatial locations. This asymmetry results in mismatched dimensions (e.g., an $n \times n$ grid yields $(n+1) \times n$ for x-velocity), which standard CNN architectures cannot process without introducing spatial bias or "tilted" artifacts.
To address this, the researchers developed a "symmetric MAC grid." By mapping centers, corners, and edges into a consistent $(2n+1) \times (2n+1)$ format, the model can process the data using standard convolutional layers while preserving the underlying spatial relationships of the Eulerian grid. This symmetry is crucial for maintaining physical consistency across both 2D and 3D simulations.
Physics-Informed Learning and Scale Invariance
The model's ability to generalize across different scenarios stems from two key design choices:
- Velocity Derivatives as Input: Instead of raw velocity values, the network receives velocity derivatives (e.g., $\partial u/\partial x$). This ensures scale invariance; the viscous forces depend on the relative motion between adjacent fluid elements rather than the absolute speed of the fluid. This allows the model to handle high-speed scenarios, such as free-fall, that may not have been present in the training data.
- Variational Loss ($L_v$): To handle a wide range of viscosity coefficients ($\mu$), the authors incorporated a physics-based loss function derived from the variational formulation of viscosity. This loss teaches the network to minimize the rate of viscous dissipation, acting as a physical anchor that improves performance when dealing with varying material properties.
Results and Performance
The data-driven solver was evaluated against a high-fidelity variational solver across various 2D and 3D scenes.
- Computational Efficiency: In a real-time 2D interactive application, the traditional solver operated at 14 Hz. The U-Net-based solver increased this to 23 Hz, reducing the time spent on the viscosity step from 32ms to just 4ms. In 3D, the solver maintained a performance of approximately 0.39 seconds per frame on an $80^3$ grid.
- Visual Fidelity: Despite the speed increase, the model successfully captures complex physical phenomena. A notable example is the "buckling effect," where highly viscous fluids coil and fold upon themselves when hitting a surface. This effect is notoriously difficult to simulate efficiently but is handled accurately by the neural network.
- Generalization: The model demonstrates robust generalization to unseen scenarios, including different rigid body obstacles and varying viscosity levels, provided they remain within the broad range of the training set (up to 3,000 mPa·s).
Conclusion and Future Work
This research presents the first data-driven viscosity solver capable of generalizing across different materials and dimensions. By combining a symmetric grid representation with physics-informed loss functions, the authors have significantly reduced the computational cost of viscosity in fluid simulations.
Future work will focus on extending the model's capabilities to handle multi-fluid interactions and further optimizing the 3D implementation. Additionally, addressing extrapolation issues for viscosities far beyond the training range remains an open challenge for fully replacing traditional solvers in all engineering contexts.
Summary updated