Physics simulation — DLA
Diffusion-limited aggregation (DLA) models how randomly diffusing particles stick together to form branching clusters—used in physics, materials science, and computer graphics.
Problem
Simulating DLA in a clear, repeatable way for coursework or demos: balance correctness (rules of random walk + aggregation) with performance so runs finish in reasonable time on typical hardware.
Solution
Implement the classic algorithm on a 2D lattice (or continuous variant): seed a cluster, release particles that perform random walks from a boundary or injection ring, and attach them on first contact with the cluster. Visualize growth frame-by-frame or as a final aggregate.
Impact
- Makes nonlinear growth and fractal-like structures tangible for students and stakeholders.
- Provides a baseline for comparing parameters (stick probability, lattice vs off-lattice, noise).
Lessons learned
- Early visualization beats staring at numeric logs: bugs in neighbor checks show up immediately.
- Injection strategy (where new walkers start) strongly affects runtime and cluster shape.
- For large clusters, consider optimized data structures (sparse maps, distance fields) before scaling particle count.
Tech stack
- Python for simulation logic and experimentation
- JavaScript Canvas for visualization/rendering