Question: Diffusion-limited aggregation (DLA): Write a program to simulate diffusion-limited aggregation. In DLA, we assume that freely diffusing particles stick to a nucleus as soon as

Diffusion-limited aggregation (DLA): Write a program to simulate diffusion-limited aggregation. In DLA, we assume that freely diffusing particles stick to a nucleus as soon as they encounter it. Such a system can be simulated in a computer using a Monte-Carlo approach. The basic idea is as follows: Seed M particles randomly on an NxN lattice. Place a sticky particle at the center of the lattice. Move particles by picking a random particle and moving it in a random direction. If the particle encounters a sticky particle (i.e. if the nearest neighbor of the new position of the particle is sticky), the particle becomes sticky itself. Sticky particles cannot move anymore, the stay where they got stuck. An outline of such a program may look as follows: Write a function to initialize the lattice. Inputs: M, N, Outputs: the lattice and list of moveable particles. The trick here is how to store the lattice. The simplest way would seem to have a 2D array, with 1 where there is a particle and 0 where there is an empty spot. This by itself would make it difficult, though, to pick a random particle as we would have to search a mostly empty lattice to find a particle we would like to move. For this reason, it is handy to keep a list of moveable particles as a separate array, from which to pick a particle at random. The initialization should generate both the lattice and the list. Other considerations: o We also have to place a nucleus (sticky particle). This can be achieved by storing a -1 in the lattice. Later, as particles stick to the nucleus, they will be switched from a positive to a negative to indicate that they are now sticky. o We must decide if we allow several particles on one lattice site. It may be easier to do so. In that case, the lattice will be allowed to also contain numbers like 2 or 3, depending on how many particles are on a lattice site. Write a function that moves the particle. Inputs: Lattice and list. Output: Lattice and list. This function picks a random particle from the list, moves it in a random direction (up, down, left, right), checks if the particle encounters a sticky particle (i.e. if a sticky particle becomes the particles new nearest neighbor). When a particle becomes sticky it is removed from the list (not from the lattice!). Finally, update the list and the lattice. Write a function that plots the lattice: Input: Lattice. Output: None, but it generates a plot. This function should plot the lattice. Moveable particles will be indicated by one color, sticky particles by another. Write a master program that uses the three functions to simulate DLA.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!