Removed c++11 only functions
This commit is contained in:
@@ -94,7 +94,6 @@ Particle::Particle(double mass_eV, double charge_e,blitz::TinyVector<double,3> l
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
double Particle::borisFly_m(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVector<double, 3> B_T , double dt_s) {
|
double Particle::borisFly_m(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVector<double, 3> B_T , double dt_s) {
|
||||||
double distance_m;
|
double distance_m;
|
||||||
x_m += dt_s/2 * v_ms;
|
x_m += dt_s/2 * v_ms;
|
||||||
@@ -106,7 +105,6 @@ double Particle::borisFly_m(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVecto
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Particle::changeSpeedBoris(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVector<double, 3> B_T , double dt_s) {
|
void Particle::changeSpeedBoris(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVector<double, 3> B_T , double dt_s) {
|
||||||
{
|
|
||||||
blitz::TinyVector<double, 3> vMinus_ms, vPlus_ms, vPrime_ms, t, s;
|
blitz::TinyVector<double, 3> vMinus_ms, vPlus_ms, vPrime_ms, t, s;
|
||||||
double q_C = -1*Z * e_C;
|
double q_C = -1*Z * e_C;
|
||||||
double m_kg = m_eV*e_C/c_ms/c_ms;
|
double m_kg = m_eV*e_C/c_ms/c_ms;
|
||||||
@@ -117,5 +115,6 @@ void Particle::changeSpeedBoris(blitz::TinyVector<double, 3> E_Vm , blitz::TinyV
|
|||||||
vPrime_ms = vMinus_ms + cross(vMinus_ms,t);
|
vPrime_ms = vMinus_ms + cross(vMinus_ms,t);
|
||||||
vPlus_ms = vMinus_ms + cross(vPrime_ms,s);
|
vPlus_ms = vMinus_ms + cross(vPrime_ms,s);
|
||||||
v_ms = vPlus_ms + q_C/m_kg*E_Vm*0.5*dt_s;
|
v_ms = vPlus_ms + q_C/m_kg*E_Vm*0.5*dt_s;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
double borisFly_m(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVector<double, 3> B_T , double dt_s);
|
double borisFly_m(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVector<double, 3> B_T , double dt_s);
|
||||||
protected:
|
protected:
|
||||||
void changeLocFly(double dt_s);
|
void changeSpeedBoris(blitz::TinyVector<double, 3> E_Vm,blitz::TinyVector<double, 3> B_T , double dt_s);
|
||||||
void changeSpeedBoris(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVector<double, 3> B_T , double dt_s);
|
|
||||||
|
|
||||||
// Write Methods
|
// Write Methods
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ void Simulation::doit() {
|
|||||||
//Replace with vector containing all Interactions and adapt functions and put particle pointers into Particle class
|
//Replace with vector containing all Interactions and adapt functions and put particle pointers into Particle class
|
||||||
|
|
||||||
MFP_m = getMFP_m(IntereT2);
|
MFP_m = getMFP_m(IntereT2);
|
||||||
moveParticle(&particleQue.front(),MFP_m); // If moved outside set v = 0,0,0;
|
moveParticleBorisPush(&particleQue.front(),MFP_m); // If moved outside set v = 0,0,0;
|
||||||
|
|
||||||
switch (getInteraction(particleQue.front())) {
|
switch (getInteraction(particleQue.front())) {
|
||||||
case 0: //Moved Outside
|
case 0: //Moved Outside
|
||||||
@@ -117,7 +117,7 @@ double Simulation::FermiFunction(double Z, double Ekin_eV) {
|
|||||||
|
|
||||||
|
|
||||||
// Moving
|
// Moving
|
||||||
void Simulation::moveParticle(Particle *movePart, double MFP_m) {
|
void Simulation::moveParticleBorisPush(Particle *movePart, double MFP_m) {
|
||||||
blitz::TinyVector<double,3> oldLoc_m = movePart->getLoc_m();
|
blitz::TinyVector<double,3> oldLoc_m = movePart->getLoc_m();
|
||||||
blitz::TinyVector<double,3> E_Vm = Kat.getElField(oldLoc_m);
|
blitz::TinyVector<double,3> E_Vm = Kat.getElField(oldLoc_m);
|
||||||
blitz::TinyVector<double,3> B_T = Kat.getMagField(oldLoc_m);
|
blitz::TinyVector<double,3> B_T = Kat.getMagField(oldLoc_m);
|
||||||
@@ -131,9 +131,32 @@ void Simulation::moveParticle(Particle *movePart, double MFP_m) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logParticle(movePart,oldLoc_m);
|
logParticle(movePart,oldLoc_m);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Simulation::moveParticleDriftApproximation(Particle *movePart, double MFP_m) {
|
||||||
|
// Drift Approximation: Assume constant B and only movement out in z=0, z=wgtsLength_m...
|
||||||
|
blitz::TinyVector<double,3> oldLoc_m = movePart->getLoc_m();
|
||||||
|
blitz::TinyVector<double,3> newLoc_m = oldLoc_m;
|
||||||
|
double z_m = oldLoc_m[2];
|
||||||
|
double vz_ms = movePart->getSpeed_ms()[2];
|
||||||
|
double vdir = vz_ms < 0 ? -1 : 1;
|
||||||
|
double vznew_m = z_m + vdir*MFP_m;
|
||||||
|
|
||||||
|
if (vznew_m < 0) {
|
||||||
|
vznew_m = 0;
|
||||||
|
movePart->setSpeed_ms(zeroVec());
|
||||||
|
} else if (vznew_m > wgtsLength_m) {
|
||||||
|
vznew_m = wgtsLength_m;
|
||||||
|
movePart->setSpeed_ms(zeroVec());
|
||||||
|
}
|
||||||
|
newLoc_m[2] = vznew_m;
|
||||||
|
movePart->setLoc_m(newLoc_m);
|
||||||
|
logParticle(movePart,oldLoc_m);
|
||||||
|
}
|
||||||
|
|
||||||
double Simulation::getMFP_m(Interaction Interaction) {
|
double Simulation::getMFP_m(Interaction Interaction) {
|
||||||
//Rework for inserting vector of Interactions
|
//Rework for inserting vector of Interactions
|
||||||
blitz::TinyVector<double,3> loc_m;
|
blitz::TinyVector<double,3> loc_m;
|
||||||
@@ -156,7 +179,7 @@ int Simulation::getInteraction(Particle interPart) {
|
|||||||
if (interPart.getKinEnergy_eV()==0) {
|
if (interPart.getKinEnergy_eV()==0) {
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
return(0);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Termination
|
// Termination
|
||||||
@@ -169,13 +192,13 @@ bool Simulation::checkTermination(Particle termPart) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EKin_eV<=ETemp_eV) {
|
if (EKin_eV<=0.00001) {
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
void Simulation::initLogger(void) {
|
void Simulation::initLogger(void) {
|
||||||
// Set zLogValues;
|
// Set zLogValues;
|
||||||
@@ -195,6 +218,16 @@ void Simulation::initLogger(void) {
|
|||||||
std::cout<<"Logging "<<numberZBins<<" z-Values."<<std::endl;
|
std::cout<<"Logging "<<numberZBins<<" z-Values."<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string dirname = getDirName();
|
||||||
|
outStream = new std::ofstream [numberZBins];
|
||||||
|
|
||||||
|
for (int i = 0; i < numberZBins; i++)
|
||||||
|
{
|
||||||
|
std::string fileName = dirname + "/z=" + std::to_string(zLogValues[i]) + ".dat";
|
||||||
|
outStream[i].open(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::string Simulation::getDirName() {
|
||||||
std::string poub = getenv("poub");
|
std::string poub = getenv("poub");
|
||||||
std::string pname = getenv("pname");
|
std::string pname = getenv("pname");
|
||||||
int i = 1;
|
int i = 1;
|
||||||
@@ -215,12 +248,9 @@ void Simulation::initLogger(void) {
|
|||||||
std::cerr<<"Simulation::initLogger: Could not create folder "<<dirname.c_str()<<" for Logging."<<std::endl;
|
std::cerr<<"Simulation::initLogger: Could not create folder "<<dirname.c_str()<<" for Logging."<<std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < numberZBins; i++)
|
return(dirname);
|
||||||
{
|
|
||||||
std::string fileName = dirname + "/z=" + std::to_string(zLogValues[i]) + ".dat";
|
|
||||||
outStream.push_back(std::ofstream(fileName));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Simulation::getTimeString() {
|
std::string Simulation::getTimeString() {
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
struct tm * timeinfo;
|
struct tm * timeinfo;
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ protected:
|
|||||||
double FermiFunction(double Z, double Ekin_eV);
|
double FermiFunction(double Z, double Ekin_eV);
|
||||||
|
|
||||||
// Moving
|
// Moving
|
||||||
void moveParticle(Particle *movePart, double MFP_m);
|
void moveParticleBorisPush(Particle *movePart, double MFP_m);
|
||||||
|
void moveParticleDriftApproximation(Particle *movePart, double MFP_m);
|
||||||
double getMFP_m(Interaction Interaction);
|
double getMFP_m(Interaction Interaction);
|
||||||
bool movedOutside(blitz::TinyVector<double,3> loc_m);
|
bool movedOutside(blitz::TinyVector<double,3> loc_m);
|
||||||
|
|
||||||
@@ -55,9 +56,12 @@ protected:
|
|||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
bool logging;
|
bool logging;
|
||||||
std::vector<std::ofstream> outStream;
|
//std::vector<std::ofstream> outStream;
|
||||||
|
//std::ofstream outStream[];
|
||||||
|
std::ofstream *outStream;
|
||||||
std::vector<double> zLogValues;
|
std::vector<double> zLogValues;
|
||||||
void logParticle(Particle *logPart,blitz::TinyVector<double,3> oldLoc_m);
|
void logParticle(Particle *logPart,blitz::TinyVector<double,3> oldLoc_m);
|
||||||
|
std::string getDirName();
|
||||||
std::string getTimeString();
|
std::string getTimeString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user