Add Brownian particle diffusion example (continuous space)#433
Open
yoginlangalia wants to merge 6 commits intomesa:mainfrom
Open
Add Brownian particle diffusion example (continuous space)#433yoginlangalia wants to merge 6 commits intomesa:mainfrom
yoginlangalia wants to merge 6 commits intomesa:mainfrom
Conversation
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_spacewithout reading through a more complex example.Files added
examples/brownian_particles/brownian_particles/agents.py— Particle agent with random walk + soft repulsionexamples/brownian_particles/brownian_particles/model.py— BrownianModel + BrownianScenarioexamples/brownian_particles/app.py— SolaraViz visualization, plasma colormap based on neighbor countexamples/brownian_particles/README.md— description, how to run, parametersHow to run
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.mdto replace the placeholder in the Continuous Space section.Happy to adjust folder structure or naming if needed!