Change in Parameter: input parameter numTotalElectrons changed to numberTotalDecays. Now running until number of decays happend, for better time scale.
This commit is contained in:
@@ -17,42 +17,42 @@ using namespace std;
|
||||
|
||||
|
||||
Simulation::Simulation() {
|
||||
numberElectrons = 0;
|
||||
numberTotalElectrons = 0;
|
||||
numberDecays = 0;
|
||||
rngUni.seed(seed);
|
||||
updater_fraction = numTotalElectrons/100;
|
||||
updater_fraction = numberTotalDecays/100;
|
||||
updater_numberOfPrevious = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Simulation::doit() {
|
||||
vec3 oldLoc_m;
|
||||
while ( (numberElectrons < numTotalElectrons) || (electronQue.size() > 0) ) {
|
||||
Electron *actionElectronPtr;
|
||||
while ( (numberDecays < numberTotalDecays) || (electronQue.size() > 0) ) {
|
||||
if (electronQue.empty()) {
|
||||
electronQue.push_back(Kat.injectElectron(numberElectrons++, &rngUni, &rngNormal));
|
||||
electronQue.push_back(Kat.injectElectron(numberTotalElectrons++, &rngUni, &rngNormal));
|
||||
numberDecays++;
|
||||
}
|
||||
|
||||
status_updater();
|
||||
move_electron(&electronQue.front(), &Log);
|
||||
if (!Kat.check_Termination (electronQue.front()) ) {
|
||||
do_interaction(&electronQue.front());
|
||||
actionElectronPtr = &electronQue.front();
|
||||
do_statusUpdate();
|
||||
move_electron(actionElectronPtr, &Log);
|
||||
if (!Kat.check_Termination (*actionElectronPtr) ) {
|
||||
do_interaction(actionElectronPtr);
|
||||
}
|
||||
if (Kat.check_Termination (electronQue.front())) {
|
||||
if (Kat.check_Termination (*actionElectronPtr)) {
|
||||
electronQue.pop_front();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void Simulation::doTC6() {
|
||||
cout<<endl<<"Simulation::doTC6: Doing Testcase 6."<<endl<<endl;
|
||||
parameterCheck_TC6();
|
||||
|
||||
while ( (numberElectrons < numTotalElectrons) || (electronQue.size() > 0) ) {
|
||||
while ( (numberTotalElectrons < numberTotalDecays) || (electronQue.size() > 0) ) {
|
||||
if (!electronQue.empty()) {
|
||||
throw MyException("Simulation::doTC6: electronQue should be empty");
|
||||
}
|
||||
electronQue.push_back(Kat.injectElectron(numberElectrons++, &rngUni, &rngNormal));
|
||||
electronQue.push_back(Kat.injectElectron(numberTotalElectrons++, &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
|
||||
@@ -60,12 +60,12 @@ void Simulation::doTC6() {
|
||||
}
|
||||
};
|
||||
|
||||
void Simulation::status_updater() {
|
||||
if (numberElectrons%updater_fraction == 0){
|
||||
if (updater_numberOfPrevious!=numberElectrons) {
|
||||
cout<<numberElectrons<<"/"<<numTotalElectrons<<endl;
|
||||
void Simulation::do_statusUpdate() {
|
||||
if (numberDecays%updater_fraction == 0){
|
||||
if (updater_numberOfPrevious!=numberDecays) {
|
||||
cout<<numberDecays<<"/"<<numberTotalDecays<<endl;
|
||||
}
|
||||
updater_numberOfPrevious = numberElectrons;
|
||||
updater_numberOfPrevious = numberDecays;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +95,8 @@ void Simulation::do_interaction(Electron *interactElectron) {
|
||||
interactElectron->do_elaScattering(Kat.getTotSpeedT2_ms(newLoc_m, &rngUni, &rngNormal) , &rngUni);
|
||||
break;
|
||||
case 2: // Ionization
|
||||
electronQue.push_back( interactElectron->do_Ionization(Kat.getTotSpeedT2_ms(newLoc_m, &rngUni, &rngNormal), numberElectrons, &rngUni) );
|
||||
numberElectrons++;
|
||||
electronQue.push_back( interactElectron->do_Ionization(Kat.getTotSpeedT2_ms(newLoc_m, &rngUni, &rngNormal), numberTotalElectrons, &rngUni) );
|
||||
numberTotalElectrons++;
|
||||
// Update Ions...
|
||||
break;
|
||||
case 3: // Recombination
|
||||
|
||||
Reference in New Issue
Block a user