Diffusion Simulation using particle dynamics
Includes discretized simulations following ficks law, brownian motion modeled by random walks (wierner process) and step-based simulations of elastic collisions.
The graph below shows the concentrations of a disretized simulation in a 1-D line. The concentrations should become uniform over time.
The gif below shows the same simulation but with the wierner process:
The gif below show the simulation done for elastic particle collisions
Generate data using the datagen.py file:
python datagen.py <wierner/collision> <width> <height> <num particles> <timesteps> <dt> <output path>
- weiner will use the wierner process to generate data (faster), collision will use elastic collusions (slower)
- width and height are the dimensions of the simulation
- num particles will place that many particles uniformly into the simulation space (for the collision simulation the velocity is chosen randomly from [0,1]).
- timesteps is how many timesteps to simulate
- dt is the amount of time that will elapse for each timestep
The analysis tool allows users to query the simulation data within a specified bounding box. Users can specify timestep ranges of interest, including the interpolated position of particles within fractional timesteps.
python query_simulation.py python <input filename> <left> <right> <top> <bottom> <start time> <end time>
- numpy
- scipy
- matplotlib