Slight changes in Driftapproximation:

1) Spectrometer will reflect electrons.
2) Taking into account radial movement leading to smaller delta z.
This commit is contained in:
Christian
2019-03-11 16:00:49 +01:00
parent 57fc377d7c
commit 0c722147f5
9 changed files with 86 additions and 91 deletions
+31 -53
View File
@@ -11,6 +11,8 @@
#include "myexeption.h"
#include "fstream"
using namespace std;
@@ -32,7 +34,7 @@ void Simulation::doit() {
status_updater();
oldLoc_m = electronQue.front().getLoc_m();
move_electron(&electronQue.front());
Log.logElectron(&electronQue.front(), oldLoc_m);
Log.log_Electron(&electronQue.front(), oldLoc_m);
do_interaction(&electronQue.front());
if (Kat.get_Terminated (electronQue.front())) {
@@ -41,64 +43,23 @@ void Simulation::doit() {
}
};
/*
void Simulation::doTC6() {
cout<<endl<<"Simulation::doTC6: Doing Testcase 6."<<endl<<endl;
stringstream fileName;
fileName << Log.getDirName() << "/TC6all.dat";
ofstream outTC6;
outTC6.open (fileName.str().c_str());
parameterCheck_TC6();
blitz::TinyVector <double,3> loc_m;
while ( (numberElectrons < numTotalElectrons) || (electronQue.size() > 0) ) {
if (!electronQue.empty()) {
throw MyException("Simulation::doTC6: electronQue should be empty");
}
electronQue.push_back(Kat.injectElectron(numberElectrons, &rngUni, &rngNormal));
numberElectrons++;
if (numberElectrons%100 == 0){
cout<<numberElectrons<<"/"<<numTotalElectrons<<endl;
}
if (propagationMethod==0) {
moveElectronDriftApproximation( &electronQue.front() , getMFP_m(electronQue.front()) );
} else if (propagationMethod==1) {
moveElectronBorisPush(&electronQue.front(),getMFP_m(electronQue.front())); // If moved outside set v = 0,0,0;
} else {
stringstream ss;
ss<<"Simulation::doTC6(): propagationMethod= "<<propagationMethod<<" not valid.";
throw MyException(ss.str());
}
loc_m = electronQue.front().getLoc_m();
switch ( electronQue.front().roll_Interaction(Kat.getFlowSpeedT2_ms(loc_m),&rngUni) ) {
case 0: //Moved Outside
break;
case 1: // Elastic Scattering
throw MyException("Simulation::doTC6(): Elastic Scattering should be turned off.");
break;
case 2: // Ionization
electronQue.push_back( electronQue.front().do_Ionization(Kat.getTotSpeedT2_ms(loc_m, &rngUni, &rngNormal), numberElectrons, &rngUni) );
numberElectrons++;
electronQue.pop_front();
break;
default:
throw MyException("Simulation::doit(): getprocess() returned unknown event");
break;
}
outTC6 << electronQue.front() <<endl;
electronQue.pop_front();
electronQue.push_back(Kat.injectElectron(numberElectrons++, &rngUni, &rngNormal));
do_interaction(&electronQue.front()); //parameter should only allow for ionizations
electronQue.pop_front(); // delete initial electron
Log.log_Electron(&electronQue.front(), vec3(0,0,0)); //should be daugther electron
electronQue.pop_front(); //delete daugther electron
}
outTC6.close();
};
*/
void Simulation::status_updater() {
if (numberElectrons%100 == 0){
if (updater_numberOfPrevious!=numberElectrons) {
@@ -115,14 +76,15 @@ void Simulation::move_electron(Electron *moveElectron) {
Kat.do_BorisPush(moveElectron); // If moved outside set v = 0,0,0;
} else {
stringstream ss;
ss<<"Simulation::doit(): propagationMethod= "<<propagationMethod<<" not valid.";
ss<<"Simulation::move_electron: propagationMethod="<<propagationMethod<<" not valid.";
throw MyException(ss.str());
}
}
void Simulation::do_interaction(Electron *interactElectron) {
vec3 newLoc_m = electronQue.front().getLoc_m();
switch ( interactElectron->roll_Interaction(Kat.getFlowSpeedT2_ms(newLoc_m),&rngUni) ) {
int process = interactElectron->roll_Interaction(Kat.getFlowSpeedT2_ms(newLoc_m),&rngUni);
switch ( process ) {
case 0: //Moved Outside
break;
case 1: // Elastic Scattering
@@ -136,7 +98,23 @@ void Simulation::do_interaction(Electron *interactElectron) {
case 3: // Recombination
break;
default:
throw MyException("Simulation::doit(): getprocess() returned unknown event");
stringstream ss;
ss<<"Simulation::do_interaction: process="<<process<< "not defined.";
throw MyException(ss.str());
break;
}
}
void Simulation::parameterCheck_TC6() {
if (
injectionMethod == 1 &&
elaOn == 0 &&
ionOn == 1 &&
numberZBins == -1
) {
return;
}else {
throw MyException("Simulation::parameterCheck_TC6: Some Parameter is wrong");
}
}