GithubHelp home page GithubHelp logo

ksenia007 / dlacluster Goto Github PK

View Code? Open in Web Editor NEW
35.0 1.0 9.0 6.25 MB

Python code for simple diffusion limited aggregation (DLA) simulation. The code provided creates a .gif for cluster growth and calculates fractal dimensionality of the cluster. User can vary the radius of the cluster.

License: MIT License

Python 100.00%
dla-model cluster fractal-dimension point-attractor brownian-tree

dlacluster's Introduction

DLA Cluster

Python code for DLA cluster simulation and calculating fractal dimensionality of the cluster.

Cluster formation

The movie (.gif) is a visual output for the DLA Cluster formation. In the beginning, a seed particle is added in the center. Then random walkers start at the specified radius from the center. They are added to the cluster if they reach it. If the random walker comes close to the edge of the field, it is removed. The cluster is considered complete once one of the cluster elements comes to the radius from which random walkers start.

To get this movie, you need to run file runner.py. To get different radius - vary the first parameter passed to the DLAcluster function. For example, this is a .gif file for a larger radius.

As we can see, the resulting cluster has a lot of holes and exhibits a branching behavior. This is understandable: if we add random walkers at the distance of the center and let them wander, there is a greater chance they will be added to the branches of the cluster as it grows.

To quantify this observation, we can find the fractal dimensionality of the cluster. This parameters arises from the scaling rules: consider the mass of the objects. We can see that for a line mass is proportional to r, and for disk to r2. Therefore, consider expression

log(m)=a log(r)+c

Then, a is the power of r. For fractals, we would expect a value between 1 and 2.

Indeed, running the DLA cluster for various radius, and finsing a fit through the points, we see that it is about 1.7

This result can be achieved by running fractalDimensionality.py

Note

Part of this code was used to complete the group assignment for Physics 566 (Computational Physics) class at Duke University, taught by Professor Steffen Bass. Team members: Ksenia Sokolova, Tahoe Schrader and Xinmeng Tong. The Github repository for the full assignment can be found here

Installing required packages

Most of the packages are easy to install through pip install (package) However, installing ffmpeg for saving .gif requires a separate procedure. (Only needed if passed "True" for DLAcluster function)

For Mac users: install ffmpeg through homebrew

  1. Install homebrew - folow the instructions on the link (The password required is the computer password)
  2. In the Terminal, type brew install ffmpeg This will install it automatically

Many cluster formations


It is insteresting to note, that all the gifs run out of order with respect to each other. This happens because every cluster needs variable time to run.

dlacluster's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.