RD_CLI module

This code was written initially for the Graduate Student Seminar [Che23a]

RD_CLI.Ballistic_Deposition(width, height, steps)

Simulate Ballistic Deposition on a substrate. In this simulation, particles stick upon contact with the substrate or a deposited particle.

This is simulation for snowflakes piling.

Parameters:
  • width (int) – Width of the substrate.

  • height (int) – Height of the substrate.

  • steps (int) – Number of particles to drop.

Returns:

Filename of the output substrate for Ballistic Deposition; A csv file contains the substrate state.

Return type:

string

RD_CLI.Envelop(substrate)

Compute the top envelope of a substrate.

This function calculates the highest particle position in each column of the substrate. It is used to visualize the top envelope of the substrate in the simulation.

Parameters:

substrate (numpy.ndarray) – The substrate matrix to compute the envelop for.

Returns:

Array representing the top envelope of the substrate.

Return type:

numpy.ndarray

RD_CLI.Random_Deposition(width, height, steps)

This is a function to simulate Random Deposition on a substrate. This is simulation for the independent boxes (sand) piling. All columns are independent.

Parameters:
  • width (int) – Width of the substrate.

  • height (int) – Height of the substrate.

  • steps (int) – Steps or times to run.

Returns:

Filename of the output substrate.

Return type:

string

RD_CLI.Random_Deposition_Surface_Relaxation(width, height, steps)

This is a function to simulate Random Deposition on a substrate with the surface relaxation. Particle will seek the lowest left/right neighbors to land.

This is simulation for the independent boxes (sand) piling with surface relaxation.

Parameters:
  • width (int) – Width of the substrate.

  • height (int) – Height of the substrate.

  • steps (int) – Steps or times to run.

Returns:

Filename of the output substrate.

Return type:

string

RD_CLI.interface_width(filename)

Compute and visualize the interface width of a substrate from a given simulation.

This function reads the substrate state from a file, calculates the interface width over time, and generates a log-log plot of the interface width. It also computes the slope of the log-log plot as a function of time.

Parameters:

filename (str) – The name of the file containing the substrate data.

Returns:

Array containing the interface width calculated at each step; An image file with the same name as the input file, but with a .png extension. The file contains the statistical figures.

Return type:

numpy.ndarray

RD_CLI.main()

The main function to simulate different types of surface growth models based on the provided command-line arguments.

This function sets up a command-line interface for simulating Random Deposition, Random Deposition with Surface Relaxation, or Ballistic Decomposition on a substrate. It accepts various parameters like width, height, and number of steps for the simulation. It also provides options for generating a movie of the simulation and calculating interface width.

The function decides the type of simulation based on the arguments passed, performs the simulation, and then proceeds to calculate the interface width. If the movie generation option is selected, it invokes another script to generate the movie.

To use the script from terminal, the following options are expected:

-w, --width

: Width of the substrate (default: 100)

-e, --height

: Maximum height of the substrate (default: 60)

-s, --steps

: Number of particles to drop (default: 5000)

-r, --relax

: Enable surface relaxation (default: False)

-b, --BD

: Enable ballistic decomposition (default: False)

-m, --movie

: Generate an mp4 movie of the simulation (default: False)

It returns:

  1. A text file representing the substrate state.

  2. Statistical figures, including a log-log plot for the interface width and the estimated slope.

  3. (Optional) An mp4 movie of the simulation process.

Example:

> ptyhon3 RD_CLI.py -w 100 -e 60 -s 5000 --BD --movie

In this example, the script will simulate Ballistic Decomposition on a substrate of size 100x60 for 5000 steps. And the simulation movie will be generated.