Random Diffusion in 2D¶
Authors: Guoyuan Liu, Dou Du, Taylor Baird and Giovanni Pizzi
Source code: https://github.com/osscar-org/quantum-mechanics/blob/master/notebook/statistical_mechanics/diffusion_2d.ipynb
Goals¶
- Understand the random diffusion process, inspecting it in two dimensions
- Understand the connection between microscopic kinetics and macroscopic observables
- Learn how to extract diffusion coefficients from the simulation of an ensemble of particles
Background Theory¶
Tasks and exercises¶
- Using the default parameters, click the "Simulate" button. Then, play the simulation. Compare the global behavior and the path of an individual point, what do you observe? (The individual path of one of the particles can be displayed clicking on the "Show trajectory" check box on the bottom left.)
- What statistical distribution should the diffusion pattern obey? See if the red analytical curve drawn in the top-right plot (projecting the motion in 1D, on the x axis) agrees with your expectations.
- How can the diffusion coefficient $D$ be obtained from the global (macroscopic) pattern observed?
Interactive visualization¶
Be patient, it might take a few seconds to load! Once loaded:
- select the simulation parameters
- press the "Simulate" button
- then use the play/pause/stop/loop buttons to visualize the simulation results
Legend¶
Interactive Figures¶
- The top-left plot is the main plot showing directly the Brownian diffusion of free particles in 2D.
- The green circle has radius $r_{std}$ related to the standard deviation of the distance of all particles from the starting point at $t=0$: the value at time $t$ is given by $r_{std}^2 (t) = \sum_{i=1}^N |\textbf{r}_i(t)|^2 / N$, where $N$ is the number of particles and $\textbf{r}_i(t)$ is the vector of the position of the $i-$th particle at time $t$.
- The red circle has radius $r_l$ given by $\sqrt{2t} l$, where $t$ is the current step number (i.e., the time from the start of the simulation) and $l$ is the step size.
- Optionally, using the tick boxes below the plots, one can also show:
- the trajectory of one of the particles, displaying the position every 100 simulation steps
- a 2D density map of the expected probability distribution of finding particles in a given region in space
- The top-right plot shows the 1D histogram of the position particles along the x direction, integrating all particles along the y direction. The expected analytical Gaussian distribution is also displayed, where its standard deviation is obtained from its expected value (dependent on the step size and the current step index, like $r_l$).
- The bottom-right plot shows the dependency of $r_{std}^2$ as a function of the time step number $t$. The data points are shown every 500 steps, with the current step displayed in green. The red dashed line is the result of linear regression on the data ("fit").
Controls¶
The panel in the lower left corner controls all 3 plots. The top three sliders set, respectively, the number of points, the step size and the total number of steps for the diffusion simulation. Choose the value as you wish and then click "Run" to run the simulation in the background. To visualize the results, use the play button next to it. Note that all 3 plots are synced with the time step.
The bottom three widgets control the visualization. The time step slider allows to quickly jump to a specific step of the simulation.