Added new test class, reworked some code
Started Implementing Ionization
This commit is contained in:
+44
-12
@@ -20,13 +20,13 @@
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
typedef enum species{electron, positron, proton, tritium, tritium2, helium, deuterium, DT}species;
|
||||
typedef enum species{undef, electron, positron, proton, tritium, tritium2, helium, deuterium, DT}species;
|
||||
std::ostream& operator<<(std::ostream& os, const species& SpecOut);
|
||||
|
||||
|
||||
class Particle: private Constants
|
||||
class Particle: protected Constants
|
||||
{
|
||||
private:
|
||||
protected:
|
||||
double m_eV;
|
||||
double q_e;
|
||||
blitz::TinyVector<double,3> x_m;
|
||||
@@ -39,13 +39,14 @@ private:
|
||||
double vAbs_ms();
|
||||
double beta();
|
||||
double gamma();
|
||||
double Ekin_eV();
|
||||
double tau();
|
||||
double eta();
|
||||
double calcEkin_eV();
|
||||
double elaTau();
|
||||
double elaEta();
|
||||
|
||||
public:
|
||||
virtual ~Particle() {}
|
||||
Particle() {}
|
||||
|
||||
virtual ~Particle() { }
|
||||
Particle(double mass_eV, double charge_e,blitz::TinyVector<double,3> loc_m, blitz::TinyVector<double,3> speed_ms, double idnum, double parentIdnum, species spec) {
|
||||
m_eV = mass_eV;
|
||||
q_e = charge_e;
|
||||
@@ -56,6 +57,20 @@ public:
|
||||
s = spec;
|
||||
}
|
||||
|
||||
Particle(double mass_eV,blitz::TinyVector<double,3> speed_ms) { //Resting dummy for elastic scattering
|
||||
blitz::TinyVector<double,3> zero;
|
||||
zero = 0,0,0;
|
||||
m_eV = mass_eV;
|
||||
q_e = 0;
|
||||
x_m = zero;
|
||||
v_ms = speed_ms;
|
||||
Id = 0;
|
||||
parentId = 0;
|
||||
s = undef;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get Properties Methods
|
||||
double getMass_eV() { return(m_eV); }
|
||||
double getCharge_e() { return(q_e); }
|
||||
@@ -65,24 +80,41 @@ public:
|
||||
double getParentId() { return(parentId); }
|
||||
double getRadius_m() { return ( r_m() ); }
|
||||
double getSpeedAbs_ms() { return (vAbs_ms() ); }
|
||||
double getKinEnergy_eV() { return (Ekin_eV() ); }
|
||||
double getKinEnergy_eV() { return (calcEkin_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
|
||||
public:
|
||||
double borisFly_m(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVector<double, 3> B_T , double dt_s);
|
||||
protected:
|
||||
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);
|
||||
// Interactions
|
||||
public:
|
||||
double getSigmaTot_m2() { return (getSigmaEla_m2()+getSigmaIon_m2()); }
|
||||
|
||||
protected:
|
||||
void elasticKinematicClassical(Particle *P2, double theta, double phi);
|
||||
blitz::TinyVector<double,3> getNewDir(double theta,double phi,blitz::TinyVector<double,3> oldDir);
|
||||
|
||||
// Elastic Scattering
|
||||
public:
|
||||
double getSigmaEla_m2();
|
||||
void doElaScat (ranlib::Uniform<double> *rngUni);
|
||||
protected:
|
||||
double getRandomTheta(ranlib::Uniform<double> *rngUni);
|
||||
// Ionization
|
||||
public:
|
||||
double getSigmaIon_m2();
|
||||
void doIon (ranlib::Uniform<double> *rngUni);
|
||||
|
||||
|
||||
// Write Methods
|
||||
public:
|
||||
friend std::ostream& operator<<(std::ostream& os, const Particle& partOut);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user