Added constants.h: declaring global variables there and passign to parameters, particles. Included Elastic Scattering
This commit is contained in:
+34
-111
@@ -16,11 +16,15 @@
|
||||
#include <fstream>
|
||||
#include "blitz/array.h"
|
||||
#include "blitz/tinyvec2.h"
|
||||
#include <random/uniform.h>
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
typedef enum species{electron, positron, proton, tritium, tritium2, helium, deuterium, DT}species;
|
||||
std::ostream& operator<<(std::ostream& os, const species& SpecOut);
|
||||
|
||||
class Particle
|
||||
|
||||
class Particle: private Constants
|
||||
{
|
||||
private:
|
||||
double m_eV;
|
||||
@@ -30,6 +34,15 @@ private:
|
||||
species s;
|
||||
unsigned long int Id;
|
||||
unsigned long int parentId;
|
||||
|
||||
double r_m();
|
||||
double vAbs_ms();
|
||||
double beta();
|
||||
double gamma();
|
||||
double Ekin_eV();
|
||||
double tau();
|
||||
double eta();
|
||||
|
||||
public:
|
||||
|
||||
virtual ~Particle() { }
|
||||
@@ -43,125 +56,35 @@ public:
|
||||
s = spec;
|
||||
}
|
||||
|
||||
//Particle(Array<double, 1> props); //Create from Array
|
||||
|
||||
// Get Properties Methods
|
||||
double getMass_eV() {
|
||||
return(m_eV);
|
||||
}
|
||||
|
||||
double getCharge_e() {
|
||||
return(q_e);
|
||||
}
|
||||
|
||||
blitz::TinyVector<double,3> getLoc_m() {
|
||||
return(x_m);
|
||||
}
|
||||
|
||||
blitz::TinyVector<double,3> getSpeed_ms() {
|
||||
return(v_ms);
|
||||
}
|
||||
|
||||
double getId() {
|
||||
return(Id);
|
||||
}
|
||||
|
||||
double getParentId() {
|
||||
return(parentId);
|
||||
}
|
||||
|
||||
double getRadius_m() {
|
||||
return (sqrt( pow(x_m[0],2) + pow(x_m[1],2) ));
|
||||
}
|
||||
|
||||
double getSpeedAbs_ms() {
|
||||
return (sqrt( pow(v_ms[0],2) + pow(v_ms[1],2) + pow(v_ms[2],2)));
|
||||
}
|
||||
|
||||
double getKinEnergy_eV() {
|
||||
// Implement Constants here, else Particle::Parameters
|
||||
const double c_ms = 299792458;
|
||||
const double me_eV = 0.511e6;
|
||||
double SpeedAbs_ms = sqrt( pow(v_ms[0],2) + pow(v_ms[1],2) + pow(v_ms[2],2) );
|
||||
double beta = SpeedAbs_ms/c_ms;
|
||||
double gamma = pow(1- pow(beta,2),-0.5);
|
||||
return ( (gamma-1) * me_eV);
|
||||
}
|
||||
double getMass_eV() { return(m_eV); }
|
||||
double getCharge_e() { return(q_e); }
|
||||
blitz::TinyVector<double,3> getLoc_m() { return(x_m); }
|
||||
blitz::TinyVector<double,3> getSpeed_ms() { return(v_ms); }
|
||||
double getId() { return(Id); }
|
||||
double getParentId() { return(parentId); }
|
||||
double getRadius_m() { return ( r_m() ); }
|
||||
double getSpeedAbs_ms() { return (vAbs_ms() ); }
|
||||
double getKinEnergy_eV() { return (Ekin_eV() ); }
|
||||
|
||||
// Set Properties Methods
|
||||
void setLoc_m(blitz::TinyVector<double, 3> xnew_m) {x_m = xnew_m; };
|
||||
void setSpeed_ms(blitz::TinyVector<double, 3> vnew_ms) {v_ms = vnew_ms; };
|
||||
|
||||
// Boris Push
|
||||
double borisFly_m(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVector<double, 3> B_T , double dt_s);
|
||||
void changeLocFly(double dt_s);
|
||||
void changeSpeedBoris(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVector<double, 3> B_T , double dt_s);
|
||||
|
||||
// Cross Sections
|
||||
double getSigmaTot();
|
||||
double getSigmaEla();
|
||||
void doElaScat(ranlib::Uniform<double> *rngUni);
|
||||
|
||||
|
||||
// Write Methods
|
||||
friend std::ostream& operator<<(std::ostream& os, const Particle& partOut);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Some Code, maybe required later
|
||||
/*
|
||||
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 copyol(particle*);
|
||||
Array<double,1> prop(Array<double,1>);
|
||||
virtual Array<double,1> array(); // ********************** warum virtual???? ******************************
|
||||
//void copyol(particle);
|
||||
*/
|
||||
/*
|
||||
class particle_info : public particle {
|
||||
|
||||
private:
|
||||
TinyVector<double,3> x0,p0;
|
||||
double id;
|
||||
double mue0;
|
||||
|
||||
public:
|
||||
particle_info(TinyVector<double,3> anfangsort, TinyVector<double,3> anfangsimpuls, double nummer, double anfangswinkel ):particle()
|
||||
{
|
||||
x0 = anfangsort;
|
||||
p0 = anfangsimpuls;
|
||||
mue0 = anfangswinkel;
|
||||
id = nummer;
|
||||
}
|
||||
|
||||
particle_info() { }
|
||||
~particle_info() { }
|
||||
|
||||
|
||||
TinyVector<double,3> anfangsort() { return(x0); }
|
||||
TinyVector<double,3> anfangsimpuls() { return(p0); }
|
||||
double nummer() { return(id); }
|
||||
double anfangswinkel() { return(mue0); }
|
||||
// virtual void copyol(particle_info*);
|
||||
|
||||
Array<double,1> array () // *********************** auslagern in .cpp **************************
|
||||
{
|
||||
Array<double,1> teilchenprop;
|
||||
TinyVector<int,1> temp;
|
||||
temp=8;
|
||||
teilchenprop.resize(temp);
|
||||
|
||||
x0 = this->anfangsort();
|
||||
p0 = this->anfangsimpuls();
|
||||
id = this->nummer();
|
||||
mue0 = this->anfangswinkel();
|
||||
|
||||
teilchenprop(0) = x0(0);
|
||||
teilchenprop(1) = x0(1);
|
||||
teilchenprop(2) = x0(2);
|
||||
teilchenprop(3) = p0(0);
|
||||
teilchenprop(4) = p0(1);
|
||||
teilchenprop(5) = p0(2);
|
||||
teilchenprop(6) = id;
|
||||
teilchenprop(7) = mue0;
|
||||
|
||||
return(teilchenprop);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
// Other Functions
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user