Major changes:
- Added individul operators for species and better selecting process. - Switched to C arrays for main loop operations and calculating array indizes using knowledge of binning instead of doing sorted search - Added Recombination - Reworked elastic scattering kinematics - Added inelastic scattering kinematics
This commit is contained in:
@@ -0,0 +1,263 @@
|
||||
//
|
||||
// eT2_ionization.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 20.05.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef eT2_ionization_h
|
||||
#define eT2_ionization_h
|
||||
|
||||
#include "sub_interaction_base.h"
|
||||
#include "average_container.h"
|
||||
#include "stacked_container.h"
|
||||
|
||||
#include "BED_eT2_ionization.hpp"
|
||||
/*
|
||||
Ionization:
|
||||
Using BED-Model Kim and Rudd 1994
|
||||
*/
|
||||
class eT2_T2I_Ionization_Analytic : public Sub_Interaction_Base {
|
||||
public:
|
||||
eT2_T2I_Ionization_Analytic(Population_Base *T2Population, UniRNG *rngUni) : Sub_Interaction_Base(T2Population, rngUni) {};
|
||||
|
||||
double get_macroSigma_m2(const Particle &interPart);
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
private:
|
||||
vec3 roll_vLab_ms(const Particle &interPart);
|
||||
double roll_ionW_eV(double T_eV);
|
||||
double roll_IonTheta1(double T_eV, double W_eV);
|
||||
double roll_IonTheta2(double T_eV, double W_eV);
|
||||
};
|
||||
|
||||
|
||||
inline double eT2_T2I_Ionization_Analytic::get_macroSigma_m2(const Particle &interPart) {
|
||||
double T_eV = interPart.get_EKin_eV();
|
||||
vec3 loc_m = interPart.get_Location_m();
|
||||
|
||||
double microSigma_m2 = BED_eT2_Ionization::calc_TCS(T_eV);
|
||||
double nT2_m3 = Population->get_density_m3(loc_m);
|
||||
return (microSigma_m2*nT2_m3);
|
||||
}
|
||||
|
||||
inline InteractionOut eT2_T2I_Ionization_Analytic::do_Interaction (Particle *interPart) {
|
||||
vec3 vLab_ms = roll_vLab_ms(*interPart);
|
||||
vec3 v_ms = interPart->get_Speed_ms();
|
||||
|
||||
double T_eV = calc_Ekin_eV_from_speed(v_ms, me_eV);
|
||||
if (T_eV < EionT2_eV) {
|
||||
throw MyException("Electron::do_Ionization: Ekin_eV < EIonT2_eV.");
|
||||
}
|
||||
double W_eV = roll_ionW_eV(T_eV);
|
||||
|
||||
double E1_eV = T_eV-EionT2_eV - W_eV;
|
||||
|
||||
double phi1 = rngUni->random()*2*pi;
|
||||
double phi2 = phi1-pi;
|
||||
|
||||
double theta1 = roll_IonTheta1(T_eV, W_eV);
|
||||
double theta2 = roll_IonTheta2(T_eV, W_eV);
|
||||
|
||||
double v1Absnew_ms = calc_Speed_from_Ekin_eV(E1_eV, me_eV);
|
||||
double v2Absnew_ms = calc_Speed_from_Ekin_eV(W_eV, me_eV);
|
||||
|
||||
vec3 P1newDir, P2newDir, v1New_ms, v2New_ms ;
|
||||
P1newDir = calc_newDirection(v_ms, theta1, phi1);
|
||||
P2newDir = calc_newDirection(v_ms, theta2, phi2);
|
||||
|
||||
vec3 vOff_ms = vLab_ms - v_ms;
|
||||
v1New_ms = v1Absnew_ms*P1newDir + vOff_ms;
|
||||
v2New_ms = v2Absnew_ms*P2newDir + vOff_ms;
|
||||
|
||||
interPart->set_Speed_ms(v1New_ms);
|
||||
|
||||
vec3 loc_m = interPart->get_Location_m();
|
||||
Particle eNew = Particle_Builder::createElectron(loc_m, v2New_ms, -1, interPart->get_Id());
|
||||
InteractionOut InterOut;
|
||||
InterOut.add_new_particle(eNew);
|
||||
|
||||
vec3 vT_ms = Population->get_average_speed_ms(loc_m);
|
||||
Particle TNew = Particle_Builder::createTritium2I(loc_m, vT_ms, -1, interPart->get_Id());
|
||||
InterOut.add_new_particle(TNew);
|
||||
|
||||
return(InterOut);
|
||||
}
|
||||
|
||||
inline vec3 eT2_T2I_Ionization_Analytic::roll_vLab_ms(const Particle &interPart) {
|
||||
vec3 v_ms = interPart.get_Speed_ms();
|
||||
vec3 vT2_ms = Population->roll_speed_ms(interPart.get_Location_m());
|
||||
vec3 vOff_ms = vT2_ms;
|
||||
vec3 vLab_ms = v_ms - vOff_ms;
|
||||
double T_eV = calc_Ekin_eV_from_speed(vLab_ms, me_eV);
|
||||
if (T_eV < EionT2_eV) { // Set Tritium Speed to 0 if unlucky roll
|
||||
T_eV = calc_Ekin_eV_from_speed(v_ms, me_eV);
|
||||
}
|
||||
return (T_eV);
|
||||
}
|
||||
|
||||
inline double eT2_T2I_Ionization_Analytic::roll_ionW_eV(double T_eV) {
|
||||
double pmax, Wmin_eV, Wmax_eV, Wcan_eV,eta1,eta2;
|
||||
pmax = BED_eT2_Ionization::calc_TCS(T_eV);
|
||||
Wmin_eV = 0;
|
||||
Wmax_eV = T_eV-EionT2_eV;
|
||||
do {
|
||||
eta1 = rngUni->random();
|
||||
eta2 = rngUni->random();
|
||||
Wcan_eV = Wmin_eV + eta1*(Wmax_eV - Wmin_eV);
|
||||
} while(eta2*pmax > BED_eT2_Ionization::calc_SDCS(T_eV, Wcan_eV));
|
||||
double W_eV = (Wcan_eV< (T_eV-EionT2_eV)/2 ) ? Wcan_eV : (T_eV-EionT2_eV) - Wcan_eV;
|
||||
return(W_eV);
|
||||
}
|
||||
|
||||
inline double eT2_T2I_Ionization_Analytic::roll_IonTheta1(double T_eV, double W_eV) {
|
||||
double theta1;
|
||||
if (W_eV > 100) {
|
||||
double numerator = W_eV/T_eV;
|
||||
double denominator = (1-W_eV / T_eV)*(T_eV/(2*me_eV)) + 1;
|
||||
theta1 = asin(sqrt(numerator/denominator));
|
||||
} else {
|
||||
theta1 = rngUni->random()*pi/4;
|
||||
}
|
||||
return (theta1);
|
||||
}
|
||||
|
||||
inline double eT2_T2I_Ionization_Analytic::roll_IonTheta2(double T_eV, double W_eV) {
|
||||
double theta2;
|
||||
if (W_eV > 200) {
|
||||
double numerator = 1- W_eV/T_eV;
|
||||
double denominator = 1 + W_eV/(2*me_eV);
|
||||
theta2 = asin(sqrt(numerator/denominator));
|
||||
} else if (W_eV >= 50) {
|
||||
double decider = rngUni->random();
|
||||
if (decider < 0.9) {
|
||||
theta2 = 1 + rngUni->random() * pi/4 + pi/4;
|
||||
} else {
|
||||
theta2 = rngUni->random() * pi;
|
||||
}
|
||||
} else {
|
||||
theta2 = rngUni->random() * pi;
|
||||
}
|
||||
return(theta2);
|
||||
}
|
||||
|
||||
|
||||
class eT2_T2I_Ionization_Container : public Sub_Interaction_Base {
|
||||
Average_Container<dim1Map> TCS_Average;
|
||||
Stacked_Container<dim2Map> SDCS_Stacked;
|
||||
|
||||
public:
|
||||
eT2_T2I_Ionization_Container(Population_Base *T2Population, UniRNG *rngUni) : Sub_Interaction_Base(T2Population, rngUni) {
|
||||
TCS_Average = Average_Container<dim1Map>(getDataPath() + "BED_average_TCS.dat");
|
||||
SDCS_Stacked = Stacked_Container<dim2Map>(0, getDataPath() + "BED_stacked_SDCS.dat");
|
||||
};
|
||||
|
||||
double get_macroSigma_m2(const Particle &interPart);
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
private:
|
||||
vec3 roll_vLab_ms(const Particle &interPart);
|
||||
double roll_ionW_eV(double T_eV);
|
||||
double roll_IonTheta1(double T_eV, double W_eV);
|
||||
double roll_IonTheta2(double T_eV, double W_eV);
|
||||
};
|
||||
|
||||
|
||||
inline double eT2_T2I_Ionization_Container::get_macroSigma_m2(const Particle &interPart) {
|
||||
double T_eV = interPart.get_EKin_eV();
|
||||
double microSigma_m2 = TCS_Average.get_value(ddeque{T_eV});
|
||||
vec3 loc_m = interPart.get_Location_m();
|
||||
double nT2_m3 = Population->get_density_m3(loc_m);
|
||||
return (microSigma_m2*nT2_m3);
|
||||
}
|
||||
|
||||
|
||||
inline InteractionOut eT2_T2I_Ionization_Container::do_Interaction (Particle *interPart) {
|
||||
vec3 vLab_ms = roll_vLab_ms(*interPart);
|
||||
vec3 v_ms = interPart->get_Speed_ms();
|
||||
|
||||
double T_eV = calc_Ekin_eV_from_speed(v_ms, me_eV);
|
||||
if (T_eV < EionT2_eV) {
|
||||
throw MyException("Electron::do_Ionization: Ekin_eV < EIonT2_eV.");
|
||||
}
|
||||
double W_eV = roll_ionW_eV(T_eV);
|
||||
|
||||
double E1_eV = T_eV-EionT2_eV - W_eV;
|
||||
|
||||
double phi1 = rngUni->random()*2*pi;
|
||||
double phi2 = phi1-pi;
|
||||
|
||||
double theta1 = roll_IonTheta1(T_eV, W_eV);
|
||||
double theta2 = roll_IonTheta2(T_eV, W_eV);
|
||||
|
||||
double v1Absnew_ms = calc_Speed_from_Ekin_eV(E1_eV, me_eV);
|
||||
double v2Absnew_ms = calc_Speed_from_Ekin_eV(W_eV, me_eV);
|
||||
|
||||
vec3 P1newDir, P2newDir, v1New_ms, v2New_ms ;
|
||||
P1newDir = calc_newDirection(v_ms, theta1, phi1);
|
||||
P2newDir = calc_newDirection(v_ms, theta2, phi2);
|
||||
|
||||
vec3 vOff_ms = vLab_ms - v_ms;
|
||||
v1New_ms = v1Absnew_ms*P1newDir + vOff_ms;
|
||||
v2New_ms = v2Absnew_ms*P2newDir + vOff_ms;
|
||||
|
||||
interPart->set_Speed_ms(v1New_ms);
|
||||
|
||||
vec3 loc_m = interPart->get_Location_m();
|
||||
Particle eNew = Particle_Builder::createElectron(loc_m, v2New_ms, -1, interPart->get_Id());
|
||||
InteractionOut InterOut;
|
||||
InterOut.add_new_particle(eNew);
|
||||
|
||||
vec3 vT_ms = Population->get_average_speed_ms(loc_m);
|
||||
Particle TNew = Particle_Builder::createTritium2I(loc_m, vT_ms, -1, interPart->get_Id());
|
||||
InterOut.add_new_particle(TNew);
|
||||
|
||||
return(InterOut);
|
||||
}
|
||||
|
||||
inline vec3 eT2_T2I_Ionization_Container::roll_vLab_ms(const Particle &interPart) {
|
||||
vec3 v_ms = interPart.get_Speed_ms();
|
||||
vec3 vT2_ms = Population->roll_speed_ms(interPart.get_Location_m());
|
||||
vec3 vOff_ms = vT2_ms;
|
||||
vec3 vLab_ms = v_ms - vOff_ms;
|
||||
double T_eV = calc_Ekin_eV_from_speed(vLab_ms, me_eV);
|
||||
if (T_eV < EionT2_eV) { // Set Tritium Speed to 0 if unlucky roll
|
||||
T_eV = calc_Ekin_eV_from_speed(v_ms, me_eV);
|
||||
}
|
||||
return (T_eV);
|
||||
}
|
||||
|
||||
inline double eT2_T2I_Ionization_Container::roll_ionW_eV(double T_eV) {
|
||||
return (SDCS_Stacked.sample(ddeque{T_eV}, rngUni));
|
||||
}
|
||||
|
||||
inline double eT2_T2I_Ionization_Container::roll_IonTheta1(double T_eV, double W_eV) {
|
||||
double theta1;
|
||||
if (W_eV > 100) {
|
||||
double numerator = W_eV/T_eV;
|
||||
double denominator = (1-W_eV / T_eV)*(T_eV/(2*me_eV)) + 1;
|
||||
theta1 = asin(sqrt(numerator/denominator));
|
||||
} else {
|
||||
theta1 = rngUni->random()*pi/4;
|
||||
}
|
||||
return (theta1);
|
||||
}
|
||||
|
||||
inline double eT2_T2I_Ionization_Container::roll_IonTheta2(double T_eV, double W_eV) {
|
||||
double theta2;
|
||||
if (W_eV > 200) {
|
||||
double numerator = 1- W_eV/T_eV;
|
||||
double denominator = 1 + W_eV/(2*me_eV);
|
||||
theta2 = asin(sqrt(numerator/denominator));
|
||||
} else if (W_eV >= 50) {
|
||||
double decider = rngUni->random();
|
||||
if (decider < 0.9) {
|
||||
theta2 = 1 + rngUni->random() * pi/4 + pi/4;
|
||||
} else {
|
||||
theta2 = rngUni->random() * pi;
|
||||
}
|
||||
} else {
|
||||
theta2 = rngUni->random() * pi;
|
||||
}
|
||||
return(theta2);
|
||||
}
|
||||
#endif /* eT2_ionization_h */
|
||||
Reference in New Issue
Block a user