https://github.com/wpbonelli/dla
diffusion-limited aggregation on a square grid
https://github.com/wpbonelli/dla
brownian-motion brownian-tree diffusion-limited-aggregation fractal random-walk simulation
Last synced: 3 months ago
JSON representation
diffusion-limited aggregation on a square grid
- Host: GitHub
- URL: https://github.com/wpbonelli/dla
- Owner: wpbonelli
- Created: 2022-04-14T22:15:55.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-13T22:50:48.000Z (over 3 years ago)
- Last Synced: 2025-05-05T01:09:04.048Z (5 months ago)
- Topics: brownian-motion, brownian-tree, diffusion-limited-aggregation, fractal, random-walk, simulation
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DLA Simulation
- [Installation](#installation)
- [Usage](#usage)
- [Optimizations](#optimizations)
- [Outputs](#outputs)A basic diffusion-limited aggregation simulation on a square grid.
## Installation
The most portable way to run this simulation is Docker. A public image is available on Docker Hub at [`wbonelli/dla`](https://hub.docker.com/r/wbonelli/dla).
To use Python instead of Docker, make a fresh environment with your tool of choice (e.g. `venv`, Anaconda), then install the packages in `requirements.txt` (e.g., `pip install -r requirements.txt`).
## Usage
At its simplest, the script can be invoked with:
```shell
python dla.py
```By default a 100x100 grid will be used, with 100 particles (walkers), and sticking probability unity. Each of these parameters can be provided explicitly as well:
- `--side (-s)`: The length of a side of the square grid
- `--mass (-m)`: The number of walkers to attach to the cluster
- `--prob (-p)`: The probability of a walker to stick to an adjacent cluster cellFor instance, to use a 200x200 grid with 1000 walkers and a 50/50 chance of sticking:
```shell
python dla.py -s 200 -m 1000 -p 0.5
```## Optimizations
None, save for boundary-aware step selection, i.e., not wasting cycles bumping into walls.
## Outputs
A GUID is generated each time the script is invoked. This GUID is written with status messages to `stdout` and forms the stem of the names of the output files produced by each invocation.
When a cluster is completed and a trial ends, the cluster's mass (M) and mean radius of gyration (R) are calculated, printed, and persisted to file:
- `{guid}.png`: a plot of the fully grown cluster (with M and R overlaid)
- `{guid}.csv`: a 1-line, 2-value CSV file whose first value is M, second is RThese quantities are helpful in estimating fractal dimension.