*“Experiments are as good as your instruments and simulations are as good as your assumptions”* – Prof. D. K. Ferry, Arizona State University

This post will discuss the basics of simulation (done by writing a code in any of the many programming languages). There are numerous tutorials on the web and there is no dearth of good books on this subject hence I will keep it very simple. The following figure will help in the discussion.

Imagine you have a rectangular surface of length ‘L’ (along x-axis) and width ‘W’ (y-axis) and you need to model some physical process in that region. The idea is to divide the region of interest into many points (grid) and solve equations describing the physical process at each grid point and this would tell us how the physical process would behave within the rectangle.Now one of the first things to do is to decide on a suitable grid size, i.e. the distance between two grid points (indicated by ‘a’ in the above diagram). The grid size should be small enough to capture the intricacies of the process, i.e. smaller than the characteristic distances within which interesting phenomenon occur but it should not be too small (more on it in the next paragraph). In this case a grid size of ‘a’ divides the width into ‘k’ points (k-1=W/a) and length into ‘m’ points (m-1=L/a). Thus any point in the rectangle can be represented by a 2 element co-ordinate system. For example the red dot is (3,4), i.e. 3rd row and 4th column. Sometimes it would be convenient/efficient to use a radial co-ordinate system (r,θ).

Now comes the computation: the above paragraph indicates that in total we have ‘m × k’ points and the equations describing the physical process must be solved at each of these points. This leads to the lower limit of the grid size. If it is too small then the number of points where one must perform computation increases hyperbolically; very soon your code’s run time will get increasingly uncomfortable and your program/computer may run out of memory. The initial tests of your simulation should be aimed at determining an optimum grid size. Note: In some cases the grid size may have one value for the horizontal axis and a different value for the vertical axis, in this case the grid size will be ‘a× b’ where ‘a’ is the grid size along length and ‘b’ is the grid size along width. And there are cases where the grid size may be variable, i.e. small in areas of interest and large in nonessential areas.

As some of you may have noticed this is a 2 dimensional (2D) simulation since there are two length based attributes in our region of interest, namely the length and the width. This can be expanded to perform a 3 dimensional (3D) simulation by solving the equations along the z-axis also but be prepared to compute in at least ‘m × k × p’ points! and not to mention the visualization problems while handling a quantity in 3D space. Note: In 3D, there are at least 4 entities to handle out of which three are the distances (dimensions). Also note that this type of grid is also known as mesh or lattice system and this type of simulation is also known as discretization.

In my case I am interested in solving the Schrodinger equation in a 2D system whose size is typically in the order of few 100 nm by few tens of nm with a grid size of about 1 nm (nm = nanometer). This will allow me to see quantum effects that happen in the scale of few nm.

In the end one has to remember that in any simulation you get what you put in. If you ever feel you are seeing new phenomenon then all it means is that either you did not completely understand your system dynamics/equations or there is an error in the code or data. In most cases it will be the latter 😦