Coryab/code #10

Merged
coryab merged 37 commits from coryab/code into develop 2023-10-24 10:45:33 +00:00
Showing only changes of commit 16d7622283 - Show all commits

View File

@ -13,7 +13,6 @@
#include <cmath> #include <cmath>
#include <complex> #include <complex>
#include <fstream> #include <fstream>
#include <ncurses.h>
#include <omp.h> #include <omp.h>
#include <string> #include <string>
#include <vector> #include <vector>
@ -94,9 +93,10 @@ void simulate_single_particle_with_different_steps()
// Calculate relative error for RK4 // Calculate relative error for RK4
std::string path = "output/relative_error/RK4/"; std::string path = "output/relative_error/RK4/";
mkpath(path); mkpath(path);
#pragma omp parallel for #pragma omp parallel for private(ofile)
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
int steps = 4000 * std::pow(2, i); int steps = 4000 * std::pow(2, i);
std::cout << steps << std::endl;
double dt = time / (double)steps; double dt = time / (double)steps;
ofile.open(path + std::to_string(steps) + "_steps.txt"); ofile.open(path + std::to_string(steps) + "_steps.txt");
PenningTrap trap(std::vector<Particle>{p1}); PenningTrap trap(std::vector<Particle>{p1});
@ -112,7 +112,7 @@ void simulate_single_particle_with_different_steps()
// Calculate relative error for forward Euler // Calculate relative error for forward Euler
path = "output/relative_error/euler/"; path = "output/relative_error/euler/";
mkpath(path); mkpath(path);
#pragma omp parallel for #pragma omp parallel for private(ofile)
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
int steps = 4000 * std::pow(2, i); int steps = 4000 * std::pow(2, i);
double dt = time / (double)steps; double dt = time / (double)steps;