zhouxian / FluidLab

[ICLR 2023] FluidLab: A Differentiable Environment for Benchmarking Complex Fluid Manipulation
148 stars 14 forks source link

Volume of the liquid decrease #9

Closed Naoki04 closed 9 months ago

Naoki04 commented 9 months ago

Hi, I made a 3D model of a jug (.obj), put it into asset/raw and I am using it as an end-effector(agent). However, I found that the volume of the liquid is shirinking during the simulation. I guess it is not just the decreasing gap between particles, as it does not happen with a provided cup model.

Do you have any advice or is there any stable way to build a 3D model for Fluidlab?

Naoki

↓Jug model https://drive.google.com/file/d/1OWJ7BJ89PibEVCNEccZ5W9uMH42RTgvO/view?usp=sharing

↓Video https://youtu.be/-F7hzCmXxzI

zhouxian commented 9 months ago

Hi,

This shrinking is a inherent problem of MPM. MPM is a hybrid method that changes its representation back and forth using particles and grids. Theoretically, the collision should happen only using the grid option to preserve physical properties such as momentum and volume. However, using grid alone would result in coarse spatial resolution (I believe here we are using a 64x64x64 grid), and there will be penetrations when handling collision between the rigid body and MPM particles. This is not a problem if we use a dense enough grid, but simulation speed will be super slow.

So here, we are trading off between simulation result and compute, using both the grid and particle representation to handle collision with the cup to avoid penetration. However, collision during the particle stage could result in gradually reduced volume.

At the current stage, I would recommend keeping the pouring task relatively short-horizon, or using a thick enough cup (to avoid penetration) and change the collision type to grid only. (see https://github.com/zhouxian/FluidLab/blob/56348da2ac22598fb46097ded0ee85b805602344/fluidlab/fluidengine/simulators/mpm_simulator.py#L420)

BTW, I am not sure what your exact need is and your timeline is like, but in case your need for fluid simulation is not urgent, this repo(https://github.com/Genesis-Embodied-AI/Genesis) might be of interest to you. It's a superset of FluidLab with a lot more features (we added higher-fidelity fluid simulation using PBD and SPH, which are purely particle-based and won't encounter such shrinking problem), and way easier to use. We expect to release it in 2~3 months.

Naoki04 commented 9 months ago

Thank you for your reply and kind explanation about the problem. I am looking foward to see your new work!