tum-pbs / PhiFlow

A differentiable PDE solving framework for machine learning
MIT License
1.39k stars 189 forks source link

Code of Writing Fluid Simulations in ΦFlow doesn't work #143

Closed whw-alex closed 9 months ago

whw-alex commented 9 months ago

Can you please provide the complete code of https://tum-pbs.github.io/PhiFlow/Fluid_Simulation.html? I tried to run the first code block but got ValueError: could not convert string to float: 'periodic'. Thanks!

holl- commented 9 months ago

Right, you need to run

!pip install phiflow

before the first cell. I'll add it to the notebook

whw-alex commented 9 months ago

I installed phiflow but still got that error.

holl- commented 9 months ago

If you run this in a clean notebook, it should work. Which version are you running? You can check with phi.verify(). If you have version 3.0 installed, this is in development and experimental. In that case, please downgrade to 2.5.1

whw-alex commented 9 months ago

I run it in a clean notebook and the first error is now gone. But I can't run the code plot(field.curl(velocity_trj), animate='time', same_scale=False) in my notebook. The error is CalledProcessError: Command '['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '1200x500', '-pix_fmt', 'rgba', '-framerate', '10.0', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-y', '/tmp/tmpjs46q90w/temp.m4v']' returned non-zero exit status 1. But I have installed ffmpeg 4.3 in my virtual environment. I wonder if you know how to solve this problem. Thanks!

holl- commented 9 months ago

Sorry, this is a matplotlib / ffmpeg problem and I'm not familiar enough with these libraries to see the issue. You could try saving a matplotlib video from their demos.