robkau / mlsmpm-particles-rs

MLS-MPM fluid simulation in two dimensions, in Rust with Bevy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mlsmpm-particles-rs

This is a 2D multi-phase Material Point Method simulation using Rust.
Currently two types of particles are supported:

  • Neo-Hookean Hyperelastic solid
  • Newtonian fluid

The simulation uses MLS-MPM algorithm (Moving Least Squares Material Point Method). My matching implementation in Go is mlsmpm-particles-go. Both repositories were implemented by following nialltl's article on MLS-MPM and matching example code.

Library bevy is used to render the output to a window and provide an Entity Component System with parallel processing.
Liby99's mpm-rs project inspired me to model MPM simulation inside an ECS.
Unlike mlsmpm-particles-go, this implementation in rust is parallelized and can fully utilize all CPU cores when enough particles are spawned.
The Bevy ECS is really ergonomic, all it took to implement parallel processing was calling the par_for_each methods and the rest happened automatically... after I made the Rust compiler happy.


Examples

Water, steel, and wood particles

outclip.mov
outclip2.mov
outclip3.mov

About

MLS-MPM fluid simulation in two dimensions, in Rust with Bevy.

License:MIT License


Languages

Language:Rust 100.0%