Skip to content

necocen/granular-clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Granular Clock Simulator

Demo

A simulator for the granular clock phenomenon [1]. When a mixture of two particle sizes is placed in a box with a low partition and subjected to vibration, the particle distribution on each side of the partition periodically reverses.

This program uses physics simulation to model the particle dynamics and visualizes the results with Bevy.

Live demo (runs in your browser): https://granular.necocen.info/
Supported browsers: Chrome and Firefox with WebGPU support (Safari is not currently supported)

Getting Started

Requires Rust (2024 edition or newer).

Running Locally

cargo run --release

Simulation parameters can be configured in simulation.toml. Once the binary is built, you can also run it directly with a different config file:

/path/to/granular-clock --config ./simulation.toml

Running in the Browser

Install Web support tooling:

rustup target add wasm32-unknown-unknown
cargo install trunk

Then run:

trunk serve

This will open the simulation in your browser. Note that the build is quite slow due to WASM size optimization.

When running in the browser, custom simulation.toml files cannot be passed at runtime.

Controls

Camera

  • Left mouse button drag: orbit
  • Right mouse button drag: pan
  • Mouse wheel: zoom

UI (top-right panel)

  • Switch physics backend: GPU / CPU
  • Adjust Substeps / Frame
  • Toggle oscillation and adjust amplitude/frequency
  • Adjust divider height
  • Adjust particle/wall contact parameters
  • Pause / Resume, Reset

References

  1. R. Lambiotte, J.M. Salazar, L. Brenig — From particle segregation to the granular clock, Physics Letters A, 343, 2005, 224

About

Granular clock simulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors