Version 2, position dependent E/B, kinetic ions, boris mover, terminator

This commit is contained in:
Jonas Kellerer
2022-10-21 10:09:19 +02:00
parent acc55cf003
commit 83fd2e5d7e
869 changed files with 1033204 additions and 3634436 deletions
+48
View File
@@ -0,0 +1,48 @@
#include "simulation/unit_converter.h"
#include "constants/physical_constants.h"
#include "simulation/errors.h"
namespace unitConvertion {
double lengthPrefactor(const std::string& unit) {
if (unit == "cm") {
return 1E-2;
} else if (unit == "m") {
return 1;
} else if (unit == "mm") {
return 1E-3;
} else {
ERROR("I dont know this length unit.");
return 0;
}
}
double length(double value,
const std::string& unit_from,
const std::string& unit_to) {
double prefactor_from = lengthPrefactor(unit_from);
double prefactor_to = lengthPrefactor(unit_to);
return value * prefactor_from / prefactor_to;
}
double energyPrefactor(const std::string& unit) {
if (unit == "eV") {
return 1.;
} else if (unit == "J") {
return 1 / SI::e;
} else {
ERROR("I dont know this energy unit.");
return 0;
}
}
double energy(double value,
const std::string& unit_from,
const std::string& unit_to) {
double prefactor_from = energyPrefactor(unit_from);
double prefactor_to = energyPrefactor(unit_to);
return value * prefactor_from / prefactor_to;
}
}; // namespace unitConvertion