Humans manipulate various kinds of fluids in their everyday life: creating latte art, scooping floating objects from water, rolling an ice cream cone, etc. Using robots to augment or replace human labors in these daily settings remain as a challenging task due to the multifaceted complexities of fluids.

Previous research in robotic fluid manipulation mostly consider fluids governed by an ideal, Newtonian model in simple task settings (e.g., pouring water into a container). However, the vast majority of real-world fluid systems manifest their complexities in terms of the fluid’s complex material behaviors (e.g., elastoplastic deformation) and multi-component interactions (e.g. coffee and frothed milk when making latte art), both of which were well beyond the scope of the current literature. To evaluate robot learning algorithms on understanding and interacting with such complex fluid systems, a comprehensive virtual platform with versatile simulation capabilities and well-established tasks is needed.

In this work, we introduce FluidLab, a simulation environment with a diverse set of manipulation tasks involving complex fluid dynamics. These tasks address interactions between solid and fluid as well as among multiple fluids. At the heart of our platform is a fully differentiable physics simulator, FluidEngine, providing GPU-accelerated simulations and gradient calculations for various material types and their couplings, extending the scope of the existing differentiable simulation engines. We identify several challenges for fluid manipulation learning by evaluating a set of reinforcement learning and trajectory optimization methods on our platform. To address these challenges, we propose several domain-specific optimization schemes coupled with differentiable physics, which are empirically shown to be effective in tackling optimization problems featured by fluid system’s non-convex and non-smooth properties.

We evaluate trajectory optimization with differentiable physics (DP), sampling-based optimization methods (CMA-ES) as well as model-free RL algorithms including SAC and PPO, and show we can solve some quite challenging tasks reasonably well, using the gradient information provided by our simulation environment and the optimization scheme we proposed.

**Goal**

DP

DP-H

CMA-ES

SAC

PPO

**Goal**

DP

DP-H

CMA-ES

SAC

PPO

**Goal**

DP

DP-H

CMA-ES

SAC

PPO

**Goal**

DP

DP-H

CMA-ES

SAC

PPO

**Goal**

DP

DP-H

CMA-ES

SAC

PPO

**Goal**

DP

DP-H

CMA-ES

SAC

PPO

**Goal**

DP

DP-H

CMA-ES

SAC

PPO

**Goal**

DP

DP-H

CMA-ES

SAC

PPO

**Goal**

DP

DP-H

CMA-ES

SAC

PPO

**Goal**

DP

DP-H

CMA-ES

SAC

PPO

One useful way of validating simulation engines is to run simulation experiments and verify if the produced simulation results match known physical phenomena. Here we testify FluidEngine by running simulations and inspect if it can successfully reproduce a number of physical phenomena shown below.

When a flow of fluid is separated by blunt bodies, a repeating pattern of swirling vortices would appear due to vortex shedding. We simulate a flow of fluid flowing by a rigid cylinder and visualize the top-down view. We colorized the fluid around the cylinder, and it can be seen that our simulator can faithfully produce a street of vortices, typically known as the Kármán vortex street phenomenon.

This is a classical engineering test case, where a fluid volume falls due to gravity and splashes within the domain. We successfully reproduced this phenomenon with our simulation engine.

Elastic

Elasto-plastic

This is an observable phenomenon commonly associated with a spinning object moving through a fluid. The path of the spinning object is deflected in a manner not present when the object is not spinning. One example of such phenomenon seen in daily life is the screw shot in football playing. Here we simulate a spinning ball in a fluid body. It can be observed that the spinning motion produces a deflection in the motion trajectory of the ball, and the magnitude of the deflection has a correlation with the spinning velocity.

Translation only

Translation + slow CCW spinning

Translational + fast CCW spining

Translational + fast CW spining

We verify here if objects with different density in a liquid body would incur different magnitude of buoyancy. Here the red ball has a density of half of the water, where the blue ball shares the same density value of the water. It can be observed that the red ball would float on the water surface due to buoyancy.

Liquids are generally considered incompressible. Our MPM-based engine simulates weakly-compressible liquids, where the momentum and mass are updated every step via consecutive grid-particle-grid information transfer. We verify here that the simulated fluid bodies can maintain consistent pressure and volume through long-horizon simulations.

When objects are in collision, their motions obey conservation of momentum. Here we test the collision of two objects with exactly the same mass on a frictionless floor, where it can be observed that they exchanged their momentum after the collision as expected.

This phenomenon describes the instability of an interface between two fluids with different densities, which occurs when the heavy component is above and pushing the light one. Here we simulate the behavior of two layers of fluids with different densities, where it can be observed that a plume of heavy fluid with small vortices emerges and evolves due to the interfacial instabilities.

Here we show different behaviors of the object bouncing on the floor when we vary the plasticity of the object. From left to right, we increase the plasticity of the object. Our simulator can simulate bouncing behavior with varying plasticity, where it can be observed energy dissipates faster with a greater plasticity.

Elastic

Elasto-plastic

Plastic

```
@inproceedings{xian2023fluidlab,
title={FluidLab: A Differentiable Environment for Benchmarking Complex Fluid Manipulation},
author={Xian, Zhou and Zhu, Bo and Xu, Zhenjia and Tung, Hsiao-Yu and Torralba, Antonio and Fragkiadaki, Katerina and Gan, Chuang},
booktitle={International Conference on Learning Representations},
year={2023}
}
```