Skip to content

Add Brownian particle diffusion example (continuous space)#433

Open
yoginlangalia wants to merge 6 commits intomesa:mainfrom
yoginlangalia:add-brownian-particles
Open

Add Brownian particle diffusion example (continuous space)#433
yoginlangalia wants to merge 6 commits intomesa:mainfrom
yoginlangalia:add-brownian-particles

Conversation

@yoginlangalia
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant