/** @file main.cpp * * @author Cory Alexander Balaton (coryab) * @author Janita Ovidie Sandtrøen Willumsen (janitaws) * * @version 0.1 * * @brief The main program for this project * * @bug No known bugs * */ #include #include #include #include #include #include "PenningTrap.hpp" #include "utils.hpp" #define PARTICLES 100 #define N 10000 #define CHARGE 1. #define MASS 40. // unit: amu Particle p1(CHARGE, MASS, vec_3d{20., 0., 20.}, vec_3d{0., 25., 0.}); Particle p2(CHARGE, MASS, vec_3d{25., 25., 0.}, vec_3d{0., 40., 5.}); void simulate_single_particle() { PenningTrap trap(std::vector{p1}); double time = 50.; // microseconds trap.write_simulation_to_dir("output/simulate_single_particle", time, N); } void simulate_two_particles() { PenningTrap trap_no_interaction(std::vector{p1, p2}); PenningTrap trap_with_interaction(std::vector{p1, p2}); double time = 50.; // microseconds trap_no_interaction.write_simulation_to_dir( "output/simulate_2_particles/no_interaction", time, N, "rk4", false); trap_with_interaction.write_simulation_to_dir( "output/simulate_2_particles/with_interaction", time, N); } void simulate_single_particle_with_different_steps() { double time = 50; // microseconds for (int i = 0; i < 4; i++) { int steps = 4000 * (i + 1); PenningTrap trap(std::vector{p1}); trap.write_simulation_to_dir("output/N_steps/RK4/" + std::to_string(steps) + "_steps", time, steps, "rk4", false); } for (int i = 0; i < 4; i++) { int steps = 4000 * (i + 1); PenningTrap trap(std::vector{p1}); trap.write_simulation_to_dir("output/N_steps/euler/" + std::to_string(steps) + "_steps", time, steps, "euler", false); } } void simulate_100_particles() { PenningTrap trap(100); double time = 50.; // microseconds trap.write_simulation_to_dir("output/simulate_100_particles", time, N); } int main() { double start = omp_get_wtime(); simulate_single_particle(); simulate_two_particles(); simulate_single_particle_with_different_steps(); simulate_100_particles(); double end = omp_get_wtime(); std::cout << "Time: " << end - start << " seconds" << std::endl; return 0; }