Fixed MB-Generator. Slight changes
This commit is contained in:
@@ -24,15 +24,16 @@ void Simulation::doit() {
|
||||
std::cout<<numInjectedParticles<<"/"<<numTotalParticles<<std::endl;
|
||||
}
|
||||
}
|
||||
ScatT2 = Kat.getT2AverScatPart(particleQue.front().getLoc_m(), &rngUni, &rngNormal);
|
||||
ScatT2 = Kat.getT2AverScatPart(particleQue.front().getLoc_m(), &rngUni);
|
||||
IntereT2 = Interaction(&particleQue.front(),&ScatT2);
|
||||
//Replace with vector containing all Interactions and adapt functions and put particle pointers into Particle class
|
||||
|
||||
MFP_m = getMFP_m(IntereT2);
|
||||
moveParticle(&particleQue.front(),MFP_m); // If moved outside set v = 0,0,0;
|
||||
|
||||
|
||||
switch (getInteraction(particleQue.front())) {
|
||||
case 0: //Moved Outside
|
||||
break;
|
||||
case 1: // Elastic Scattering
|
||||
ScatT2 = Kat.getT2ScatPart(particleQue.front().getLoc_m(), &rngUni, &rngNormal);
|
||||
IntereT2 = Interaction(&particleQue.front(),&ScatT2);
|
||||
@@ -76,7 +77,7 @@ Particle Simulation::inject() {
|
||||
Ekin_eV = deltaKinEnergy_eV;
|
||||
break;
|
||||
case 2: //Maxwell Boltzman
|
||||
Ekin_eV = getEnergyBoltzmann_eV();
|
||||
Ekin_eV = getRandEnergyMaxwell(MBTemp_K,me_eV, &rngNormal);
|
||||
break;
|
||||
default:
|
||||
std::cerr<<"Invalid Injection Method./n";
|
||||
@@ -113,12 +114,7 @@ double Simulation::FermiFunction(double Z, double Ekin_eV) {
|
||||
double eta =Z/beta/137.;
|
||||
return( 2*pi*eta/(1-exp(-2*pi*eta)) );
|
||||
}
|
||||
double Simulation::getEnergyBoltzmann_eV() {
|
||||
double N = rngNormal.random();
|
||||
double beta = N*sqrt(kb_eVK*MBTemp_K/me_eV);
|
||||
double gamma = 1/sqrt(1-pow(beta,2));
|
||||
return((gamma-1)*me_eV);
|
||||
}
|
||||
|
||||
|
||||
// Moving
|
||||
void Simulation::moveParticle(Particle *movePart, double MFP_m) {
|
||||
@@ -160,9 +156,7 @@ int Simulation::getInteraction(Particle interPart) {
|
||||
if (interPart.getKinEnergy_eV()==0) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
// Termination
|
||||
@@ -175,7 +169,7 @@ bool Simulation::checkTermination(Particle termPart) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (EKin_eV<ETemp_eV) {
|
||||
if (EKin_eV<=ETemp_eV) {
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user