updated version
This commit is contained in:
@@ -20,27 +20,26 @@
|
||||
|
||||
void Simulation::init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Simulation::doit()
|
||||
{
|
||||
double totalcross, mfp;
|
||||
TinyVector <double,3> alterort, neuerort;
|
||||
while (injectedparticles < totalParticles)
|
||||
double sigmaTot, MFP;
|
||||
TinyVector <double,3> oldLoc, newLoc;
|
||||
while (numInjectedParticles < numTotalParticles)
|
||||
{
|
||||
if (teilchenliste.size() == 0 )
|
||||
if (particleQueue.size() == 0 )
|
||||
{
|
||||
inject();
|
||||
}
|
||||
for(teilcheniterator = teilchenliste.begin();
|
||||
teilcheniterator != teilchenliste.end();
|
||||
teilcheniterator++)
|
||||
for(particleQueueIt = particleQueue.begin();
|
||||
particleQueueIt != particleQueue.end();
|
||||
particleQueueIt++)
|
||||
{
|
||||
totalcross = calctotalcross(*teilcheniterator);
|
||||
mfp = 1/totalcross/KAT.tritiumdichte(teilcheniterator->ort());
|
||||
alterort = teilcheniterator->ort();
|
||||
move (*teilcheniterator, mfp);
|
||||
sigmaTot = calctotalcross(*particleQueueIt);
|
||||
MFP = 1/sigmaTot/KAT.tritiumDensity(particleQueueIt->loc());
|
||||
oldLoc = particleQueueIt->loc();
|
||||
move (*particleQueueIt, MFP);
|
||||
|
||||
//selectprocess(*teilcheniterator);
|
||||
//if (alterort(2) > 0.5)
|
||||
@@ -52,21 +51,55 @@ void Simulation::doit()
|
||||
|
||||
void Simulation::inject()
|
||||
{
|
||||
TinyVector<double,3> ort, geschwindigkeit;
|
||||
ort = 0,0,0;
|
||||
geschwindigkeit = 1,0,0;
|
||||
particle egon(9.109383e-28,1,ort, geschwindigkeit,injectedparticles,electron);
|
||||
injectedparticles++;
|
||||
TinyVector<double,3> loc, speed;
|
||||
double r,phi,z;
|
||||
TinyVector<double,3> speedDir;
|
||||
double Ekin,absSpeed;
|
||||
|
||||
r = rngUni.random()*wgtsDiameter;
|
||||
phi = rngUni.random()*2*constPi;
|
||||
z = rngUni.random()*wgtsLength;
|
||||
loc = r*cos(phi),r*sin(phi),z;
|
||||
// Add Code taking in account tritium density
|
||||
|
||||
speedDir = rngUni.random(),rngUni.random(),rngUni.random();
|
||||
speedDir = 1./sqrt(dot(speedDir,speedDir))*speedDir;
|
||||
// Add Code for corregtion of direction by tritium direction!!!
|
||||
|
||||
switch(injectionMethod)
|
||||
{
|
||||
case 1: // Fermi
|
||||
Ekin = 1.; //Implement Later
|
||||
break;
|
||||
|
||||
case 2: //Delta
|
||||
Ekin = deltaKinEnergy;
|
||||
break;
|
||||
case 3: //Maxwell Boltzman
|
||||
Ekin = 1.; //Implement Later
|
||||
break;
|
||||
default:
|
||||
cerr<<"Invalid Injection Method./n";
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
|
||||
absSpeed = sqrt( pow(constc,2) - ( pow(constme,2)*pow(constc,6) ) / pow( Ekin + constme*pow(constc,2) , 2 ) );
|
||||
speed = absSpeed * speedDir;
|
||||
|
||||
|
||||
particleQueue.assign(1,Particle(constme,constqe,loc, speed,numInjectedParticles,electron));
|
||||
numInjectedParticles++;
|
||||
}
|
||||
void Simulation::move(particle inputparticle, double mfp)
|
||||
|
||||
void Simulation::move(Particle inParticle, double length)
|
||||
{
|
||||
//Borispush
|
||||
}
|
||||
|
||||
|
||||
|
||||
double calctotalcross(particle inputparticle)
|
||||
double calctotalcross(Particle inputparticle)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user