Ceyron / machine-learning-and-simulation

All the handwritten notes 📝 and source code files 🖥️ used in my YouTube Videos on Machine Learning & Simulation (https://www.youtube.com/channel/UCh0P7KwJhuQ4vrzc3IRuw4Q)
MIT License
840 stars 177 forks source link

Stable fluids Python with free surface and polygonal convex boundary #11

Closed mhechthz closed 1 year ago

mhechthz commented 1 year ago

I really like your videos on fluid flow simulation.

I wonder if the stable_fluids_python_simple.py code could be changed to

a) have a free surface b) have a non squared but polygonal, i.e. piecewise linear convex boundary, e.g. an hexagon

I would then fill the polygon much less than 100%. This would give the possibility to have a realistic liquid simulation for games, e.g. to simulate waves, and within a more irregular (realistic) domain than a rectangle.

Would this be possible with the proposed approach?

Ceyron commented 1 year ago

Hi,

probably something like this is possible, but from my experience it is better to use Lagrangian fluid simulation techniques (like SPH) to simulate free-surface flows. Another advantage is that SPH also works with arbitrary domains and obstacles.

Hope that helps 😊