eT2_T2I_Ionization_Janev_(label) 1. non dissoziative labeled as ndiss 2. dissoziative via X2 Sigma^+_g labeled as diss_g 3. dissoziative via B2 Sigma^+_u labeled as diss_u Added more Excitation Channels e + T2 from Janev
76 lines
2.3 KiB
C++
76 lines
2.3 KiB
C++
//
|
|
// injector.cpp
|
|
// mc_electron
|
|
//
|
|
// Created by Christian Reiling on 13.04.19.
|
|
// Copyright © 2019 Christian Reiling. All rights reserved.
|
|
//
|
|
|
|
#include "read_system.h"
|
|
|
|
#include "injector.hpp"
|
|
#include "katrin_geo.hpp"
|
|
|
|
const int Injector::injectionMethod = load_parameter("injectionMethod");
|
|
const double Injector::injectionEnergy_eV = load_parameter("injectionEnergy_eV");
|
|
|
|
Particle Injector::injectElectron (const int &newId) {
|
|
double r_m = Katrin_Geo::get_radius_m()*sqrt(rngUni->random());
|
|
double phi = rngUni->random()*2*pi;
|
|
|
|
double z_WGTSstart_m = Katrin_Geo::get_z_WGTSstart_m();
|
|
double wgtsLength_m = Katrin_Geo::get_wgtsLength_m();
|
|
|
|
double z_WGTS_start_to_half_pos_m = sqrt(rngUni->random())*wgtsLength_m/2;
|
|
double z_m = (rngUni->random()<0.5) ? z_WGTS_start_to_half_pos_m : wgtsLength_m - z_WGTS_start_to_half_pos_m;
|
|
z_m += z_WGTSstart_m;
|
|
|
|
vec3 loc_m = vec3 (r_m*cos(phi),r_m*sin(phi),z_m);
|
|
double Ekin_eV;
|
|
switch(injectionMethod) {
|
|
case 0: // Fermi
|
|
Ekin_eV = roll_FermiEnergy_eV();
|
|
break;
|
|
case 1: //Delta
|
|
Ekin_eV = injectionEnergy_eV;
|
|
break;
|
|
case 2: //Maxwell Boltzman
|
|
Ekin_eV = roll_MBEnergy(injectionEnergy_eV/kb_eVK,me_eV, rngNormal);
|
|
break;
|
|
default:
|
|
throw MyException("Katrin::injectElectron: Invalid Injection Method.");
|
|
break;
|
|
}
|
|
vec3 speed_ms = roll_uniform_direction(rngUni) * calc_Speed_from_Ekin_eV(Ekin_eV,me_eV);
|
|
return PartFac.createElectron(loc_m, speed_ms,newId,newId);
|
|
}
|
|
|
|
double Injector::roll_FermiEnergy_eV() {
|
|
double pmax,E_min_eV, E_max_eV, Ecan_eV,eta1,eta2;
|
|
pmax = 1.5e-28; // From Plotting EnergyDistributionBetaDecay
|
|
E_min_eV = scale_start;
|
|
E_max_eV = TritiumDecayEndpoint_eV;
|
|
do {
|
|
eta1 = rngUni->random();
|
|
eta2 = rngUni->random();
|
|
Ecan_eV = E_min_eV + eta1*(E_max_eV - E_min_eV);
|
|
} while(eta2*pmax > get_FermiDecaySpectrumDensity(Ecan_eV));
|
|
return Ecan_eV;
|
|
}
|
|
|
|
double Injector::get_FermiDecaySpectrumDensity(const double &Ekin_eV) {
|
|
if (Ekin_eV>TritiumDecayEndpoint_eV) {
|
|
return 0;
|
|
} else{
|
|
double p_eV = sqrt(Ekin_eV*Ekin_eV + 2 * Ekin_eV * me_eV);
|
|
return BetaDecayConst*get_FermiFunction(2, Ekin_eV)*p_eV*(Ekin_eV+me_eV)*pow(TritiumDecayEndpoint_eV-Ekin_eV,2);
|
|
}
|
|
}
|
|
|
|
double Injector::get_FermiFunction(const double &Z, const double &Ekin_eV) {
|
|
double gamma = 1+ Ekin_eV/me_eV;
|
|
double beta = sqrt(1 - pow(gamma,-2));
|
|
double eta =Z/beta/137.;
|
|
return 2*pi*eta/(1-exp(-2*pi*eta));
|
|
}
|