mesa-examples icon indicating copy to clipboard operation
mesa-examples copied to clipboard

Add Brownian particle diffusion example (continuous space)

Open yoginlangalia opened this issue 8 months ago • 0 comments

What this adds

A new example in the continuous space category, currently this section has no examples at all. The model simulates particles undergoing Brownian (random walk) motion in a torus-wrapped 2D space, with soft repulsion so they don't pile on top of each other.

Why I built this

I'm exploring the codebase and noticed the continuous space category was completely empty (the README literally says "No user examples available yet"). Seemed like a useful gap to fill, also a minimal reference for anyone wanting to use mesa.experimental.continuous_space without reading through a more complex example.

Files added

  • examples/brownian_particles/brownian_particles/agents.py :- Particle agent with random walk + soft repulsion
  • examples/brownian_particles/brownian_particles/model.py :- BrownianModel + BrownianScenario
  • examples/brownian_particles/app.py :- SolaraViz visualization, plasma colormap based on neighbor count
  • examples/brownian_particles/README.md :- description, how to run, parameters

How to run

cd examples/brownian_particles
solara run app.py

What I tested

Ran 10 steps with 20 and 80 particles, datacollector works, no errors on Python 3.13 + Mesa 3.5.1 + Windows.

Also updated README.md to replace the placeholder in the Continuous Space section.

Happy to adjust folder structure or naming if needed!

yoginlangalia avatar Mar 22 '26 19:03 yoginlangalia