python3 -m pip install numpy
python3 -m pip install matplotlib
- Download and install OVITO from: https://www.ovito.org/
python 3.8
Everything is configured by modifying config.json
. Available configuration keys are:
dynamic_file
: dynamic file filepathsimulation_file
: animation file filepathosc
: configurations for damped oscillatoralgo
: name of the algorithm to usemass
: particle massk
: coefficient of the restoring forcegamma
: characteristic gamma quantitytf
: end time of simulationr0
: initial positionA
: oscillator amplitude
rad
: configurations for radiation interaction systemalgo
: name of the algorithm to usemass
: particle massk
: Coulomb's constantN
: number of static particles per dimension (NxN matrix)D
: distance between static particlesQ
: particle chargev0
: particle initial horizontal velocityuse_seed
: if true use fixed seed, if false use nanosecondsseed
: fixed seed value
delta_t_sim
: timestep between simulation measurementsdelta_t_print
: timestep between simulation prints to filedelta_t_anim
: timestep between animation prints to fileplot
: determines whether to plot or not single analysis, must be true or false
To generate executable and run damped oscillator simulation
- Run
./prepare.sh
in root to generate executables (only required once). - Run
./target/tp4-simu-1.0/damped-osc.sh -Dalgo=algo -Ddt=dt
. Parameters fromconfig.json
can be overwritten by usingalgo
anddt
properties.
Output will be printed to dynamic_file
, showing time and particle position and velocity for each timestep.
Generate plots and metrics given a single simulation file as input.
Run python3 analysisOsc.py [file_1 file_2 ...]
, using parameters from config.json
.
If one or more filenames are provided, analysis will be performed individually and then condensed for multiple simulations. This can be used to provide one simulation file for each available algorithm. If plot is false, then no graphs are plotted.
Metrics calculated for each simulation are:
- ECM
Plots shown are:
- Analytic trajectory + estimated trajectory for each simulation file.
This script can be used to run damped-osc
simulation multiple times, given a starting timestep value, a step to increase dt each iteration and a maximum dt.
./multipleDtOsc.sh dt_start dt_step dt_end
The script runs three simulations for each available dt from dt_start
to the highest dt_start + K * dt_step
that is lower or equal than dt_end
using Verlet, Beeman and Gear Predictor-Corrector 5 respectively. Then, it runs analysisOsc.py
with the three output datafiles as parameters.
Contains obtained values using the previously mentioned script. It is used to plot ECM = f(dt) for the three algorithms at once. Values should be copied manually to the corresponding lists.
To generate executable and run damped oscillator simulation
- Run
./prepare.sh
in root to generate executables (only required once). - Run
./target/tp4-simu-1.0/radiation-interaction.sh -Ddt=dt -Dv0=v0
. Parameters fromconfig.json
can be overwritten by usingdt
andv0
properties.
Output will be printed to dynamic_file
, showing time and particle position and velocity for each timestep.
Generates simulation_file
using information from dynamic_file
.
Run python3 animator.py [dynamic_file]
, using the parameters from config.json
. If provided, param overwrites dynamic_file
from config.
To view the animation, you must open simulation_file
with Ovito:
./bin/ovito simulation_file
.
Particle color shows whether charge is positive (red) or negative (black).
Configure the file column mapping as follows:
- Column 1 - Radius
- Column 2 - Position - X
- Column 3 - Position - Y
- Column 4 - Particle Identifier
- Column 5 - Color - R
- Column 6 - Color - G
- Column 7 - Color - B
Generate plots and metrics given a single simulation file as input.
Run python3 analysisRad.py [file_1 file_2 ...]
, using parameters from config.json
.
If one or more filenames are provided, analysis will be performed individually and then condensed for multiple simulations. This can be used to provide one simulation file for each timestep or v0, or to use multiple repetitions for each value. If plot is false, then no graphs are plotted.
Metrics calculated for each simulation are:
- Total trajectory length (L)
- Sum of total energy difference (sum of |ET(0)-ET(t)|)
- Average of total energy difference
- Ending motive
Plots shown are:
- |ET(t=0) - ET(t>0)| = f(t) with log scale
- L = f(t)
- Particle trajectory
If multiple files are provided, some more metrics are calculated are:
- Average total energy difference for all files (mean±stdev)
- Average total trajectory length for all files (mean±stdev)
- Average number of steps for all files (mean±stdev)
- Ending count for each possible ending motive
And some more plots are shown:
- |ET(t=0) - ET(t>0)| = f(t) with log scale for each dt
- Average |ET(t=0) - ET(t>0)| = f(t) with error bars for each dt
- Multiple particle trajectories (both with dt and v0 in legend)
This script can be used to run simulation multiple times, given a starting timestep value, a step to increase dt each iteration, a maximum dt and a number of repetitions.
./multipleDtRad.sh dt_start dt_step dt_end rep
The script runs rep
simulations for each available dt from dt_start
to the highest dt_start + K * dt_step
that is lower or equal than dt_end
. Initial velocity is set to 10e3
. Then, it runs analysisRad.py
with the rep
output datafiles as parameters for each dt.
This script can be used to run radiation-interaction
simulation multiple times, given a step to increase v0 each iteration and a number of repetitions.
./multipleV0.sh v0_step rep
The script runs rep
simulations for each available v0 from 10e3
to the highest 10e3 + K * v0_step
that is lower or equal than 100e3
. Timestep is set to 1e-16
. Then, it runs analysisRad.py
with the rep
output datafiles as parameters for each v0.
Contains obtained values using the previously mentioned script. It is used to plot L = f(V0) for different initial velocities at once and a probability distribution for each ending motive. Values should be copied manually to the corresponding lists.