Abstract
Controlling fluid dynamics is a complex task traditionally addressed via computationally expensive "black-box" optimization or reinforcement learning. This paper introduces a differentiable Eulerian fluid simulator that supports one-way coupling with rigid objects. By leveraging the adjoint method and a variational principle for sub-grid accuracy, the method enables efficient gradient-based optimization. Experimental results demonstrate that this approach is 10x to 100x faster than derivative-free alternatives in solving fluid control and inverse problems.
Introduction
Simulating fluids is computationally intensive, but controlling them—such as directing smoke into specific shapes or optimizing robotic movement in water—presents an even greater challenge. Traditional approaches like Reinforcement Learning (RL) often require thousands of simulations because they rely on "guess and check" strategies without an internal model of the underlying physics.
Differentiable physics offers a solution by calculating exactly how changes in input (e.g., control forces) affect the output fluid state. However, existing simulators often struggle with accurate solid coupling at low resolutions and the high memory overhead of standard automatic differentiation (AD). This work addresses these gaps by providing a high-performance, physics-aware differentiable simulator.
Methodology
The proposed simulator is built on an Eulerian (grid-based) framework, which is well-suited for maintaining fluid incompressibility. The architecture integrates three primary technical innovations:
- Variational Fluid-Solid Coupling: Instead of simple voxel-based representations, the simulator uses a variational principle to enforce boundary conditions. This provides sub-grid accuracy, allowing the system to account for solid boundaries that do not align perfectly with grid cells.
- The Adjoint Method: To avoid the memory-intensive process of backpropagating through every scalar operation, the authors apply the adjoint method to the entire dynamical system. This allows for gradient computation across multiple time steps with minimal memory overhead.
- High-Level Automatic Differentiation: By implementing gradients at the level of high-level physics operations (like pressure projection) rather than primitive operations, the simulator avoids the overhead typical of general-purpose AD libraries like PyTorch or TensorFlow.
The simulator can be integrated as a layer within deep neural networks, facilitating end-to-end training where the network learns to generate optimal control inputs for fluid systems.
Experimental Evaluation and Results
The method was evaluated on several synthetic physics benchmarks, including space-time optimization of fluid velocities, solid control tasks (e.g., moving a box to generate specific flows), and 3D smoke dispersion.
Performance and Efficiency
The adjoint-based gradient computation proved to be 2 to 3 orders of magnitude faster than numerical finite differences. Compared to PhiFlow, a popular differentiable fluid library, the proposed method is 20x to 135x faster. Furthermore, the computational cost remains largely independent of the number of control parameters, a significant advantage over finite difference methods.
Optimization Convergence
In control tasks, the high-quality gradients provided by the simulator allowed standard optimizers (like L-BFGS) to converge significantly faster than "blind" methods.
As shown in the results, the method converged to solutions at least one order of magnitude faster than state-of-the-art RL (PPO) and derivative-free optimization (CMA-ES).
Discussion and Conclusion
This work demonstrates that "physics-aware" gradients are vastly more efficient than general-purpose AD for complex fluid simulations. By incorporating sub-grid details through volume fractions, the simulator achieves higher gradient accuracy, which is critical for effective optimization.
While the current implementation focuses on one-way coupling (solids affecting fluids), future work could extend the variational principle to support fully differentiable two-way interactions. Additionally, expanding the framework to handle non-Newtonian or highly viscous fluids and validating the controllers against real-world experimental data remain important next steps.
Summary updated