bevy-sph 0.1.0

A Smoothed Particle Hydrodynamics (SPH) simulation using Bevy
Documentation
  • Coverage
  • 25.45%
    28 out of 110 items documented0 out of 10 items with examples
  • Size
  • Source code size: 6.59 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 9.49 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3m 38s Average build duration of successful builds.
  • all releases: 3m 38s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • AOS55/bevy-sph
    8 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • AOS55

Bevy SPH Simulator

A Smoothed Particle Hydrodynamics (SPH) fluid simulation implemented in Rust using the Bevy game engine. The simulation includes airfoil aerodynamics and real-time visualization capabilities. I built this to test Bevy's parallel processing capabilities.

Demo

Features

  • Real-time SPH fluid simulation
  • Interactive airfoil with configurable parameters
  • Multiple visualization modes:
    • Velocity field
    • Pressure distribution
    • Density field
  • Camera controls for panning and zooming
  • Particle pooling for efficient memory management
  • Spatial partitioning for optimized collision detection

Requirements

  • Rust
  • Cargo, installed with above Rust install.

Installation

Clone the repository and build with Cargo:

git clone https://github.com/AOS55/bevy-sph
cd bevy-sph
cargo build --release

Running Examples

The project includes two example simulations:

  1. Basic ball physics:
cargo run --example 1-ball_physics
  1. SPH Airfoil simulation:
cargo run --example 2-SPH_Airfoil

Controls

  • Arrow keys: Pan camera
  • +/- keys: Zoom in/out
  • Tab: Cycle through visualization modes (Velocity → Pressure → Density)

Configuration

The simulation parameters can be customized in lib.rs. Key parameters include:

  • Fluid properties (density, viscosity, etc.)
  • Particle properties (size, count, spawn rate)
  • Domain size and freestream velocity
  • Airfoil properties (angle of attack, chord length)

License

MIT OR Apache-2.0

Performance Notes

The simulation uses spatial partitioning and parallel processing for optimal performance. For best results, run in release mode:

cargo run --release --example 2-SPH_Airfoil