Changes in general code and added class energyhisto for

This commit is contained in:
Christian
2018-09-20 18:43:32 +02:00
parent 7f53fb2bef
commit b3b914f0b4
12 changed files with 473 additions and 245 deletions
+48
View File
@@ -0,0 +1,48 @@
%% This BibTeX bibliography file was created using BibDesk.
%% http://bibdesk.sourceforge.net/
%% Created for Christian Reiling at 2018-09-18 10:29:48 +0200
%% Saved with string encoding Unicode (UTF-8)
@inbook{Plante_MCSIRT,
Author = {Plante, Ianik and Cucinotta, Francis},
Booktitle = {Application of Monte Carlo Methods in Biology, Medicine and Other Fields of Science},
Chapter = {18},
Date-Added = {2018-09-18 08:23:27 +0000},
Date-Modified = {2018-09-18 08:25:43 +0000},
Isbn = {978-953-307-427-6},
Month = {07},
Pages = {315-356},
Title = {Monte-Carlo Simulation of Ionizing Radiation Tracks},
Year = {2011}}
@techreport{KATRIN_design,
Author = {{KATRIN Collaboration} and {KATRIN Collaboration}},
Date-Added = {2018-09-18 08:18:39 +0000},
Date-Modified = {2018-09-18 08:24:07 +0000},
Institution = {{Forschungszentrum, Karlsruhe}},
Issn = {0947-8620},
Language = {english},
Note = {51.54.01; LK 01; Auch: NPI ASCR Rez EXP-01/2005; MS-KP-0501},
Pagetotal = {245},
Series = {Wissenschaftliche Berichte. FZKA},
Title = {KATRIN design report 2004},
Volume = {7090},
Year = {2005}}
@book{Alireza_MCMPT,
Address = {Boca Raton},
Author = {Haghighat, Alireza [VerfasserIn]},
Bestand = {Karlsruher Institut f{\"u}r Technologie (KIT) - KIT-Bibliothek <90> [Signatur: 2017 A 7474]; Hochschule Mannheim, Hochschulbibliothek <953> [Signatur: C I 1601]; Oberwolfach, Mathematisches Forschungsinstitut Oberwolfach <Frei 3c> [Signatur: M/Haghighat, A];},
Date-Added = {2018-09-18 08:14:54 +0000},
Date-Modified = {2018-09-18 08:29:48 +0000},
Isbn = {978-1-4665-9253-7},
Publisher = {CRC Press Taylor & Francis Group},
Size = {xviii, 273 Seiten : Illustrationen},
Title = {Monte Carlo methods for particle transport},
Year = {[2015]}}
+41
View File
@@ -0,0 +1,41 @@
//
// energyhisto.cpp
// mc_electron
//
// Created by Christian Reiling on 20.09.18.
// Copyright © 2018 Christian Reiling. All rights reserved.
//
#include "energyhisto.h"
void Energyhisto::addContent(double z1, double z2, double Energy) {
int zLowBin = std::min(getZBin(z1),getZBin(z2));
int zUpBin = std::max(getZBin(z1),getZBin(z2));
int EBin = getEBin(Energy);
data(blitz::Range(zLowBin,zUpBin),EBin) += 1;
}
int Energyhisto::getZBin(double z) {
if (z<0 || z>wgtsLength) {
std::cerr<<"Energyhisto::getZBin: z = "<<z<<" outside out dimensions \n";
exit(1);
}
return(floor(z/ZBinWidth));
}
int Energyhisto::getEBin(double E) {
if (E<minEBin) {
return (0);
} else if (E > maxEBin) {
return(numberEBins + 1);
} else {
return(floor((E-minEBin)/EBinWidth));
}
}
+59
View File
@@ -0,0 +1,59 @@
//
// energyhisto.h
// mc_electron
//
// Created by Christian Reiling on 20.09.18.
// Copyright © 2018 Christian Reiling. All rights reserved.
//
#ifndef energyhisto_h
#define energyhisto_h
#include <math.h>
#include <vector>
#include <iostream>
#include <fstream>
#include "blitz/array.h"
#include "blitz/tinyvec2.h"
#include "parameter.h"
class Energyhisto: public Parameter
{
public:
virtual ~Energyhisto(){};
Energyhisto(){
data.resize(numberZBins,numberEBins+2); // Under and Overflow Bins
data = 0;
ZBinWidth = wgtsLength/numberZBins;
EBinWidth = (maxEBin-minEBin)/numberEBins;
ZBinBoarders.resize(numberZBins+1);
for (int i=0;i<numberZBins+1;i++) {
ZBinBoarders[i] = ZBinWidth*i; //More fancy with blitz functions?
}
EBinBoarders.resize(numberEBins+3);
for (int i=0;i<numberEBins+1;i++) {
EBinBoarders[i+1] = minEBin + i*EBinWidth; //More fancy with blitz functions?
}
};
int getZBin(double z);
int getEBin(double E);
void addContent(double zLow, double zUp, double Energy);
private:
double ZBinWidth, EBinWidth;
blitz::Array <double,1> ZBinBoarders, EBinBoarders;
blitz::Array<int,2> data;
};
#endif
+8 -20
View File
@@ -1,37 +1,25 @@
// //
// katrin.cpp // katrin.cpp
// mc_electron
// //
// // Created by Christian Reiling on 20.09.18.
// Created by Christian Reiling on 13.09.18. // Copyright © 2018 Christian Reiling. All rights reserved.
// //
#include <stdio.h>
#include <math.h>
#include <vector>
#include <iostream>
#include <fstream>
#include "blitz/array.h"
#include "blitz/tinyvec2.h"
#include <math.h>
#include "particle.h"
#include "parameter.h"
#include "katrin.h" #include "katrin.h"
TinyVector<double,3> Katrin::magField(TinyVector<double,3> position) blitz::TinyVector<double,3> Katrin::magField(blitz::TinyVector<double,3> position) {
{ blitz::TinyVector<double,3> tmp(0.,0.,wgtsMagField);
TinyVector<double,3> tmp(0.,0.,wgtsMagField);
return (tmp); return (tmp);
} }
TinyVector<double,3> Katrin::elField(TinyVector<double,3> position) blitz::TinyVector<double,3> Katrin::elField(blitz::TinyVector<double,3> position) {
{ blitz::TinyVector<double, 3> tmp(0.,0.,0.);
TinyVector<double, 3> tmp(0.,0.,0.);
return (tmp); return (tmp);
} }
double Katrin::tritiumDensity(TinyVector<double,3> position) double Katrin::tritiumDensity(blitz::TinyVector<double,3> position) {
{
return(0); return(0);
} }
+6 -6
View File
@@ -1,8 +1,9 @@
// //
// katrin.h // katrin.h
// mc_electron
// //
// // Created by Christian Reiling on 20.09.18.
// Created by Christian Reiling on 13.09.18. // Copyright © 2018 Christian Reiling. All rights reserved.
// //
#ifndef katrin_h #ifndef katrin_h
@@ -16,7 +17,6 @@
#include "blitz/array.h" #include "blitz/array.h"
#include "blitz/tinyvec2.h" #include "blitz/tinyvec2.h"
#include "particle.h"
#include "parameter.h" #include "parameter.h"
class Katrin: public Parameter class Katrin: public Parameter
@@ -25,9 +25,9 @@ public:
Katrin(){}; Katrin(){};
virtual ~Katrin(){}; virtual ~Katrin(){};
TinyVector<double,3> magField(TinyVector<double,3>); blitz::TinyVector<double,3> magField(blitz::TinyVector<double,3>);
TinyVector<double,3> elField(TinyVector<double,3>); blitz::TinyVector<double,3> elField(blitz::TinyVector<double,3>);
double tritiumDensity(TinyVector<double,3>); double tritiumDensity(blitz::TinyVector<double,3>);
}; };
+9 -29
View File
@@ -1,41 +1,21 @@
// //
// main.cpp // main.cpp
// mc_electron
// //
// Created by Christian Reiling on 20.09.18.
// Copyright © 2018 Christian Reiling. All rights reserved.
// //
// Created by Christian Reiling on 13.09.18.
//
//Notes: SI-system
//Tasks:
// 1. Take in account tritium density for location distribution
// 2. Take in account tritium flow speed for speed distribution
#include <stdio.h>
#include <math.h>
#include <vector>
#include <iostream>
#include <fstream>
#include "blitz/array.h"
#include "blitz/tinyvec2.h"
#include "parameter.h"
#include "simulation.h" #include "simulation.h"
#include "particle.h"
#include "katrin.h"
int main(int argc, const char * argv[]) {
int main(int argc, char** argv) char poub[]="poub=/Users/ChristianReiling/Documents/Masterarbeit/katrin-plasma/src/mc_electron";
{ char pname[]="pname=parameters";
putenv(poub);
putenv(pname);
Simulation SIM; Simulation SIM;
SIM.init(); SIM.init();
SIM.inject(); SIM.doit();
/*
cout <<"___"<<endl;
TinyVector<float,2> A;
A = 1,0;
cout << TinyVector<float,2>(1,0)<<endl;
cout<<"___"<<endl;
*/
} }
+21 -14
View File
@@ -1,8 +1,9 @@
// //
// parameter.h // parameter.h
// mc_electron
// //
// // Created by Christian Reiling on 20.09.18.
// Created by Christian Reiling on 13.09.18. // Copyright © 2018 Christian Reiling. All rights reserved.
// //
#ifndef parameter_h #ifndef parameter_h
@@ -11,8 +12,6 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
using namespace std;
using namespace blitz;
class Parameter class Parameter
{ {
@@ -20,14 +19,17 @@ public:
virtual ~Parameter(){}; virtual ~Parameter(){};
Parameter() Parameter() {
{
seed = (int)value("seed"); seed = (int)value("seed");
numTotalParticles = (long int)value("numTotalParticles"); numTotalParticles = (long int)value("numTotalParticles");
dt = value("dt"); dt = value("dt");
injectionMethod = (int)value("injectionMethod"); injectionMethod = (int)value("injectionMethod");
deltaKinEnergy = value("deltaKinEnergy"); deltaKinEnergy = value("deltaKinEnergy");
MBKinEnergy = value("MBKinEnergy"); MBKinEnergy = value("MBKinEnergy");
numberZBins = (int)value ("numberZBins");
minEBin = value ("minEBin");
maxEBin = value ("maxEBin");
numberEBins = (int)value ("numberEBins");
wgtsMagField = value("wgtsMagField"); wgtsMagField = value("wgtsMagField");
wgtsLength = value("wgtsLength"); wgtsLength = value("wgtsLength");
@@ -40,8 +42,8 @@ public:
constqe = value("constqe"); constqe = value("constqe");
} }
double value(char *str, char* ext = "cat") // Reads Parameter from config file double value(std::string strin, char* ext = (char*)("cat")) {
{ char* str = strdup(strin.c_str());
double temp; double temp;
char dummy[256]; char dummy[256];
char fname[256],*pname; char fname[256],*pname;
@@ -49,24 +51,24 @@ public:
if (getenv("poub") == NULL) if (getenv("poub") == NULL)
{ {
fprintf(stderr,"Environment variable %s not defined.\n","poub"); std::cerr<<"Parameter::value: Environment variable poub not defined.\n";
exit(1); exit(1);
} }
strcpy(fname, getenv("poub")); strcpy(fname, getenv("poub"));
pname = getenv("pname"); pname = getenv("pname");
if (pname == NULL) if (pname == NULL)
{ {
fprintf(stderr,"Environment variable %s not defined.\n","pname"); std::cerr<<"Parameter::value: Environment variable pname not defined.\n";
exit(1); exit(1);
} }
if (!ext) if (!ext)
{ {
ext = "cat"; ext = (char*)("cat");
} }
sprintf(fname,"%s/%s.%s",getenv("poub"),getenv("pname"), ext); sprintf(fname,"%s/%s.%s",getenv("poub"),getenv("pname"), ext);
if (!(fcat = fopen(fname, "r"))) if (!(fcat = fopen(fname, "r")))
{ {
fprintf(stderr,"value: cannot open file %s\n",fname); std::cerr<<"Parameter::value: Can not open file " <<fname<<".\n";
exit(1); exit(1);
} }
while (!feof(fcat)) while (!feof(fcat))
@@ -81,14 +83,14 @@ public:
} }
} }
fclose(fcat); fclose(fcat);
fprintf(stderr,"variable %s not found\n",str);
std::cerr<<"Parameter::value: Variable "<<str<<" not found.\n";
exit(1); exit(1);
return 0; return 0;
} }
protected: protected:
string configFilePath; std::string configFilePath;
//Simulation specs //Simulation specs
int seed; int seed;
@@ -97,6 +99,10 @@ protected:
int injectionMethod; int injectionMethod;
double deltaKinEnergy; double deltaKinEnergy;
double MBKinEnergy; double MBKinEnergy;
int numberZBins;
double minEBin;
double maxEBin;
int numberEBins;
//KATRIN Specs //KATRIN Specs
double wgtsMagField; double wgtsMagField;
@@ -111,4 +117,5 @@ protected:
}; };
#endif #endif
+9 -4
View File
@@ -1,13 +1,18 @@
seed = 2342395328 seed = 2342395328
numTotalParticles = 1000 numTotalParticles = 10
dt = 5 dt = 0.00001
injectionMethod = 2 injectionMethod = 2
deltaKinEnergy = 10 deltaKinEnergy = 10
MBKinEnergy = 10 MBKinEnergy = 4.14e-22 J
numberZBins = 10
minEBin = 0
maxEBin = 10
numberEBins = 10
wgtsMagField = 2.5 wgtsMagField = 2.5
wgtsLength = 100 wgtsLength = 10
wgtsDiameter = 10 wgtsDiameter = 10
+40 -11
View File
@@ -1,22 +1,51 @@
// //
// particle.cpp // particle.cpp
// mc_electron
// //
// // Created by Christian Reiling on 20.09.18.
// Created by Christian Reiling on 13.09.18. // Copyright © 2018 Christian Reiling. All rights reserved.
// //
#include <stdio.h>
#include <math.h>
#include <vector>
#include <iostream>
#include <fstream>
#include "blitz/array.h"
#include "blitz/tinyvec2.h"
#include "particle.h" #include "particle.h"
ostream& operator<<(ostream& os, const Particle& partOut) std::ostream& operator<<(std::ostream& os, const species& SpecOut) {
{ switch (SpecOut) {
case electron:
os<<"e-";
break;
case positron:
os<<"e+";
break;
case proton:
os<<"p";
break;
case tritium:
os<<"T3";
break;
case tritium2:
os<<"T_2";
break;
case helium:
os<<"He3";
break;
case deuterium:
os<<"D2";
break;
case DT:
os<<"DT";
break;
default:
std::cerr<<"unknown species";
exit(1);
}
return (os);
}
std::ostream& operator<<(std::ostream& os, const Particle& partOut) {
os << "(" << partOut.id<<","<<partOut.s<<","<<partOut.m << "," << partOut.q << ","<< partOut.x<<","<< partOut.v <<")"; os << "(" << partOut.id<<","<<partOut.s<<","<<partOut.m << "," << partOut.q << ","<< partOut.x<<","<< partOut.v <<")";
return os; return os;
} }
+46 -20
View File
@@ -1,13 +1,13 @@
// //
// particle.h // particle.h
// mc_electron
// //
// Created by Christian Reiling on 20.09.18.
// Copyright © 2018 Christian Reiling. All rights reserved.
// //
// Created by Christian Reiling on 13.09.18.
//
// Notes: Energy being calculated using speed and mass
#ifndef particle_h #ifndef particle_hpp
#define particle_h #define particle_hpp
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
@@ -17,23 +17,22 @@
#include "blitz/array.h" #include "blitz/array.h"
#include "blitz/tinyvec2.h" #include "blitz/tinyvec2.h"
typedef enum species{electron, positron, proton, tritium, tritium2, helium, deuterium, dt}species; typedef enum species{electron, positron, proton, tritium, tritium2, helium, deuterium, DT}species;
std::ostream& operator<<(std::ostream& os, const species& SpecOut);
using namespace blitz;
class Particle class Particle
{ {
private: private:
double m,q; double m,q;
TinyVector<double,3> x,v; blitz::TinyVector<double,3> x,v;
species s; species s;
long int id; long int id;
public: public:
virtual ~Particle() { } virtual ~Particle() { }
Particle(){} Particle(){}
Particle(double mass, double charge,TinyVector<double,3> loc, TinyVector<double,3> speed, double idnum, species spec) Particle(double mass, double charge,blitz::TinyVector<double,3> loc, blitz::TinyVector<double,3> speed, double idnum, species spec) {
{
m = mass; m = mass;
q = charge; q = charge;
x = loc; x = loc;
@@ -44,18 +43,44 @@ public:
//Particle(Array<double, 1> props); //Create from Array //Particle(Array<double, 1> props); //Create from Array
double mass() { return(m); } double mass() {
double charge() { return(q); } return(m);
TinyVector<double,3> loc() { return(x); } }
TinyVector<double,3> speed() { return(v); }
double number() { return(id);}
TinyVector<double,3> locChange(TinyVector<double, 3> dx, int i, TinyVector<double, 3> xmin, TinyVector<double, 3> nx, TinyVector<double, 3> dvdt); double charge() {
TinyVector<double,3> speedChange(TinyVector<double, 3> dv, int i); return(q);
TinyVector<double, 3> locSet(TinyVector<double, 3> xneu) { return x = xneu; }; }
TinyVector<double, 3> speedSet(TinyVector<double, 3> vneu);
friend ostream& operator<<(ostream& os, const Particle& partOut); blitz::TinyVector<double,3> loc() {
return(x);
}
blitz::TinyVector<double,3> speed() {
return(v);
}
double number() {
return(id);
}
double radius() {
return (sqrt( pow(x[0],2) + pow(x[1],2) ));
}
double speedAbs() {
return (sqrt( pow(v[0],2) + pow(v[1],2) + pow(v[2],2)));
}
double energy(); // muss noch implementiert werden
blitz::TinyVector<double,3> locChange(blitz::TinyVector<double, 3> dx, int i, blitz::TinyVector<double, 3> xmin, blitz::TinyVector<double, 3> nx, blitz::TinyVector<double, 3> dvdt);
blitz::TinyVector<double,3> speedChange(blitz::TinyVector<double, 3> dv, int i);
void setLoc(blitz::TinyVector<double, 3> xnew) {x = xnew; };
void setSpeed(blitz::TinyVector<double, 3> vnew) {v = vnew; };
friend std::ostream& operator<<(std::ostream& os, const Particle& partOut);
/* /*
void copyol(particle*); void copyol(particle*);
@@ -121,4 +146,5 @@ public:
} }
}; };
*/ */
#endif #endif
+93 -49
View File
@@ -1,59 +1,76 @@
// //
// simulation.cpp // simulation.cpp
// mc_electron
// //
// // Created by Christian Reiling on 20.09.18.
// Created by Christian Reiling on 13.09.18. // Copyright © 2018 Christian Reiling. All rights reserved.
// //
#include <stdio.h>
#include <math.h>
#include <vector>
#include <iostream>
#include <fstream>
#include "blitz/array.h"
#include "blitz/tinyvec2.h"
#include <math.h>
#include "particle.h"
#include "parameter.h"
#include "simulation.h" #include "simulation.h"
void Simulation::init() void Simulation::init() {
{
} }
void Simulation::doit() void Simulation::doit() {
{ double MFP;
double sigmaTot, MFP; blitz::TinyVector <double,3> oldLoc, newLoc;
TinyVector <double,3> oldLoc, newLoc; // Iterator nicht mit push_back möglich
while (numInjectedParticles < numTotalParticles) // Laufe vorderstes Teilchen bis zum Tod durch, entferne es dann aus der Liste
{
if (particleQueue.size() == 0 ) while (numInjectedParticles < numTotalParticles) {
{
inject(); inject();
}
for(particleQueueIt = particleQueue.begin();
particleQueueIt != particleQueue.end();
particleQueueIt++)
{
sigmaTot = calctotalcross(*particleQueueIt);
MFP = 1/sigmaTot/KAT.tritiumDensity(particleQueueIt->loc());
oldLoc = particleQueueIt->loc();
move (*particleQueueIt, MFP);
//selectprocess(*teilcheniterator); while (particleQueue.size()>0) {
//if (alterort(2) > 0.5) // Run Code for first particle in Queue
MFP = calcMFP();
oldLoc = particleQueue[0].loc();
std::cout << "Before move: " <<particleQueue[0]<<std::endl;
move (MFP,0);
std::cout << "After move: " <<particleQueue[0]<<std::endl;
if (movedOutside(0)) {
moveToLocOfDeath(oldLoc,0);
// updateDensity(oldLoc, partQueue[0].energy());
std::cout << "Death position: " <<particleQueue[0]<<std::endl;
particleQueue.erase(particleQueue.begin());
continue;
} else {
//newLoc = partQueue[0];
//updateDensity(oldLoc,newLoc,partQueue[0].energy());
} }
/*
switch (getprocess()) {
case "ElasticScattering":
break;
case "Ionization":
break;
case "Recombination";
partQueue.erase(partQueue.begin());
continue
break;
default:
cerr<<"getprocess() returned unknown event"<<endl;
break;
}
*/
//particleQueue.erase(particleQueue.begin());
}
} }
}; };
void Simulation::inject() {
void Simulation::inject() blitz::TinyVector<double,3> loc, speed;
{
TinyVector<double,3> loc, speed;
double r,phi,z; double r,phi,z;
TinyVector<double,3> speedDir; blitz::TinyVector<double,3> speedDir;
double Ekin,absSpeed; double Ekin,absSpeed;
r = rngUni.random()*wgtsDiameter; r = rngUni.random()*wgtsDiameter;
@@ -66,8 +83,7 @@ void Simulation::inject()
speedDir = 1./sqrt(dot(speedDir,speedDir))*speedDir; speedDir = 1./sqrt(dot(speedDir,speedDir))*speedDir;
// Add Code for corregtion of direction by tritium direction!!! // Add Code for corregtion of direction by tritium direction!!!
switch(injectionMethod) switch(injectionMethod) {
{
case 1: // Fermi case 1: // Fermi
Ekin = 1.; //Implement Later Ekin = 1.; //Implement Later
break; break;
@@ -79,7 +95,7 @@ void Simulation::inject()
Ekin = 1.; //Implement Later Ekin = 1.; //Implement Later
break; break;
default: default:
cerr<<"Invalid Injection Method./n"; std::cerr<<"Invalid Injection Method./n";
exit(1); exit(1);
break; break;
} }
@@ -89,18 +105,46 @@ void Simulation::inject()
particleQueue.assign(1,Particle(constme,constqe,loc, speed,numInjectedParticles,electron)); particleQueue.assign(1,Particle(constme,constqe,loc, speed,numInjectedParticles,electron));
cout<<particleQueue[0]<<endl;
numInjectedParticles++; numInjectedParticles++;
} }
void Simulation::move(Particle inParticle, double length) void Simulation::move(double MFP,int queueNum) {
{ if (queueNum > particleQueue.size()-1) {
//Borispush std::cerr<<"queueNum outside of size"<<std::endl;
exit(1);
} }
//Pseudocode, lineare bewegung
blitz::TinyVector<double,3> SpeedDir;
SpeedDir = 1./sqrt(dot(particleQueue[queueNum].speed(),particleQueue[queueNum].speed()))*particleQueue[queueNum].speed();
particleQueue[queueNum].setLoc(particleQueue[queueNum].loc() + SpeedDir*MFP);
}
bool Simulation::movedOutside(int queueNum) {
if (queueNum > particleQueue.size()-1) {
std::cerr<<"queueNum outside of size"<<std::endl;
exit(1);
}
double calctotalcross(Particle inputparticle) blitz::TinyVector<double,3> loc = particleQueue[queueNum].loc();
{ double r = particleQueue[queueNum].radius();
return (0); return (!(loc[2]>0 && loc[2]<wgtsLength && r<(wgtsDiameter/2) ));
}
void Simulation::moveToLocOfDeath(blitz::TinyVector<double,3> oldLoc, int queueNum) {
double stepsize = particleQueue[queueNum].speedAbs()*dt;
particleQueue[queueNum].setLoc(oldLoc);
while (!movedOutside(queueNum) ) {
move (stepsize,queueNum);
}
if (particleQueue[queueNum].loc()(2)<0) {
particleQueue[queueNum].loc()(2) = 0;
} else if (particleQueue[queueNum].loc()(2)>wgtsLength) {
particleQueue[queueNum].loc()(2) = wgtsLength;
}
// Runde Position auf Rand
}
double Simulation::calcMFP() {
return(1);
} }
+15 -14
View File
@@ -1,8 +1,9 @@
// //
// simulation.h // simulation.h
// mc_electron
// //
// // Created by Christian Reiling on 20.09.18.
// Created by Christian Reiling on 13.09.18. // Copyright © 2018 Christian Reiling. All rights reserved.
// //
#ifndef simulation_h #ifndef simulation_h
@@ -17,21 +18,17 @@
#include "blitz/tinyvec2.h" #include "blitz/tinyvec2.h"
#include <random/uniform.h> #include <random/uniform.h>
#include "particle.h"
#include "parameter.h" #include "parameter.h"
#include "katrin.h" #include "katrin.h"
#include "particle.h"
using namespace blitz; #include "energyhisto.h"
using namespace std;
using namespace ranlib;
class Simulation: public Parameter class Simulation: public Parameter
{ {
public: public:
~Simulation(){}; ~Simulation(){};
Simulation() Simulation() {
{
numInjectedParticles = 0; numInjectedParticles = 0;
rngUni.seed(seed); rngUni.seed(seed);
@@ -42,22 +39,26 @@ public:
void init(void); void init(void);
void doit(void); void doit(void);
void inject(); void inject();
void move(Particle inputparticle, double mfp);
void output(void); void output(void);
double calctotalcross(Particle inputparticle){return 0;}; void move(double MFP,int queueNum=0);
bool movedOutside(int queueNum=0);
void moveToLocOfDeath(blitz::TinyVector<double,3> oldLoc, int queueNum=0);
double calcMFP();
protected: protected:
Katrin KAT; Katrin KAT;
Uniform<double> rngUni; ranlib::Uniform<double> rngUni;
double t; double t;
double id; double id;
vector<Particle> particleQueue; std::vector<Particle> particleQueue;
int numInjectedParticles; int numInjectedParticles;
vector<Particle>::iterator particleQueueIt; std::vector<Particle>::iterator particleQueueIt;
}; };
#endif #endif