Reworked Katrin Geometrics.

Added creation of T3+ clusters.
Added diss. recombination fo T3+ + e-
This commit is contained in:
Christian
2019-07-12 15:15:23 +02:00
parent 194d3eaf77
commit 6f288bb0c1
72 changed files with 811 additions and 589 deletions
+47
View File
@@ -0,0 +1,47 @@
//
// T2IT2_cluster.h
// mc_electron
//
// Created by Christian Reiling on 12.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef T2IT2_cluster_h
#define T2IT2_cluster_h
#include "janev_T2IT2_cluster.h"
class T2IT2_Cluster : public Sub_Interaction_Base {
public:
T2IT2_Cluster(Population_Base *T2Population, UniRNG *rngUni) : Sub_Interaction_Base(T2Population, rngUni) {}
double get_macroSigma_m2(const Particle &interPart);
InteractionOut do_Interaction (Particle *interPart);
};
inline double T2IT2_Cluster::get_macroSigma_m2(const Particle &interPart) {
double E_eV = interPart.get_E_eV();
double microSigma_m2 = Janev_T2IT2_Cluster::get_TCS(E_eV);
vec3 loc_m = interPart.get_x_m();
double nT2_m3 = Population->get_density_m3(loc_m);
return microSigma_m2*nT2_m3;
}
inline InteractionOut T2IT2_Cluster::do_Interaction (Particle *interPart) {
InteractionOut InterOut;
vec3 loc_m = interPart->get_x_m();
vec3 v2_ms = Population->roll_v_ms(loc_m);
vec3 vLab_ms = interPart->get_v_ms() - v2_ms;
vec3 v1_ms = roll_uniform_direction(rngUni) * calc_vec3_abs(vLab_ms) + v2_ms;
Particle TNew = Particle_Builder::create_T(loc_m, v1_ms, -1, interPart->get_Id());
Particle T3New = Particle_Builder::create_T3I(loc_m, v2_ms, -1, interPart->get_Id());
InterOut.add_new_particle(TNew);
InterOut.add_new_particle(T3New);
InterOut.set_delete_current(true);
return InterOut;
}
#endif /* T2IT2_cluster_h */
-53
View File
@@ -1,53 +0,0 @@
//
// TT2_elastic.h
// mc_electron
//
// Created by Christian Reiling on 20.05.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef TT2_elastic_h
#define TT2_elastic_h
#include "sub_interaction_base.h"
#include "hardsphere_elastic.h"
class TT2_Elastic : public Sub_Interaction_Base {
Hardsphere_elasticScattering HardSphere = Hardsphere_elasticScattering(1e-20); //3.4614e-15);
public:
TT2_Elastic(Population_Base *T2Population, UniRNG *rngUni) : Sub_Interaction_Base(T2Population, rngUni) {};
double get_macroSigma_m2(const Particle &interPart);
InteractionOut do_Interaction (Particle *interPart);
private:
vec3 calc_vNew_ms(vec3 vOld_ms, vec3 vT2_ms, double thetaLab, double phiLab);
};
inline double TT2_Elastic::get_macroSigma_m2(const Particle &interPart) {
vec3 loc_m = interPart.get_Location_m();
double n_m3 = (Population->get_density_m3(loc_m));
return HardSphere.get_TCS() * n_m3;
}
inline InteractionOut TT2_Elastic::do_Interaction (Particle *interPart) {
vec3 v_ms = interPart->get_Speed_ms();
vec3 loc_m = interPart->get_Location_m();
vec3 vT2_ms = (Population->roll_speed_ms(loc_m));
vec3 vLab_ms = v_ms - vT2_ms;
double thetaLab = HardSphere.roll_theta(rngUni);
double phiLab = rngUni->random() * 2 * pi;
interPart->set_Speed_ms( calc_vNew_ms(v_ms, vT2_ms, thetaLab, phiLab) );
return InteractionOut();
}
inline vec3 TT2_Elastic::calc_vNew_ms(vec3 vOld_ms, vec3 vT2_ms, double thetaLab, double phiLab) {
vec3 speedLab_ms = vOld_ms - vT2_ms;
vec3 n0 = calc_newDirection(speedLab_ms, thetaLab, phiLab);
vec3 vNew_ms = (mT2_eV*vec3Abs(speedLab_ms)*n0 + me_eV*speedLab_ms)/(me_eV+mT2_eV) + vT2_ms;
return vNew_ms;
}
#endif /* TT2_elastic_h */
+5 -5
View File
@@ -10,7 +10,7 @@
#include <sstream>
#include "katrin_geo.hpp"
#include "katrin_geo.h"
#include "error_types.h"
@@ -42,12 +42,12 @@ ASCI_Logger::ASCI_Logger() {
void ASCI_Logger::set_zLogValues() {
zLogValues.clear();
if (logging) {
double start_m = Katrin_Geo::get_z_RW_m();
double length_m = Katrin_Geo::get_z_WGTSend_m() - start_m;
double start_m = z_RW_m;
double length_m = z_WGTS_end_m - start_m;
double stepLength_m = length_m/(numberZBins-1);
double z_m;
for (int i = 0;i<numberZBins;i++) {
z_m = Katrin_Geo::get_z_RW_m() + stepLength_m*i;
z_m = z_RW_m + stepLength_m*i;
zLogValues.push_back(z_m);
}
}
@@ -82,7 +82,7 @@ void ASCI_Logger::log_Particle(Particle *logPart, blitz::TinyVector<double,3> ol
outStream[0]<<*logPart<<endl;
} else {
double zold = oldLoc_m[2];
double znew = logPart->get_Location_m()[2];
double znew = logPart->get_x_m()[2];
double zmin = min(zold,znew);
double zmax = max(zold,znew);
+14 -1
View File
@@ -27,7 +27,6 @@ constant ERyd_eV = 13.605693009;
// Particle Properties
constant me_eV = 0.511e6;
constant mT_eV = 2.8094320212e9;
constant mT2_eV = mT_eV*2;
constant re_m = 2.817940322719e-15;
@@ -39,6 +38,20 @@ constant decayConstT2_s = 1.78405e-09;
constant BetaDecayConst = 1.2072343416696292e-47;
constant TritiumDecayEndpoint_eV = 18.574e3;
// WGTS
constant z_RW_m = -3;
constant z_WGTS_start_m = 0;
constant z_WGTS_end_m = 10;
constant z_DPS_end_m = 13;
constant r_WGTS_m = 0.045;
constant l_WGTS_m = z_WGTS_end_m - z_WGTS_start_m;
constant z_WGTS_mid_m = (z_WGTS_end_m+z_WGTS_start_m)/2;
// from Kuckert:2018aa
constant reduction_WGTS_front = 0.034;
constant reduction_WGTS_rear = 0.033;
constant reduction_tot_front = 5e-10;
constant reduction_tot_rear = 5.2e-10;
#endif /* constants_h */
+7 -7
View File
@@ -26,28 +26,28 @@ protected:
};
inline void Drift_Base::move(Particle *movePart, const double &macroSigma_m2) {
vec3 oldLoc_m = movePart->get_Location_m();
vec3 oldLoc_m = movePart->get_x_m();
vec3 newLoc_m = oldLoc_m;
double znew_m = get_zNew_m(movePart, macroSigma_m2);
doWallInteraction(movePart, &oldLoc_m, &znew_m);
newLoc_m[2] = znew_m;
movePart->set_Location_m(newLoc_m);
movePart->set_x_m(newLoc_m);
Logger->log(*movePart,oldLoc_m);
Population->increase_density(*movePart, oldLoc_m);
}
inline double Drift_Base::get_zNew_m(Particle *movePart, const double &macroSigma_m2) {
double zold_m = movePart->get_Location_m()[2];
double zold_m = movePart->get_x_m()[2];
vec3 v_ms = movePart->get_Speed_ms();
double vTotAbs_ms = vec3Abs(v_ms);
double vForwardAbs_ms = vec3Abs(vec3(0,0,v_ms[2]));
vec3 v_ms = movePart->get_v_ms();
double vTotAbs_ms = calc_vec3_abs(v_ms);
double vForwardAbs_ms = calc_vec3_abs(vec3(0,0,v_ms[2]));
double zDir = v_ms[2] <= 0 ? -1 : 1;
double znew_m;
if (macroSigma_m2 == 0) {
znew_m = (zDir == -1) ? Katrin_Geo::get_z_RW_m() : Katrin_Geo::get_z_WGTSend_m();
znew_m = (zDir == -1) ? z_RW_m : z_WGTS_end_m;
} else {
double distance_m = 1/macroSigma_m2;
znew_m = zold_m + zDir*vForwardAbs_ms/vTotAbs_ms * distance_m;
+7 -5
View File
@@ -10,7 +10,6 @@
#define eT2I_recombination_h
#include "sub_interaction_base.h"
#include "tcs_container.hpp"
#include "janev_eT2I_recombination.h"
class eT2I_Recombination : public Sub_Interaction_Base {
@@ -23,9 +22,9 @@ public:
inline double eT2I_Recombination::get_macroSigma_m2(const Particle &interPart) {
double Ekin_eV = interPart.get_EKin_eV();
double microSigma_m2 = Janev_eT2_Recombination::get_TCS(Ekin_eV);
vec3 loc_m = interPart.get_Location_m();
double E_eV = interPart.get_E_eV();
double microSigma_m2 = Janev_eT2I_Recombination::get_TCS(E_eV);
vec3 loc_m = interPart.get_x_m();
double nT2I_m3 = Population->get_density_m3(loc_m);
return microSigma_m2*nT2I_m3;
}
@@ -33,8 +32,11 @@ inline double eT2I_Recombination::get_macroSigma_m2(const Particle &interPart) {
inline InteractionOut eT2I_Recombination::do_Interaction (Particle *interPart) {
InteractionOut res;
res.set_delete_current(true);
res.set_decrease(tritium2I, interPart->get_Location_m(), 0); // 0 is dummy parameter, since thermal population
Population->decrease_denisty(interPart->get_x_m(), interPart->get_E_eV());
// Maybe add the 2 T atoms.
return res;
}
#endif /* eT2I_recombination_h */
+14 -14
View File
@@ -25,7 +25,7 @@ class eT2_Elastic : public Sub_Interaction_Base {
public:
eT2_Elastic(Population_Base *T2Population, UniRNG *rngUni, DCS_Base *dcs_gen) : Sub_Interaction_Base(T2Population, rngUni),
tcs_data(scale_start, scale_end, 1e3, get_data_path() + "eT2_ela_TCS.dat"),
kinematics(me_eV, mT2_eV) {
kinematics(me_eV, 2*mT_eV) {
this->dcs_gen = dcs_gen;
}
@@ -35,19 +35,19 @@ public:
inline double eT2_Elastic::get_macroSigma_m2(const Particle &interPart) {
double Ekin_eV = interPart.get_EKin_eV();
double microSigma_m2 = tcs_data.get_value(Ekin_eV);
vec3 loc_m = interPart.get_Location_m();
double E_eV = interPart.get_E_eV();
double microSigma_m2 = tcs_data.get_value(E_eV);
vec3 loc_m = interPart.get_x_m();
double nT2_m3 = Population->get_density_m3(loc_m);
return microSigma_m2*nT2_m3;
}
inline InteractionOut eT2_Elastic::do_Interaction (Particle *interPart) {
// Here theta and phi are COM-Angles.... prob not correct. For m1 << m2 COM - Angle ~ Lab Angle
vec3 v1_ms = interPart->get_Speed_ms();
vec3 vOff_ms = Population->roll_speed_ms(interPart->get_Location_m());
vec3 v1_ms = interPart->get_v_ms();
vec3 vOff_ms = Population->roll_v_ms(interPart->get_x_m());
vec3 vLab_ms = v1_ms - vOff_ms;
double T_eV = calc_Ekin_eV_from_speed(vLab_ms, me_eV);
double T_eV = calc_E_eV_from_v_ms(vLab_ms, me_eV);
double theta_lab = dcs_gen->get_theta(T_eV);
double phi_lab = rngUni->random() * 2 * pi;
kinematics.doKinematics(interPart, vOff_ms, theta_lab, phi_lab);
@@ -65,7 +65,7 @@ class eT2_Elastic_Analytic : public Sub_Interaction_Base {
Elastic_Kinematic_Base kinematics;
public:
eT2_Elastic_Analytic(Population_Base *T2Population, UniRNG *rngUni) : Sub_Interaction_Base(T2Population, rngUni) {
kinematics = Elastic_Kinematic_Base(me_eV, mT2_eV);
kinematics = Elastic_Kinematic_Base(me_eV, 2*mT_eV);
};
double get_macroSigma_m2(const Particle &interPart);
@@ -74,19 +74,19 @@ public:
inline double eT2_Elastic_Analytic::get_macroSigma_m2(const Particle &interPart) {
double Ekin_eV = interPart.get_EKin_eV();
double microSigma_m2 = Uehara_eT2_ElasticScattering::calc_TCS(Ekin_eV);
vec3 loc_m = interPart.get_Location_m();
double E_eV = interPart.get_E_eV();
double microSigma_m2 = Uehara_eT2_ElasticScattering::calc_TCS(E_eV);
vec3 loc_m = interPart.get_x_m();
double nT2_m3 = Population->get_density_m3(loc_m);
return microSigma_m2*nT2_m3;
}
inline InteractionOut eT2_Elastic_Analytic::do_Interaction (Particle *interPart) {
// Here theta and phi are COM-Angles.... prob not correct. For m1 << m2 COM - Angle ~ Lab Angle
vec3 v1_ms = interPart->get_Speed_ms();
vec3 vOff_ms = Population->roll_speed_ms(interPart->get_Location_m());
vec3 v1_ms = interPart->get_v_ms();
vec3 vOff_ms = Population->roll_v_ms(interPart->get_x_m());
vec3 vLab_ms = v1_ms - vOff_ms;
double T_eV = calc_Ekin_eV_from_speed(vLab_ms, me_eV);
double T_eV = calc_E_eV_from_v_ms(vLab_ms, me_eV);
double theta_lab = Uehara_eT2_ElasticScattering::roll_theta(T_eV, rngUni);
double phi_lab = rngUni->random() * 2 * pi;
kinematics.doKinematics(interPart, vOff_ms, theta_lab, phi_lab);
+6 -6
View File
@@ -17,8 +17,8 @@ public:
eT2_ElExc_Nu_Analytic(Population_Base *T2Population, UniRNG *rngUni, Janev_eT2_ElExc_Nu janev_Nu_in, DCS_Base *dcs_gen) : Excitation_Base(T2Population, rngUni, janev_Nu_in.get_deltaE_eV(), dcs_gen), janev_Nu(janev_Nu_in) {};
private:
double get_microSigma_m2(const double &Ekin_eV) {
return janev_Nu.get_TCS_m2(Ekin_eV);
double get_microSigma_m2(const double &E_eV) {
return janev_Nu.get_TCS_m2(E_eV);
}
};
@@ -29,8 +29,8 @@ public:
eT2_ElExc_Ng_Analytic(Population_Base *T2Population, UniRNG *rngUni, Janev_eT2_ElExc_Ng janev_Ng_in, DCS_Base *dcs_gen) : Excitation_Base(T2Population, rngUni, janev_Ng_in.get_deltaE_eV(), dcs_gen), janev_Ng(janev_Ng_in) {};
private:
double get_microSigma_m2(const double &Ekin_eV) {
return janev_Ng.get_TCS_m2(Ekin_eV);
double get_microSigma_m2(const double &E_eV) {
return janev_Ng.get_TCS_m2(E_eV);
}
};
@@ -41,8 +41,8 @@ public:
eT2_ElExc_n_Analytic(Population_Base *T2Population, UniRNG *rngUni, Janev_eT2_ElExc_n janev_n_in, DCS_Base *dcs_gen) : Excitation_Base(T2Population, rngUni, janev_n_in.get_deltaE_eV(), dcs_gen), janev_n(janev_n_in) {};
private:
double get_microSigma_m2(const double &Ekin_eV) {
return janev_n.get_TCS_m2(Ekin_eV);
double get_microSigma_m2(const double &E_eV) {
return janev_n.get_TCS_m2(E_eV);
}
};
+30 -30
View File
@@ -42,10 +42,10 @@ protected:
};
inline InteractionOut eT2_T2I_Ionization_Base::do_Interaction (Particle *interPart) {
vec3 v1_ms = interPart->get_Speed_ms();
vec3 v1_ms = interPart->get_v_ms();
vec3 vOff_ms = get_vOff_ms(*interPart, deltaE_eV);
vec3 vLab_ms = v1_ms - vOff_ms;
double T_eV = calc_Ekin_eV_from_speed(vLab_ms, me_eV);
double T_eV = calc_E_eV_from_v_ms(vLab_ms, me_eV);
double W_eV = roll_ionW_eV(T_eV);
double E1_eV = T_eV-EionT2_eV - W_eV;
@@ -56,19 +56,19 @@ inline InteractionOut eT2_T2I_Ionization_Base::do_Interaction (Particle *interPa
double theta1 = roll_theta1(T_eV, W_eV);
double theta2 = roll_theta2(T_eV, W_eV);
double v1_lab_new_ms = calc_Speed_from_Ekin_eV(E1_eV, me_eV);
double v2_lab_new_ms = calc_Speed_from_Ekin_eV(W_eV, me_eV);
double v1_lab_new_ms = calc_v_ms_from_E_eV(E1_eV, me_eV);
double v2_lab_new_ms = calc_v_ms_from_E_eV(W_eV, me_eV);
vec3 new_dir_1 = calc_newDirection(vLab_ms, theta1, phi1);
vec3 new_dir_2 = calc_newDirection(vLab_ms, theta2, phi2);
vec3 new_dir_1 = calc_n_new(vLab_ms, theta1, phi1);
vec3 new_dir_2 = calc_n_new(vLab_ms, theta2, phi2);
vec3 v1_new_ms = v1_lab_new_ms*new_dir_1 + vOff_ms;
vec3 v2_new_ms = v2_lab_new_ms*new_dir_2 + vOff_ms;
interPart->set_Speed_ms(v1_new_ms);
interPart->set_v_ms(v1_new_ms);
InteractionOut InterOut;
vec3 loc_m = interPart->get_Location_m();
Particle eNew = Particle_Builder::createElectron(loc_m, v2_new_ms, -1, interPart->get_Id());
vec3 loc_m = interPart->get_x_m();
Particle eNew = Particle_Builder::create_e(loc_m, v2_new_ms, -1, interPart->get_Id());
InterOut.add_new_particle(eNew);
add_Tritiums(&InterOut, *interPart);
@@ -76,8 +76,8 @@ inline InteractionOut eT2_T2I_Ionization_Base::do_Interaction (Particle *interPa
}
inline double eT2_T2I_Ionization_Base::get_macroSigma_m2(const Particle &interPart) {
double T_eV = interPart.get_EKin_eV();
vec3 loc_m = interPart.get_Location_m();
double T_eV = interPart.get_E_eV();
vec3 loc_m = interPart.get_x_m();
double microSigma_m2 = calc_microSigma(T_eV);
double nT2_m3 = Population->get_density_m3(loc_m);
@@ -85,10 +85,10 @@ inline double eT2_T2I_Ionization_Base::get_macroSigma_m2(const Particle &interPa
}
inline vec3 eT2_T2I_Ionization_Base::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 v_ms = interPart.get_v_ms();
vec3 vT2_ms = Population->roll_v_ms(interPart.get_x_m());
vec3 vLab_ms = v_ms - vT2_ms;
double T_eV = calc_Ekin_eV_from_speed(vLab_ms, me_eV);
double T_eV = calc_E_eV_from_v_ms(vLab_ms, me_eV);
if (T_eV < EionT2_eV) { // Set Tritium Speed to 0 if unlucky roll
return v_ms;
} else {
@@ -137,9 +137,9 @@ protected:
protected:
void add_Tritiums(InteractionOut *InterOut, const Particle &interPart) {
vec3 loc_m = interPart.get_Location_m();
vec3 vT_ms = Population->roll_speed_ms(loc_m);
Particle T2I_new = Particle_Builder::createTritium2I(loc_m, vT_ms, -1, interPart.get_Id());
vec3 loc_m = interPart.get_x_m();
vec3 vT_ms = Population->roll_v_ms(loc_m);
Particle T2I_new = Particle_Builder::create_T2I(loc_m, vT_ms, -1, interPart.get_Id());
InterOut->add_new_particle(T2I_new);
}
};
@@ -207,9 +207,9 @@ protected:
}
void add_Tritiums(InteractionOut *InterOut, const Particle &interPart) {
vec3 loc_m = interPart.get_Location_m();
vec3 vT_ms = Population->get_average_speed_ms(loc_m);
Particle T2I_new = Particle_Builder::createTritium2I(loc_m, vT_ms, -1, interPart.get_Id());
vec3 loc_m = interPart.get_x_m();
vec3 vT2_ms = Population->roll_v_ms(loc_m);
Particle T2I_new = Particle_Builder::create_T2I(loc_m, vT2_ms, -1, interPart.get_Id());
InterOut->add_new_particle(T2I_new);
}
};
@@ -231,14 +231,14 @@ protected:
}
void add_Tritiums(InteractionOut *InterOut, const Particle &interPart) {
vec3 loc_m = interPart.get_Location_m();
vec3 loc_m = interPart.get_x_m();
vec3 vT_ms = Population->roll_speed_ms(loc_m);
Particle newPart = Particle_Builder::createTritium(loc_m, vT_ms, -1, interPart.get_Id());
vec3 vT_ms = Population->roll_v_ms(loc_m);
Particle newPart = Particle_Builder::create_T(loc_m, vT_ms, -1, interPart.get_Id());
InterOut->add_new_particle(newPart);
vT_ms = Population->roll_speed_ms(loc_m);
newPart = Particle_Builder::createTritiumI(loc_m, vT_ms, -1, interPart.get_Id());
vT_ms = Population->roll_v_ms(loc_m);
newPart = Particle_Builder::create_TI(loc_m, vT_ms, -1, interPart.get_Id());
InterOut->add_new_particle(newPart);
}
};
@@ -260,14 +260,14 @@ protected:
}
void add_Tritiums(InteractionOut *InterOut, const Particle &interPart) {
vec3 loc_m = interPart.get_Location_m();
vec3 loc_m = interPart.get_x_m();
vec3 vT_ms = Population->roll_speed_ms(loc_m);
Particle newPart = Particle_Builder::createTritium(loc_m, vT_ms, -1, interPart.get_Id());
vec3 vT_ms = Population->roll_v_ms(loc_m);
Particle newPart = Particle_Builder::create_T(loc_m, vT_ms, -1, interPart.get_Id());
InterOut->add_new_particle(newPart);
vT_ms = Population->roll_speed_ms(loc_m);
newPart = Particle_Builder::createTritiumI(loc_m, vT_ms, -1, interPart.get_Id());
vT_ms = Population->roll_v_ms(loc_m);
newPart = Particle_Builder::create_TI(loc_m, vT_ms, -1, interPart.get_Id());
InterOut->add_new_particle(newPart);
}
};
+4 -4
View File
@@ -17,8 +17,8 @@ public:
eT2_VibExc01(Population_Base *T2Population, UniRNG *rngUni, DCS_Base *dcs_gen) : Excitation_Base(T2Population, rngUni, dcs_gen, Janev_eT2_VibExc0102::get_deltaE_eV(1)) {};
private:
double get_microSigma_m2(const double &Ekin_eV) {
return Janev_eT2_VibExc0102::get_TCS(Ekin_eV, 1);
double get_microSigma_m2(const double &E_eV) {
return Janev_eT2_VibExc0102::get_TCS(E_eV, 1);
}
};
@@ -28,8 +28,8 @@ public:
eT2_VibExc02(Population_Base *T2Population, UniRNG *rngUni) : Excitation_Base(T2Population, rngUni, Janev_eT2_VibExc0102::get_deltaE_eV(2)) {};
private:
double get_microSigma_m2(const double &Ekin_eV) {
return Janev_eT2_VibExc0102::get_TCS(Ekin_eV, 2);
double get_microSigma_m2(const double &E_eV) {
return Janev_eT2_VibExc0102::get_TCS(E_eV, 2);
}
};
+42
View File
@@ -0,0 +1,42 @@
//
// eT3I_recombination.h
// mc_electron
//
// Created by Christian Reiling on 12.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef eT3I_recombination_h
#define eT3I_recombination_h
#include "sub_interaction_base.h"
#include "janev_eT3I_recombination.h"
class eT3I_Recombination : public Sub_Interaction_Base {
public:
eT3I_Recombination(Population_Base *T3IPopulation, UniRNG *rngUni) : Sub_Interaction_Base(T3IPopulation, rngUni) {}
double get_macroSigma_m2(const Particle &interPart);
InteractionOut do_Interaction (Particle *interPart);
};
inline double eT3I_Recombination::get_macroSigma_m2(const Particle &interPart) {
double E_eV = interPart.get_E_eV();
double microSigma_m2 = Janev_eT3I_Recombination::get_TCS(E_eV);
vec3 loc_m = interPart.get_x_m();
double nT2I_m3 = Population->get_density_m3(loc_m);
return microSigma_m2*nT2I_m3;
}
inline InteractionOut eT3I_Recombination::do_Interaction (Particle *interPart) {
InteractionOut res;
res.set_delete_current(true);
Population->decrease_denisty(interPart->get_x_m(), interPart->get_E_eV());
// Maybe add the 3 T atoms.
return res;
}
#endif /* eT3I_recombination_h */
+25 -25
View File
@@ -30,11 +30,11 @@ private:
void E_Mover_Boris::move(Particle *movePart, const double &macroSigma_m2) {
// Prepare detection for change of z direction for logging
double oldzDir = movePart->get_Speed_ms()[2] < 0 ? -1 : 1;
vec3 oldLoc_m = movePart->get_Location_m();
double oldzDir = movePart->get_v_ms()[2] < 0 ? -1 : 1;
vec3 oldLoc_m = movePart->get_x_m();
if (macroSigma_m2 == 0) { // If infinite movement distance let electron leave at only exit... Prob extremly faulty, but also impossible.
movePart->set_Location_m(Katrin_Geo::get_z_RW_m());
movePart->set_x_m(z_RW_m);
Logger->log(*movePart,oldLoc_m);
return;
}
@@ -44,7 +44,7 @@ void E_Mover_Boris::move(Particle *movePart, const double &macroSigma_m2) {
double traveledDistance_m = 0;
vec3 loc_m, E_Vm ,B_T;
while (traveledDistance_m < distance_m) {
loc_m = movePart->get_Location_m();
loc_m = movePart->get_x_m();
E_Vm = Katrin_Fields::getElField_Vm(loc_m);
B_T = Katrin_Fields::getMagField_T(loc_m);
@@ -63,21 +63,21 @@ void E_Mover_Boris::move(Particle *movePart, const double &macroSigma_m2) {
double E_Mover_Boris::doBoris_singleStep_m(Particle *movePart, const vec3 &E_Vm , const vec3 &B_T) {
double distance_m;
vec3 x_m = movePart->get_Location_m();
vec3 v_ms = movePart->get_Speed_ms();
vec3 x_m = movePart->get_x_m();
vec3 v_ms = movePart->get_v_ms();
x_m += dt_s/2 * v_ms;
distance_m = dt_s/2 * vec3Abs(v_ms);
distance_m = dt_s/2 * calc_vec3_abs(v_ms);
doBoris_speedChange(movePart, E_Vm , B_T);
x_m += dt_s/2 * v_ms;
distance_m += dt_s/2 * vec3Abs(v_ms);
movePart->set_Location_m(x_m);
distance_m += dt_s/2 * calc_vec3_abs(v_ms);
movePart->set_x_m(x_m);
return distance_m;
}
void E_Mover_Boris::doBoris_speedChange(Particle *movePart, const vec3 &E_Vm, const vec3 &B_T) {
double q_C = movePart->get_Charge_nat() * e_C;
double m_kg = movePart->get_Mass_eV() * e_C/c_ms/c_ms;
vec3 v_ms = movePart->get_Speed_ms();
double q_C = movePart->get_Z() * e_C;
double m_kg = movePart->get_m_eV() * e_C/c_ms/c_ms;
vec3 v_ms = movePart->get_v_ms();
vec3 t = q_C*dt_s/(2*m_kg) * B_T;
vec3 s = (2*t)/(1+dot(t,t));
@@ -85,39 +85,39 @@ void E_Mover_Boris::doBoris_speedChange(Particle *movePart, const vec3 &E_Vm, co
vec3 vPrime_ms = vMinus_ms + cross(vMinus_ms,t);
vec3 vPlus_ms = vMinus_ms + cross(vPrime_ms,s);
v_ms = vPlus_ms + q_C/m_kg*E_Vm*0.5*dt_s;
movePart->set_Speed_ms(v_ms);
movePart->set_v_ms(v_ms);
}
bool E_Mover_Boris::doBoris_WallInteraction(Particle *movePart) {
vec3 loc_m = movePart->get_Location_m();
double r_m = movePart->get_Radius_m();
if (loc_m[2]<=Katrin_Geo::get_z_RW_m()) { // Rear Wall Termination
vec3 newLoc_m = movePart->get_Location_m();
vec3 loc_m = movePart->get_x_m();
double r_m = movePart->get_r_m();
if (loc_m[2]<=z_RW_m) { // Rear Wall Termination
vec3 newLoc_m = movePart->get_x_m();
newLoc_m[2] = 0;
movePart->set_Location_m(newLoc_m);
movePart->set_x_m(newLoc_m);
return true;
}
if (r_m>=Katrin_Geo::get_radius_m()) { // WGTS Wall Termination
vec3 newLoc_m = movePart->get_Location_m();
if (r_m>=r_WGTS_m) { // WGTS Wall Termination
vec3 newLoc_m = movePart->get_x_m();
double z_m = newLoc_m[2];
newLoc_m[2] = 0;
newLoc_m = (Katrin_Geo::get_radius_m() * 1.01)/vec3Abs(newLoc_m) * newLoc_m; //1.01 to move Particle slightly out of WGTS
newLoc_m = (r_WGTS_m * 1.01)/calc_vec3_abs(newLoc_m) * newLoc_m; //1.01 to move Particle slightly out of WGTS
newLoc_m[2] = z_m;
return true;
}
if (loc_m[2]>=Katrin_Geo::get_z_WGTSend_m()) { // Spectrometer Reflection
movePart->set_Speed_ms( -1*(movePart->get_Speed_ms()) );
if (loc_m[2]>=z_WGTS_end_m) { // Spectrometer Reflection
movePart->set_v_ms( -1*(movePart->get_v_ms()) );
}
return false;
}
void E_Mover_Boris::doBoris_LogzDirChange(Particle *movePart, double *oldzDir, vec3 *oldLoc_m) {
double zDir = movePart->get_Speed_ms()[2] < 0 ? -1 : 1;
double zDir = movePart->get_v_ms()[2] < 0 ? -1 : 1;
if (*oldzDir != zDir) {
Logger->log(*movePart, *oldLoc_m);
Population->increase_density(*movePart, *oldLoc_m);
*oldzDir = zDir;
*oldLoc_m = movePart->get_Location_m();
*oldLoc_m = movePart->get_x_m();
}
return;
}
+6 -6
View File
@@ -21,21 +21,21 @@ protected:
void E_Mover_Drift::doWallInteraction(Particle *movePart, vec3 *oldLoc_m, double *znew_m) {
if (*znew_m >= Katrin_Geo::get_z_WGTSend_m()) { // Moveing into Spectrometer and reversing Speed.
if (*znew_m >= z_WGTS_end_m) { // Moveing into Spectrometer and reversing Speed.
vec3 reverseLoc_m = *oldLoc_m;
// Log Movement before Reflection
reverseLoc_m[2] = Katrin_Geo::get_z_WGTSend_m();
reverseLoc_m[2] = z_WGTS_end_m;
Logger->log(*movePart, *oldLoc_m);
Population->increase_density(*movePart, *oldLoc_m);
// Final Movement
*oldLoc_m = reverseLoc_m;
*znew_m = Katrin_Geo::get_z_WGTSend_m() - (*znew_m - Katrin_Geo::get_z_WGTSend_m());
movePart->set_Speed_ms( -1*(movePart->get_Speed_ms()) );
*znew_m = z_WGTS_end_m - (*znew_m - z_WGTS_end_m);
movePart->set_v_ms( -1*(movePart->get_v_ms()) );
}
if (*znew_m <= Katrin_Geo::get_z_RW_m()) {
*znew_m = Katrin_Geo::get_z_RW_m();
if (*znew_m <= z_RW_m) {
*znew_m = z_RW_m;
}
}
+3 -3
View File
@@ -38,13 +38,13 @@ inline bool E_Terminator::checkTermination (const Particle &movePart) {
inline bool E_Terminator::check_Wall(const Particle &movePart) {
vec3 loc_m = movePart.get_Location_m();
vec3 loc_m = movePart.get_x_m();
double z_m = loc_m[2];
double r_m = sqrt( pow(loc_m[0],2) + pow(loc_m[1],2) );
if (z_m <= Katrin_Geo::get_z_RW_m()) {
if (z_m <= z_RW_m) {
return true;
}
if (r_m >= Katrin_Geo::get_radius_m()) {
if (r_m >= r_WGTS_m) {
return true;
}
return false;
+3 -3
View File
@@ -47,7 +47,7 @@ double EnergeticPop_Container::get_cumulated_time_s(vec3 zrphiCords) {
void EnergeticPop_Container::upDensity (const Particle &upParticle, const vec3 &oldLocXYZ_m) {
check_In_Container(oldLocXYZ_m, xyz);
vec3 zrphiOld_m = transformTo_zrphiCords(oldLocXYZ_m, xyz);
vec3 zrphiNew_m = upParticle.get_Location_m();
vec3 zrphiNew_m = upParticle.get_x_m();
check_In_Container(zrphiNew_m, zrphi);
// Check r and phi not changing, only valid for drift approximation....
@@ -59,8 +59,8 @@ void EnergeticPop_Container::upDensity (const Particle &upParticle, const vec3 &
double r_m = zrphiOld_m[1];
double phi = zrphiOld_m[2];
double l_m = get_l_m();
double vAbs_ms = upParticle.get_SpeedAbs_ms();
double E_eV = upParticle.get_EKin_eV();
double vAbs_ms = upParticle.get_vAbs_ms();
double E_eV = upParticle.get_E_eV();
dim4Map::iterator zItr_min = Map.lower_bound(z_min_m);
dim4Map::iterator zItr_max = Map.lower_bound(z_max_m);
+11 -11
View File
@@ -29,23 +29,23 @@ private:
inline double Excitation_Base::get_macroSigma_m2(const Particle &interPart) {
double Ekin_eV = interPart.get_EKin_eV();
double microSigma_m2 = get_microSigma_m2(Ekin_eV);
vec3 loc_m = interPart.get_Location_m();
double E_eV = interPart.get_E_eV();
double microSigma_m2 = get_microSigma_m2(E_eV);
vec3 loc_m = interPart.get_x_m();
double n_m3 = Population->get_density_m3(loc_m);
return microSigma_m2*n_m3;
}
inline InteractionOut Excitation_Base::do_Interaction (Particle *interPart) {
vec3 vOff_ms = get_vOff_ms(*interPart, deltaE_eV);
vec3 vLab_ms = interPart->get_Speed_ms() - vOff_ms;
double EkinLab_eV = calc_Ekin_eV_from_speed(vLab_ms, me_eV);
vec3 vLab_ms = interPart->get_v_ms() - vOff_ms;
double EkinLab_eV = calc_E_eV_from_v_ms(vLab_ms, me_eV);
double EkinLabNew_eV = EkinLab_eV - deltaE_eV;
double theta_lab = dcs_gen->get_theta(EkinLab_eV);
double phi_lab = rngUni->random() * 2 * pi;
vec3 n0 = calc_newDirection(vLab_ms, theta_lab, phi_lab);
vec3 vnew_ms = n0 * calc_Speed_from_Ekin_eV(EkinLabNew_eV, me_eV) + vOff_ms;
interPart->set_Speed_ms(vnew_ms);
vec3 n0 = calc_n_new(vLab_ms, theta_lab, phi_lab);
vec3 vnew_ms = n0 * calc_v_ms_from_E_eV(EkinLabNew_eV, me_eV) + vOff_ms;
interPart->set_v_ms(vnew_ms);
return InteractionOut();
}
@@ -58,11 +58,11 @@ public:
tcs_data(scale_start, scale_end, 1e3, get_data_path() + load_file_name) {};
private:
double get_microSigma_m2(const double &Ekin_eV) {
if (Ekin_eV < deltaE_eV) {
double get_microSigma_m2(const double &E_eV) {
if (E_eV < deltaE_eV) {
return 0;
} else {
return tcs_data.get_value(Ekin_eV);
return tcs_data.get_value(E_eV);
}
}
};
+3 -3
View File
@@ -16,7 +16,7 @@
#include "hdf5.h"
#include "hdf5_hl.h"
#include "katrin_geo.hpp"
#include "katrin_geo.h"
class H5_Particles {
int numberZBins;
@@ -72,8 +72,8 @@ inline void H5_Particles::set_logging() {
inline void H5_Particles::set_zValues() {
if (logging) {
zValues = new double[numberZBins];
double start_m = Katrin_Geo::get_z_RW_m();
double length_m = Katrin_Geo::get_z_WGTSend_m() - start_m;
double start_m = z_RW_m;
double length_m = z_WGTS_end_m - start_m;
double stepLength_m = length_m/(numberZBins-1);
double z_m;
+1 -1
View File
@@ -16,7 +16,7 @@
#include "hdf5.h"
#include "hdf5_hl.h"
#include "katrin_geo.hpp"
#include "katrin_geo.h"
class H5_Populations {
hid_t *h5_file;
+7 -7
View File
@@ -64,12 +64,12 @@ void H5TB_Particle_Interface::write(const Particle &logPart) {
loggerParticle H5TB_Particle_Interface::transform(const Particle &logPart) {
logParticle res;
res.Id = logPart.get_Id();
res.parentId = logPart.get_ParentId();
res.x_m = logPart.get_Location_m()[0];
res.y_m = logPart.get_Location_m()[1];
res.z_m = logPart.get_Location_m()[2];
res.vx_ms = logPart.get_Speed_ms()[0];
res.vy_ms = logPart.get_Speed_ms()[1];
res.vz_ms = logPart.get_Speed_ms()[2];
res.parentId = logPart.get_PId();
res.x_m = logPart.get_x_m()[0];
res.y_m = logPart.get_x_m()[1];
res.z_m = logPart.get_x_m()[2];
res.vx_ms = logPart.get_v_ms()[0];
res.vy_ms = logPart.get_v_ms()[1];
res.vz_ms = logPart.get_v_ms()[2];
return res;
}
+16 -16
View File
@@ -9,40 +9,40 @@
#include "read_system.h"
#include "injector.hpp"
#include "katrin_geo.hpp"
#include "katrin_geo.h"
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 r_m = r_WGTS_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_WGTSstart_m = z_WGTS_start_m;
double wgtsLength_m = l_WGTS_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;
double E_eV;
switch(injectionMethod) {
case 0: // Fermi
Ekin_eV = roll_FermiEnergy_eV();
E_eV = roll_FermiEnergy_eV();
break;
case 1: //Delta
Ekin_eV = injectionEnergy_eV;
E_eV = injectionEnergy_eV;
break;
case 2: //Maxwell Boltzman
Ekin_eV = roll_MBEnergy(injectionEnergy_eV/kb_eVK,me_eV, rngNormal);
E_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);
vec3 v_ms = roll_uniform_direction(rngUni) * calc_v_ms_from_E_eV(E_eV,me_eV);
return PartFac.create_e(loc_m, v_ms, newId, newId);
}
double Injector::roll_FermiEnergy_eV() {
@@ -58,17 +58,17 @@ double Injector::roll_FermiEnergy_eV() {
return Ecan_eV;
}
double Injector::get_FermiDecaySpectrumDensity(const double &Ekin_eV) {
if (Ekin_eV>TritiumDecayEndpoint_eV) {
double Injector::get_FermiDecaySpectrumDensity(const double &E_eV) {
if (E_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 p_eV = sqrt(E_eV*E_eV + 2 * E_eV * me_eV);
return BetaDecayConst*get_FermiFunction(2, E_eV)*p_eV*(E_eV+me_eV)*pow(TritiumDecayEndpoint_eV-E_eV,2);
}
}
double Injector::get_FermiFunction(const double &Z, const double &Ekin_eV) {
double gamma = 1+ Ekin_eV/me_eV;
double Injector::get_FermiFunction(const double &Z, const double &E_eV) {
double gamma = 1+ E_eV/me_eV;
double beta = sqrt(1 - pow(gamma,-2));
double eta =Z/beta/137.;
return 2*pi*eta/(1-exp(-2*pi*eta));
+2 -2
View File
@@ -27,8 +27,8 @@ public:
Particle injectElectron (const int &newId);
private:
double roll_FermiEnergy_eV();
double get_FermiDecaySpectrumDensity(const double &Ekin_eV);
double get_FermiFunction(const double &Z, const double &Ekin_eV);
double get_FermiDecaySpectrumDensity(const double &E_eV);
double get_FermiFunction(const double &Z, const double &E_eV);
};
+16 -4
View File
@@ -8,15 +8,17 @@
#include "interaction_builder.hpp"
// e impact
#include "eT2_elastic.h"
#include "eT2_ionization.h"
#include "eT2I_recombination.h"
//#include "eT2_vibexc0102.h"
#include "exc_base.h"
#include "eT2_elexc_analytic.h"
#include "eT3I_recombination.h"
#include "TT2_elastic.h"
// T2I impact
#include "T2IT2_cluster.h"
const int Interaction_Builder::e_direction = load_parameter("e_direction");
@@ -34,6 +36,7 @@ Interaction_Manager Interaction_Builder::build(Population_Manager *Populations,
Interactions.add(build_tritium(Populations, rngUni));
Interactions.add(build_tritiumI(Populations, rngUni));
Interactions.add(build_tritium2I(Populations, rngUni));
Interactions.add(build_tritium3I(Populations, rngUni));
return Interactions;
}
@@ -41,6 +44,7 @@ Interaction_Base* Interaction_Builder::build_electron(Population_Manager *Popula
Interaction_Base *eInteraction = new Interaction_Base(electron, rngUni);
Population_Base *T2Population = Populations->find(tritium2);
Population_Base *T2IPopulation = Populations->find(tritium2I);
Population_Base *T3IPopulation = Populations->find(tritium3I);
DCS_Base *dcs_gen;
if (e_direction == 0) {
dcs_gen = new Elastic_DCS(rngUni);
@@ -76,6 +80,7 @@ Interaction_Base* Interaction_Builder::build_electron(Population_Manager *Popula
if (eT2recombination == 1) {
eInteraction->add(new eT2I_Recombination(T2IPopulation, rngUni));
eInteraction->add(new eT3I_Recombination(T3IPopulation, rngUni));
} else if(eT2recombination != 0) {
std::stringstream ss;
ss<<"Interaction_Builder::build_electron: eT2recombination value invalid.\n";
@@ -132,6 +137,13 @@ Interaction_Base* Interaction_Builder::build_tritiumI(Population_Manager *Popula
}
Interaction_Base* Interaction_Builder::build_tritium2I(Population_Manager *Populations, UniRNG *rngUni) {
Interaction_Base *TI2_Interaction = new Interaction_Base(tritium2I, rngUni);
return TI2_Interaction ;
Interaction_Base *T2I_Interaction = new Interaction_Base(tritium2I, rngUni);
Population_Base *T2Population = Populations->find(tritium2);
T2I_Interaction->add(new T2IT2_Cluster(T2Population, rngUni));
return T2I_Interaction ;
}
Interaction_Base* Interaction_Builder::build_tritium3I(Population_Manager *Populations, UniRNG *rngUni) {
Interaction_Base *TI3_Interaction = new Interaction_Base(tritium3I, rngUni);
return TI3_Interaction ;
}
+1
View File
@@ -33,6 +33,7 @@ private:
static Interaction_Base* build_tritium(Population_Manager *Populations, UniRNG *rngUni);
static Interaction_Base* build_tritiumI(Population_Manager *Populations, UniRNG *rngUni);
static Interaction_Base* build_tritium2I(Population_Manager *Populations, UniRNG *rngUni);
static Interaction_Base* build_tritium3I(Population_Manager *Populations, UniRNG *rngUni);
};
+29
View File
@@ -0,0 +1,29 @@
//
// janev_T2IT2_cid.h
// mc_electron
//
// Created by Christian Reiling on 12.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef janev_T2IT2_cid_h
#define janev_T2IT2_cid_h
#include <cmath>
// Janev:2003aa "From Collision processes in low-temperature hydrogen plasmas" 7.1.3.A p.73 formular (209)
class Janev_T2IT2_CID {
public:
Janev_T2IT2_CID() {}
static double get_TCS(const double &E_eV) {
double sig_small = 4.05e-20*pow(E_eV, -0.653)*exp(3.15*pow(E_eV-2,-1.65));
double numerator = 0.139e-20 * pow(E_eV,0.318)*exp(-680*pow(E_eV,-2.10));
double denominator = 1 + 2.75e-12*pow(E_eV, 2.65) + 9.04e-23*pow(E_eV, 4.65);
double sig_big = numerator/denominator;
return sig_small + sig_big;
}
};
#endif /* janev_T2IT2_cid_h */
+25
View File
@@ -0,0 +1,25 @@
//
// janev_T2T2+_cluster.h
// mc_electron
//
// Created by Christian Reiling on 12.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef janev_T2T2__cluster_h
#define janev_T2T2__cluster_h
#include <cmath>
// Janev:2003aa "From Collision processes in low-temperature hydrogen plasmas" 7.1.3.A p.73 formular (213)
class Janev_T2IT2_Cluster {
public:
Janev_T2IT2_Cluster() {}
static double get_TCS(const double &E_eV) {
double numerator = 17.76e-20;
double denominator = pow(E_eV, 0.477) * (1 + 0.0291*pow(E_eV, 3.61) + 1.53e-5*pow(E_eV, 6.55));
return numerator/denominator;
}
};
#endif /* janev_T2T2__cluster_h */
+34
View File
@@ -0,0 +1,34 @@
//
// janev_T2IT2_cx.h
// mc_electron
//
// Created by Christian Reiling on 12.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef janev_T2IT2_cx_h
#define janev_T2IT2_cx_h
#include <cmath>
// Janev:2003aa "From Collision processes in low-temperature hydrogen plasmas" 7.1.3.A p.73 formular (207)
class Janev_T2IT2_CX {
public:
Janev_T2IT2_CX() {}
static double get_TCS(const double &E_eV) {
double sig_small_1 = 6.59e-20*pow(E_eV, -0.5)/(1+2.29*pow(E-eV,1.78));
double numerator1 = 12.85e-20*exp(-1.84*pow(E_eV,-1.55));
double denominator1 = pow(E_eV, 0.0673) * (1+ 2.6e-3*pow(E_eV,0.97) + 1.63e-10*pow(E_eV,276));
double sig_small_2 = numerator1/denominator2;
double numerator2 = 11.38e-20*exp(-61.8*pow(E_eV, 0.54));
double denominator2 = 1+ 8.21e-10*pow(E_eV, 2.08) + 3.8e-26*pow(E_eV, 5.15);
double sig_big = numerator2/denominator2;
return sig_small_1 + sig_small_2 + sig_big;
}
};
#endif /* janev_T2IT2_cx_h */
+26
View File
@@ -0,0 +1,26 @@
//
// janev_eT2I_ionization.h
// mc_electron
//
// Created by Christian Reiling on 10.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef janev_eT2I_ionization_h
#define janev_eT2I_ionization_h
#include <cmath>
// Janev:2003aa "From Collision processes in low-temperature hydrogen plasmas" 7.1.3.A p.73 formular (185)
class Janev_eT2_Ionization {
public:
Janev_eT2_Ionization() {}
static double get_TCS(const double &E_eV) {
double expconst = exp(-0.105*pow(E_eV/15.2-1,1.55))
return 7.39/E_eV*log(0.18*E_eV) * (1-expconst) * 1e-20;
}
};
#endif /* janev_eT2I_ionization_h */
+2 -2
View File
@@ -12,10 +12,10 @@
#include <cmath>
// Janev:2003aa "From Collision processes in low-temperature hydrogen plasmas" 7.1.3.A p.73 formular (185)
class Janev_eT2_Recombination {
class Janev_eT2I_Recombination {
public:
Janev_eT2_Recombination() {}
Janev_eT2I_Recombination() {}
static double get_TCS(const double &E_eV) {
double const1 = pow( pow(E_eV,0.665) * ( 1 + 1.1*pow(E_eV,0.512) + 0.011*pow(E_eV,3.10) ) , - 1);
+3 -3
View File
@@ -32,7 +32,7 @@ public:
double x = E_eV/deltaE_eV;
double fac1 = 5.984/deltaE_eV/x*pow(1-1/x,alpha);
double fac2 = (A1 + A2/x + A3/x/x + A4*log(x));
return fac1 * fac2 * pow(10,-20);
return fac1 * fac2 * 1e-20;
}
double get_deltaE_eV () {return deltaE_eV;}
@@ -113,7 +113,7 @@ public:
return 0;
}
double x = E_eV/deltaE_eV;
return 5.984*A1/deltaE_eV/x*pow(1-1/x,alpha) * pow(10,-20);
return 5.984*A1/deltaE_eV/x*pow(1-1/x,alpha) * 1e-20;
}
double get_deltaE_eV () {return deltaE_eV;}
@@ -165,7 +165,7 @@ public:
return 0;
}
double x = E_eV/deltaE_eV;
return A*pow(x,-3)*pow(1-pow(x,-beta),gamma) * pow(10,-20);
return A*pow(x,-3)*pow(1-pow(x,-beta),gamma) * 1e-20;
}
double get_deltaE_eV () {return deltaE_eV;}
+2 -2
View File
@@ -35,7 +35,7 @@ public:
return 1.003;
}
std::stringstream ss;
ss<<"Janev_eT2_Recombination:get_deltaE_eV: finale_state != 1,2 \n";
ss<<"Janev_eT2I_Recombination:get_deltaE_eV: finale_state != 1,2 \n";
throw MyException(ss.str());
}
@@ -47,7 +47,7 @@ private:
return 0.628;
}
std::stringstream ss;
ss<<"Janev_eT2_Recombination:get_xi: finale_state != 1,2 \n";
ss<<"Janev_eT2I_Recombination:get_xi: finale_state != 1,2 \n";
throw MyException(ss.str());
}
@@ -0,0 +1,27 @@
//
// janev_eT3I_recombination.h
// mc_electron
//
// Created by Christian Reiling on 12.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef janev_eT3I_recombination_h
#define janev_eT3I_recombination_h
#include <cmath>
// Janev:2003aa "From Collision processes in low-temperature hydrogen plasmas" 7.1.3.A p.73 formular (230)
class Janev_eT3I_Recombination {
public:
Janev_eT3I_Recombination() {}
static double get_TCS(const double &E_eV) {
double sigLDR = 3e-20*pow(E_eV, -0.725)/(1+pow(E_eV,1.2));
double sig_small = 0.0646e-20 * pow(E_eV, 1.478);
double sig_big = 634.22e-20 * pow(E_eV, -2.605);
double sigHDR = 1/ (1/sig_small + 1/sig_big);
return sigLDR + sigHDR;
}
};
#endif /* janev_eT3I_recombination_h */
+12 -3
View File
@@ -9,7 +9,8 @@
#ifndef katrin_fields_hpp
#define katrin_fields_hpp
#include "katrin_geo.hpp"
#include "error_types.h"
#include "katrin_geo.h"
class Katrin_Fields {
@@ -19,11 +20,19 @@ public:
Katrin_Fields() {};
static vec3 getMagField_T(vec3 loc_m) {
Katrin_Geo::check_inKatrin(loc_m);
if (!in_Katrin(loc_m)) {
std::stringstream ss;
ss<<"Katrin_Fields::getMagField_T: loc_m outside of Katrin.\n";
throw MyException(ss.str());
}
return vec3(0,0,wgtsMagField_T);
}
static vec3 getElField_Vm(vec3 loc_m) {
Katrin_Geo::check_inKatrin(loc_m);
if (!in_Katrin(loc_m)) {
std::stringstream ss;
ss<<"Katrin_Fields::getElField_Vm: loc_m outside of Katrin.\n";
throw MyException(ss.str());
}
return vec3(0,0,0);
}
-66
View File
@@ -1,66 +0,0 @@
//
// katrin_geo.cpp
// mc_electron
//
// Created by Christian Reiling on 03.05.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#include <sstream>
#include "katrin_geo.hpp"
#include "error_types.h"
#include "read_system.h"
using namespace std;
const double Katrin_Geo::rearwallZ_m = load_parameter("rearwallZ_m");
const double Katrin_Geo::wgtsStartZ_m = load_parameter("wgtsStartZ_m");
const double Katrin_Geo::wgtsEndZ_m = load_parameter("wgtsEndZ_m");
const double Katrin_Geo::wgtsRadius_m = load_parameter("wgtsRadius_m");
void Katrin_Geo::check_inWGTS(vec3 loc_m) {
if (!inWGTS(loc_m)) {
stringstream ss;
ss<<"Katrin_Geo::check_inWGTS: Location not within WGTS\n";
throw MyException (ss.str());
}
}
void Katrin_Geo::check_inKatrin(vec3 loc_m) {
if (!inKatrin(loc_m)) {
stringstream ss;
ss<<"Katrin_Geo::check_inKatrin: Location not within Katrin\n";
throw MyException (ss.str());
}
}
bool Katrin_Geo::inWGTS(vec3 loc_m) {
double z_m = loc_m[2];
double r_m = sqrt(loc_m[0]*loc_m[0] + loc_m[1]*loc_m[1]);
if (z_m < wgtsStartZ_m) {
return false;
} else if (z_m > wgtsEndZ_m) {
return false;
} else if (r_m > wgtsRadius_m) {
return false;
} else {
return true;
}
}
bool Katrin_Geo::inKatrin(vec3 loc_m) {
double z_m = loc_m[2];
double r_m = sqrt(loc_m[0]*loc_m[0] + loc_m[1]*loc_m[1]);
if (z_m < rearwallZ_m) {
return false;
} else if (z_m > wgtsEndZ_m) {
return false;
} else if (r_m > wgtsRadius_m) {
return false;
} else {
return true;
}
}
+45
View File
@@ -0,0 +1,45 @@
//
// katrin_geo.h
// mc_electron
//
// Created by Christian Reiling on 11.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef katrin_geo_h
#define katrin_geo_h
#include "constants.h"
#include "kinematics.h"
inline bool in_WGTS(vec3 loc_m) {
double z_m = loc_m[2];
double r_m = sqrt(loc_m[0]*loc_m[0] + loc_m[1]*loc_m[1]);
if (z_m < z_WGTS_start_m) {
return false;
} else if (z_m > z_WGTS_end_m) {
return false;
} else if (r_m > r_WGTS_m) {
return false;
} else {
return true;
}
}
inline bool in_Katrin(vec3 loc_m) {
double z_m = loc_m[2];
double r_m = sqrt(loc_m[0]*loc_m[0] + loc_m[1]*loc_m[1]);
if (z_m < z_RW_m) {
return false;
} else if (z_m > z_DPS_end_m) {
return false;
} else if (r_m > r_WGTS_m) {
return false;
} else {
return true;
}
}
#endif /* katrin_geo_h */
-39
View File
@@ -1,39 +0,0 @@
//
// katrin_geo.hpp
// mc_electron
//
// Created by Christian Reiling on 03.05.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#ifndef katrin_geo_hpp
#define katrin_geo_hpp
#include "kinematics.h"
class Katrin_Geo {
static const double rearwallZ_m;
static const double wgtsStartZ_m;
static const double wgtsEndZ_m;
static const double wgtsRadius_m;
public:
Katrin_Geo() {};
static double get_z_RW_m() {return rearwallZ_m;};
static double get_z_WGTSstart_m() {return wgtsStartZ_m;};
static double get_z_WGTSend_m() {return wgtsEndZ_m;};
static double get_radius_m() {return wgtsRadius_m;};
static void check_inWGTS(vec3 loc_m);
static void check_inKatrin(vec3 loc_m);
static bool inWGTS(vec3 loc_m);
static bool inKatrin(vec3 loc_m);
static double get_wgtsLength_m() {return get_z_WGTSend_m() - get_z_WGTSstart_m();};
};
#endif /* katrin_geo_hpp */
+25 -25
View File
@@ -19,7 +19,7 @@
typedef blitz::TinyVector<double,3> vec3;
inline double vec3Abs(const vec3 &vec) {
inline double calc_vec3_abs(const vec3 &vec) {
return sqrt( pow(vec[0],2) + pow(vec[1],2) + pow(vec[2],2));
}
@@ -37,23 +37,23 @@ inline double calc_gamma_from_beta(const double &beta) {
return pow(1 - pow(beta,2),-0.5);
}
inline double calc_Ekin_eV_from_speed(const double &speed_ms, const double &mass_eV) {
double beta = speed_ms/c_ms;
inline double calc_E_eV_from_v_ms(const double &v_ms, const double &m_eV) {
double beta = v_ms/c_ms;
if (beta>=1) {
std::stringstream ss;
ss<<"calc_Ekin_eV_from_speed(): Input speed v="<<speed_ms<<" m/s equal or exeeds speed of light.";
ss<<"calc_E_eV_from_v_ms(): Input speed v="<<v_ms<<" m/s equal or exeeds speed of light.";
throw MyException(ss.str());
} else if (beta<0) {
std::stringstream ss;
ss<<"calc_Ekin_eV_from_speed(): Input speed v="<<speed_ms<<" m/s is expected to be absolute value therfore >0.";
ss<<"calc_E_eV_from_v_ms(): Input speed v="<<v_ms<<" m/s is expected to be absolute value therfore >0.";
throw MyException(ss.str());
}
double gamma = calc_gamma_from_beta(beta);
return (gamma-1) * mass_eV;
return (gamma-1) * m_eV;
}
inline double calc_Ekin_eV_from_speed(const vec3 &speed_ms, const double &mass_eV) {
return calc_Ekin_eV_from_speed(vec3Abs(speed_ms), mass_eV);
inline double calc_E_eV_from_v_ms(const vec3 &v_ms, const double &m_eV) {
return calc_E_eV_from_v_ms(calc_vec3_abs(v_ms), m_eV);
}
inline double calc_beta_from_gamma(const double &gamma) {
@@ -65,34 +65,34 @@ inline double calc_beta_from_gamma(const double &gamma) {
return sqrt(1 - pow(gamma,-2));
}
inline double calc_gamma_from_Ekin_eV(const double &Ekin_eV, const double &mass_eV) {
if (Ekin_eV<0) {
inline double calc_gamma_from_E_eV(const double &E_eV, const double &m_eV) {
if (E_eV<0) {
std::stringstream ss;
ss<<"calc_gamma_from_Ekin_eV(): Input Ekin_eV ="<<Ekin_eV<<" negative.";
ss<<"calc_gamma_from_E_eV(): Input E_eV ="<<E_eV<<" negative.";
throw MyException(ss.str());
}
return 1 + Ekin_eV/mass_eV;
return 1 + E_eV/m_eV;
}
inline double calc_beta_from_Ekin_eV(const double &Ekin_eV, const double &mass_eV) {
return calc_beta_from_gamma(calc_gamma_from_Ekin_eV(Ekin_eV, mass_eV));
inline double calc_beta_from_E_eV(const double &E_eV, const double &m_eV) {
return calc_beta_from_gamma(calc_gamma_from_E_eV(E_eV, m_eV));
}
inline double calc_Speed_from_Ekin_eV(const double &Ekin_eV, const double &mass_eV) {
if (Ekin_eV<0) {
inline double calc_v_ms_from_E_eV(const double &E_eV, const double &m_eV) {
if (E_eV<0) {
std::stringstream ss;
ss<<"calc_Speed_from_Ekin_eV(): Input Ekin_eV ="<<Ekin_eV<<" negative.";
ss<<"calc_v_ms_from_E_eV(): Input E_eV ="<<E_eV<<" negative.";
throw MyException(ss.str());
}
double gamma = calc_gamma_from_Ekin_eV(Ekin_eV, mass_eV);
double gamma = calc_gamma_from_E_eV(E_eV, m_eV);
double beta = calc_beta_from_gamma(gamma);
return beta*c_ms;
}
inline vec3 calc_newDirection(const vec3 &direction_old, const double &theta_change, const double &phi_change) {
inline vec3 calc_n_new(const vec3 &direction_old, const double &theta_change, const double &phi_change) {
// Alireza Haghighat: Appendix 3 (p.249)
vec3 nOld = direction_old/vec3Abs(direction_old);
vec3 nOld = direction_old/calc_vec3_abs(direction_old);
double u = nOld[0];
double v = nOld[1];
double w = nOld[2];
@@ -110,19 +110,19 @@ inline vec3 calc_newDirection(const vec3 &direction_old, const double &theta_cha
return vec3(uNew, vNew, wNew);
}
inline double get_z_m(const vec3 &loc_m) {
inline double calc_z_m(const vec3 &loc_m) {
return loc_m[2];
}
inline double get_r_m(const vec3 &loc_m) {
inline double calc_r_m(const vec3 &loc_m) {
return sqrt(loc_m[0]*loc_m[0] + loc_m[1]*loc_m[1]);
}
inline double get_phi(const vec3 &loc_m) {
inline double calc_phi(const vec3 &loc_m) {
if (loc_m[1] >= 0) {
return acos(loc_m[0]/get_r_m(loc_m));
return acos(loc_m[0]/calc_r_m(loc_m));
} else {
return 2*pi - acos(loc_m[0]/get_r_m(loc_m));
return 2*pi - acos(loc_m[0]/calc_r_m(loc_m));
}
}
+10 -10
View File
@@ -36,16 +36,16 @@ inline Elastic_Kinematic_Base::Elastic_Kinematic_Base(const double &m1_eV, const
}
inline void Elastic_Kinematic_Base::doKinematics (Particle* P1, const vec3 &v2_lab_ms, const double &theta_lab, const double &phi_lab) {
vec3 v1_ms = P1->get_Speed_ms() - v2_lab_ms;
vec3 v1_ms = P1->get_v_ms() - v2_lab_ms;
double E0_eV = calc_Ekin_eV_from_speed(v1_ms, m1_eV);
double E0_eV = calc_E_eV_from_v_ms(v1_ms, m1_eV);
double inner_sqrt = pow( const2 - pow(sin(theta_lab),2) , 0.5 );
double E1_eV = E0_eV * const1 * pow(cos(theta_lab) + sign*inner_sqrt , 2);
double v1Abs_new_ms = calc_Speed_from_Ekin_eV(E1_eV, m1_eV);
vec3 n0 = calc_newDirection(v1_ms, theta_lab, phi_lab);
double v1Abs_new_ms = calc_v_ms_from_E_eV(E1_eV, m1_eV);
vec3 n0 = calc_n_new(v1_ms, theta_lab, phi_lab);
vec3 v1_new_ms = n0 * v1Abs_new_ms + v2_lab_ms;
P1->set_Speed_ms(v1_new_ms);
P1->set_v_ms(v1_new_ms);
}
@@ -96,19 +96,19 @@ inline Inelastic_Kinematic_Base::Inelastic_Kinematic_Base(const double &Q_eV, co
inline void Inelastic_Kinematic_Base::doKinematics (Particle* P1, const vec3 &v2_lab_ms, const double &theta_lab, const double &phi_lab) {
vec3 v1_ms = P1->get_Speed_ms() - v2_lab_ms;
vec3 v1_ms = P1->get_v_ms() - v2_lab_ms;
double E1_eV = calc_Ekin_eV_from_speed(v1_ms, m1_eV);
double E1_eV = calc_E_eV_from_v_ms(v1_ms, m1_eV);
double ET_eV = this->ET_eV(E1_eV);
double B = this->B(E1_eV);
double D = this->D(E1_eV);
double sign = B>D ? -1 : 1;
double inner_sqrt = pow( (D/B - pow(sin(theta_lab),2) ) , 0.5 );
double E1_new_eV = ET_eV * B * pow( cos(theta_lab) +sign * inner_sqrt, 2);
double v1Abs_new_ms = calc_Speed_from_Ekin_eV(E1_new_eV, m1_eV);
vec3 n0 = calc_newDirection(v1_ms, theta_lab, phi_lab);
double v1Abs_new_ms = calc_v_ms_from_E_eV(E1_new_eV, m1_eV);
vec3 n0 = calc_n_new(v1_ms, theta_lab, phi_lab);
vec3 v1_new_ms = n0 * v1Abs_new_ms + v2_lab_ms;
P1->set_Speed_ms(v1_new_ms);
P1->set_v_ms(v1_new_ms);
}
+20 -16
View File
@@ -10,7 +10,7 @@
#define energetic_base_h
#include "katrin_geo.hpp"
#include "katrin_geo.h"
#include <fstream>
@@ -42,9 +42,9 @@ public:
void decrease_denisty (const vec3 &loc_m, const double &energy_eV);
public:
vec3 get_average_speed_ms (const vec3 &loc_m);
vec3 roll_speed_ms (const vec3 &loc_m);
vec3 roll_v_ms (const vec3 &loc_m);
private:
vec3 get_average_v_ms (const vec3 &loc_m);
vec3 roll_thermSpeed_ms(const vec3 &loc_m);
public:
@@ -55,7 +55,7 @@ public:
private:
Lin_Scale get_z_scale();
Lin_Scale get_r_scale();
Lin_Scale get_phi_scale();
Lin_Scale calc_phi_scale();
Log_Scale get_E_scale();
};
@@ -76,7 +76,11 @@ void Kinetic_Population::init_containers(int num_z_bins, int num_r_bins, int num
}
*/
inline double Kinetic_Population::get_density_m3(const vec3 &loc_m) {
//Katrin_Geo::check_inKatrin(loc_m);
if (!in_Katrin(loc_m)) {
std::stringstream ss;
ss<<"Kinetic_Population::get_density_m3: loc_m outside of Katrin.\n";
throw MyException(ss.str());
}
double physical_time_s = timer->get_physTime_s();
int num_E_bins = cumulated_times_s.get_num_E_bins();
double *cumulated_time_s = cumulated_times_s.get_E_bins(loc_m);
@@ -94,9 +98,9 @@ inline double Kinetic_Population::get_density_m3(const vec3 &loc_m) {
}
inline void Kinetic_Population::increase_density(const Particle &upPart, const vec3 &oldLoc_m) {
double cell_time_s = bin_sizes.get_cell_length_m()/upPart.get_SpeedAbs_ms();
double energy_eV = upPart.get_EKin_eV();
cumulated_times_s.increase_value(cell_time_s, upPart.get_Location_m(), oldLoc_m, energy_eV);
double cell_time_s = bin_sizes.get_cell_length_m()/upPart.get_vAbs_ms();
double energy_eV = upPart.get_E_eV();
cumulated_times_s.increase_value(cell_time_s, upPart.get_x_m(), oldLoc_m, energy_eV);
}
inline void Kinetic_Population::decrease_denisty (const vec3 &loc_m, const double &energy_eV) {
@@ -104,11 +108,11 @@ inline void Kinetic_Population::decrease_denisty (const vec3 &loc_m, const doubl
}
inline vec3 Kinetic_Population::get_average_speed_ms(const vec3 &loc_m) {
inline vec3 Kinetic_Population::get_average_v_ms(const vec3 &loc_m) {
return vec3(0,0,0);
}
inline vec3 Kinetic_Population::roll_speed_ms(const vec3 &loc_m) {
inline vec3 Kinetic_Population::roll_v_ms(const vec3 &loc_m) {
double total = get_density_m3(loc_m);
double target = rngUni->random() * total;
@@ -128,7 +132,7 @@ inline vec3 Kinetic_Population::roll_speed_ms(const vec3 &loc_m) {
}
}
std::stringstream ss;
ss<<"Kinetic_Population::roll_speed_ms: Overflow.\n";
ss<<"Kinetic_Population::roll_v_ms: Overflow.\n";
throw MyException (ss.str());
}
@@ -136,7 +140,7 @@ inline vec3 Kinetic_Population::roll_speed_ms(const vec3 &loc_m) {
inline meta_vec Kinetic_Population::get_bins_meta_info() {
Lin_Scale z_scale = get_z_scale();
Lin_Scale r_scale = get_r_scale();
Lin_Scale phi_scale = get_phi_scale();
Lin_Scale phi_scale = calc_phi_scale();
Log_Scale E_scale = get_E_scale();
meta_vec res;
@@ -173,7 +177,7 @@ inline meta_vec Kinetic_Population::get_bins_meta_info() {
inline bin_content_vec Kinetic_Population::get_bins_content() {
Lin_Scale z_scale = get_z_scale();
Lin_Scale r_scale = get_r_scale();
Lin_Scale phi_scale = get_phi_scale();
Lin_Scale phi_scale = calc_phi_scale();
Log_Scale E_scale = get_E_scale();
bin_content_vec res;
@@ -201,7 +205,7 @@ inline bin_count4 Kinetic_Population::get_bin_count4() {
bin_count4 res;
res[0] = get_z_scale().get_number_bins();
res[1] = get_r_scale().get_number_bins();
res[2] = get_phi_scale().get_number_bins();
res[2] = calc_phi_scale().get_number_bins();
res[3] = get_E_scale().get_number_bins();
return res;
}
@@ -241,8 +245,8 @@ inline Lin_Scale Kinetic_Population::get_r_scale() {
}
inline Lin_Scale Kinetic_Population::get_phi_scale() {
return cumulated_times_s.get_phi_scale();
inline Lin_Scale Kinetic_Population::calc_phi_scale() {
return cumulated_times_s.calc_phi_scale();
}
+1
View File
@@ -23,6 +23,7 @@ Particle_Logger_Manager Particle_Logger_Builder::build(H5_File *h5f) {
ParticleLogger.add(new Off_Particle_Logger(tritium));
ParticleLogger.add(new Off_Particle_Logger(tritiumI));
ParticleLogger.add(new Off_Particle_Logger(tritium2I));
ParticleLogger.add(new Off_Particle_Logger(tritium3I));
return ParticleLogger;
}
+1 -1
View File
@@ -17,7 +17,7 @@ all: $(TARGETS)
mcelectron: main.o simulation.o\
tcs_container.o dcs_theta_container.o dcs_ionization_container.o population3_container.o population4_container.o size_container.o \
thermalPop_container.o energeticPop_container.o \
particle.o injector.o timer.o katrin_geo.o katrin_fields.o \
particle.o injector.o timer.o katrin_fields.o \
h5_file.o logger_builder.o population_load_saver.o \
h5tb_particle_interface.o h5tb_population_interface.o h5tb_population_meta_interface.o \
population_builder.o \
+1 -1
View File
@@ -10,7 +10,7 @@
#define mover_base_h
#include "process_base.h"
#include "katrin_geo.hpp"
#include "katrin_geo.h"
#include "katrin_fields.hpp"
#include "particle.hpp"
+7
View File
@@ -25,6 +25,7 @@ Mover_Manager Mover_Builder::build(Particle_Logger_Manager *Loggers, Population_
Movers.add(build_tritium(Loggers, Populations));
Movers.add(build_tritiumI(Loggers, Populations));
Movers.add(build_tritium2I(Loggers, Populations));
Movers.add(build_tritium3I(Loggers, Populations));
return Movers;
}
@@ -58,3 +59,9 @@ Mover_Base *Mover_Builder::build_tritium2I(Particle_Logger_Manager *Loggers, Pop
Population_Base *Popultation = Populations->find(tritium2I);
return new Positive_Mover_Drift(tritium2I, Logger, Popultation);
}
Mover_Base *Mover_Builder::build_tritium3I(Particle_Logger_Manager *Loggers, Population_Manager *Populations) {
Particle_Logger_Base *Logger = Loggers->find(tritium3I);
Population_Base *Popultation = Populations->find(tritium3I);
return new Positive_Mover_Drift(tritium3I, Logger, Popultation);
}
+1
View File
@@ -29,6 +29,7 @@ private:
static Mover_Base *build_tritium(Particle_Logger_Manager *Loggers, Population_Manager *Populations);
static Mover_Base *build_tritiumI(Particle_Logger_Manager *Loggers, Population_Manager *Populations);
static Mover_Base *build_tritium2I(Particle_Logger_Manager *Loggers, Population_Manager *Populations);
static Mover_Base *build_tritium3I(Particle_Logger_Manager *Loggers, Population_Manager *Populations);
};
+1 -1
View File
@@ -46,7 +46,7 @@ inline void MuliZ_Particle_Logger::create(hid_t *h5g_z) {
inline void MuliZ_Particle_Logger::log(const Particle &logPart, const vec3 &oldLoc_m) {
double zold = oldLoc_m[2];
double znew = logPart.get_Location_m()[2];
double znew = logPart.get_x_m()[2];
double zmin = std::min(zold,znew);
double zmax = std::max(zold,znew);
for (int i=0;i<numberZBins;i++) {
+13 -13
View File
@@ -21,31 +21,31 @@ private:
};
inline void Neutral_Mover::move(Particle *movePart, const double &macroSigma_m2) {
vec3 oldLoc_m = movePart->get_Location_m();
vec3 v_ms = movePart->get_Speed_ms();
vec3 move_direction = v_ms/vec3Abs(v_ms);
vec3 oldLoc_m = movePart->get_x_m();
vec3 v_ms = movePart->get_v_ms();
vec3 move_direction = v_ms/calc_vec3_abs(v_ms);
double distance = (macroSigma_m2 <= 0) ? 1e3 : 1/macroSigma_m2; //sloppy trick to "leave" wgts
vec3 newLoc_m = oldLoc_m + distance * move_direction;
wall_correction(&newLoc_m, oldLoc_m);
movePart->set_Location_m(newLoc_m);
movePart->set_x_m(newLoc_m);
Logger->log(*movePart, oldLoc_m);
Population->increase_density(*movePart, oldLoc_m);
}
inline void Neutral_Mover::wall_correction(vec3 *newLoc_m, const vec3 &oldLoc_m) {
if (!Katrin_Geo::inKatrin(*newLoc_m)) {
if (*newLoc_m[2] < Katrin_Geo::get_z_RW_m()) {
newLoc_m[2] = Katrin_Geo::get_z_RW_m();
if (!in_Katrin(*newLoc_m)) {
if (*newLoc_m[2] < z_RW_m) {
newLoc_m[2] = z_RW_m;
}
if (*newLoc_m[2] > Katrin_Geo::get_z_WGTSend_m()) {
newLoc_m[2] = Katrin_Geo::get_z_WGTSend_m();
if (*newLoc_m[2] > z_WGTS_end_m) {
newLoc_m[2] = z_WGTS_end_m;
}
if (get_r_m(*newLoc_m) > Katrin_Geo::get_radius_m()) {
double phi = get_phi(*newLoc_m);
newLoc_m[0] = Katrin_Geo::get_radius_m() * cos(phi);
newLoc_m[1] = Katrin_Geo::get_radius_m() * sin(phi);
if (calc_r_m(*newLoc_m) > r_WGTS_m) {
double phi = calc_phi(*newLoc_m);
newLoc_m[0] = r_WGTS_m * cos(phi);
newLoc_m[1] = r_WGTS_m * sin(phi);
}
}
}
+2 -2
View File
@@ -10,7 +10,7 @@
#define neutral_terminator_h
#include "terminator_base.h"
#include "katrin_geo.hpp"
#include "katrin_geo.h"
class Neutral_Terminator : public Terminator_Base, private Energy_Terminator_Base, private MaxInteractions_Terminator_Base {
@@ -38,7 +38,7 @@ inline bool Neutral_Terminator::checkTermination (const Particle &movePart) {
inline bool Neutral_Terminator::check_Wall(const Particle &movePart) {
return Katrin_Geo::inKatrin(movePart.get_Location_m());
return in_Katrin(movePart.get_x_m());
}
#endif /* neutral_terminator_h */
+24 -12
View File
@@ -31,6 +31,9 @@ std::string get_species_string(const species &spec) {
case tritium2:
res = "T2";
break;
case tritium3I:
res = "T3+";
break;
default:
stringstream ss;
ss<<"get_species_string: Species not defined\n";
@@ -46,6 +49,7 @@ species get_species_from_string(const std::string &species_string) {
all.push_back(tritiumI);
all.push_back(tritium2I);
all.push_back(tritium2);
all.push_back(tritium3I);
for (std::vector<species>::iterator Itr = all.begin(); Itr!= all.end(); Itr++) {
if (get_species_string(*Itr) == species_string) {
return *Itr;
@@ -69,10 +73,13 @@ double get_species_mass(const species &spec) {
res = mT_eV;
break;
case tritium2I:
res = mT2_eV;
res = 2*mT_eV;
break;
case tritium2:
res = mT2_eV;
res = 2*mT_eV;
break;
case tritium3I:
res = 3*mT_eV;
break;
default:
stringstream ss;
@@ -91,8 +98,8 @@ ostream& operator<<(ostream& os, const species& spec) {
ostream& operator<<(ostream& os, const Particle& partOut) {
os
<< partOut.Id << ";"
<<partOut.parentId << ";"
<<partOut.s << ";"
<<partOut.PId << ";"
<<partOut.spec << ";"
<<partOut.m_eV << ";"
<< partOut.Z << ";"
<< partOut.x_m[0] << ";"
@@ -104,13 +111,18 @@ ostream& operator<<(ostream& os, const Particle& partOut) {
return os;
}
Particle::Particle(double mass_eV, double charge_e,vec3 loc_m, vec3 speed_ms, double idnum, double parentIdnum, species spec) {
m_eV = mass_eV;
Z = charge_e;
x_m = loc_m;
v_ms = speed_ms;
Id = idnum;
parentId = parentIdnum;
s = spec;
Particle::Particle(double m_eV, double Z, vec3 x_m, vec3 v_ms, double Id, double PId, species spec) {
this->m_eV = m_eV;
this->Z = Z;
this->x_m = x_m;
this->v_ms = v_ms;
this->Id = Id;
this->PId = PId;
this->spec = spec;
calc_E_eV();
}
void Particle::calc_E_eV() {
E_eV = calc_E_eV_from_v_ms(v_ms, m_eV);
}
+38 -28
View File
@@ -19,7 +19,7 @@
typedef blitz::TinyVector<double,3> vec3;
enum species{electron, tritium, tritiumI, tritium2I, tritium2};
enum species{electron, tritium, tritiumI, tritium2I, tritium2, tritium3I};
std::string get_species_string(const species &spec);
species get_species_from_string(const std::string &species_string);
@@ -29,60 +29,70 @@ std::ostream& operator<<(std::ostream& os, const species& spec);
class Particle {
public:
Particle() {};
Particle(double mass_eV, double charge_e,vec3 loc_m, vec3 speed_ms, double idnum, double parentIdnum, species spec);
protected:
double m_eV;
double Z;
vec3 x_m;
vec3 v_ms;
species s;
species spec;
unsigned int Id;
unsigned int parentId;
unsigned int PId;
double E_eV;
public:
Particle() {};
Particle(double m_eV, double charge_e,vec3 loc_m, vec3 v_ms, double Id, double PId, species spec);
public:
double get_Mass_eV() const {return m_eV;}
double get_Charge_nat() const {return Z;}
vec3 get_Location_m() const {return x_m;}
vec3 get_Speed_ms() const {return v_ms;}
species get_species() const {return s;}
double get_m_eV() const {return m_eV;}
double get_Z() const {return Z;}
vec3 get_x_m() const {return x_m;}
vec3 get_v_ms() const {return v_ms;}
species get_species() const {return spec;}
double get_Id() const {return Id;}
double get_ParentId() const {return parentId;}
double get_PId() const {return PId;}
double get_Radius_m() const {return sqrt( pow(x_m[0],2) + pow(x_m[1],2) );}
double get_SpeedAbs_ms() const {return vec3Abs(v_ms); } ;
double get_EKin_eV() const {return calc_Ekin_eV_from_speed(v_ms, m_eV);}
double get_r_m() const {return sqrt( pow(x_m[0],2) + pow(x_m[1],2) );}
double get_vAbs_ms() const {return calc_vec3_abs(v_ms); } ;
double get_E_eV() const {return E_eV;}
void set_Location_m(blitz::TinyVector<double, 3> xnew_m) {x_m = xnew_m;}
void set_Speed_ms(blitz::TinyVector<double, 3> vnew_ms) {v_ms = vnew_ms;}
void set_x_m(blitz::TinyVector<double, 3> xnew_m) {x_m = xnew_m;}
void set_v_ms(blitz::TinyVector<double, 3> vnew_ms) {
v_ms = vnew_ms;
calc_E_eV();
}
void set_Id(double newId) {Id = newId;}
friend std::ostream& operator<<(std::ostream& os, const Particle& partOut);
private:
void calc_E_eV();
};
class Particle_Builder {
public:
Particle_Builder() {};
static Particle createElectron(vec3 loc_m, vec3 speed_ms, double idnum, double parentIdnum) {
return Particle(me_eV, -1 , loc_m, speed_ms, idnum, parentIdnum, electron);
static Particle create_e(vec3 loc_m, vec3 v_ms, int Id, int PId) {
return Particle(me_eV, -1 , loc_m, v_ms, Id, PId, electron);
}
static Particle createTritium(vec3 loc_m, vec3 speed_ms, double idnum, double parentIdnum) {
return Particle(mT_eV, 0 , loc_m, speed_ms, idnum, parentIdnum, tritium);
static Particle create_T(vec3 loc_m, vec3 v_ms, int Id, int PId) {
return Particle(mT_eV, 0 , loc_m, v_ms, Id, PId, tritium);
}
static Particle createTritiumI(vec3 loc_m, vec3 speed_ms, double idnum, double parentIdnum) {
return Particle(mT_eV, 1 , loc_m, speed_ms, idnum, parentIdnum, tritiumI);
static Particle create_TI(vec3 loc_m, vec3 v_ms, int Id, int PId) {
return Particle(mT_eV, 1 , loc_m, v_ms, Id, PId, tritiumI);
}
static Particle createTritium2I(vec3 loc_m, vec3 speed_ms, double idnum, double parentIdnum) {
return Particle(2*mT_eV, 1 , loc_m, speed_ms, idnum, parentIdnum, tritium2I);
static Particle create_T2I(vec3 loc_m, vec3 v_ms, int Id, int PId) {
return Particle(2*mT_eV, 1 , loc_m, v_ms, Id, PId, tritium2I);
}
static Particle create_T3I(vec3 loc_m, vec3 v_ms, int Id, int PId) {
return Particle(3*mT_eV, 1 , loc_m, v_ms, Id, PId, tritium3I);
}
};
+13 -13
View File
@@ -13,8 +13,8 @@ using namespace std;
Pop3_Container::Pop3_Container(int num_z_bins, int num_r_bins, int num_phi_bins) {
z_scale = Lin_Scale(Katrin_Geo::get_z_RW_m(), Katrin_Geo::get_z_WGTSend_m(), num_z_bins);
r_scale = Lin_Scale(0,Katrin_Geo::get_radius_m(), num_r_bins);
z_scale = Lin_Scale(z_RW_m, z_WGTS_end_m, num_z_bins);
r_scale = Lin_Scale(0,r_WGTS_m, num_r_bins);
phi_scale = Lin_Scale(0, 2*pi, num_phi_bins);
data = new double **[num_z_bins];
@@ -72,25 +72,25 @@ Pop3_Container& Pop3_Container::operator=(const Pop3_Container& other) {
void Pop3_Container::increase_value(const double &value, const vec3 &loc_m) {
int zbin = z_scale.calc_index(get_z_m(loc_m));
int rbin = r_scale.calc_index(get_r_m(loc_m));
int phibin = phi_scale.calc_index(get_phi(loc_m));
int zbin = z_scale.calc_index(calc_z_m(loc_m));
int rbin = r_scale.calc_index(calc_r_m(loc_m));
int phibin = phi_scale.calc_index(calc_phi(loc_m));
data[zbin][rbin][phibin] += value;
}
void Pop3_Container::increase_value(const double &value, const vec3 &loc1_m, const vec3 &loc2_m) {
double z_min_m = get_z_m(loc1_m);
double z_max_m = get_z_m(loc2_m);
double z_min_m = calc_z_m(loc1_m);
double z_max_m = calc_z_m(loc2_m);
if (z_max_m < z_min_m) {
swap(z_min_m, z_max_m);
}
int min_z_index = z_scale.calc_index(z_min_m);
int max_z_index = z_scale.calc_index(z_max_m);
// No r/phi movement, else need to calculate more exactly
double r = get_r_m(loc1_m);
int rbin = r_scale.calc_index(get_r_m(r));
double phi = get_phi(loc1_m);
double r = calc_r_m(loc1_m);
int rbin = r_scale.calc_index(calc_r_m(r));
double phi = calc_phi(loc1_m);
int phibin = phi_scale.calc_index(phi);
for (int i = min_z_index; i<=max_z_index; i++) {
@@ -99,9 +99,9 @@ void Pop3_Container::increase_value(const double &value, const vec3 &loc1_m, con
}
double Pop3_Container::get_value (vec3 loc_m) {
int zbin = z_scale.calc_index(get_z_m(loc_m));
int rbin = r_scale.calc_index(get_r_m(loc_m));
int phibin = phi_scale.calc_index(get_phi(loc_m));
int zbin = z_scale.calc_index(calc_z_m(loc_m));
int rbin = r_scale.calc_index(calc_r_m(loc_m));
int phibin = phi_scale.calc_index(calc_phi(loc_m));
return data[zbin][rbin][phibin];
}
+3 -2
View File
@@ -10,7 +10,8 @@
#define population3_container_hpp
#include "lin_scale.h"
#include "katrin_geo.hpp"
#include "kinematics.h"
#include "constants.h"
class Pop3_Container {
@@ -36,7 +37,7 @@ public:
Lin_Scale get_z_scale(){return z_scale;}
Lin_Scale get_r_scale(){return r_scale;}
Lin_Scale get_phi_scale(){return phi_scale;}
Lin_Scale calc_phi_scale(){return phi_scale;}
};
+13 -13
View File
@@ -13,8 +13,8 @@ using namespace std;
Pop4_Container::Pop4_Container(int num_z_bins, int num_r_bins, int num_phi_bins, int num_E_bins) {
z_scale = Lin_Scale(Katrin_Geo::get_z_RW_m(), Katrin_Geo::get_z_WGTSend_m(), num_z_bins);
r_scale = Lin_Scale(0,Katrin_Geo::get_radius_m(), num_r_bins);
z_scale = Lin_Scale(z_RW_m, z_WGTS_end_m, num_z_bins);
r_scale = Lin_Scale(0,r_WGTS_m, num_r_bins);
phi_scale = Lin_Scale(0, 2*pi, num_phi_bins);
E_scale = Log_Scale(scale_start, scale_end, num_E_bins);
@@ -85,26 +85,26 @@ Pop4_Container& Pop4_Container::operator=(const Pop4_Container& other) {
}
void Pop4_Container::increase_value(const double &value, const vec3 &loc_m, const double &E_eV) {
int zbin = z_scale.calc_index(get_z_m(loc_m));
int rbin = r_scale.calc_index(get_r_m(loc_m));
int phibin = phi_scale.calc_index(get_phi(loc_m));
int zbin = z_scale.calc_index(calc_z_m(loc_m));
int rbin = r_scale.calc_index(calc_r_m(loc_m));
int phibin = phi_scale.calc_index(calc_phi(loc_m));
int E_bin = E_scale.calc_index(E_eV);
data[zbin][rbin][phibin][E_bin] += value;
}
void Pop4_Container::increase_value(const double &value, const vec3 &loc1_m, const vec3 &loc2_m, const double &E_eV) {
double z_min_m = get_z_m(loc1_m);
double z_max_m = get_z_m(loc2_m);
double z_min_m = calc_z_m(loc1_m);
double z_max_m = calc_z_m(loc2_m);
if (z_max_m < z_min_m) {
swap(z_min_m, z_max_m);
}
int min_z_index = z_scale.calc_index(z_min_m);
int max_z_index = z_scale.calc_index(z_max_m);
// No r/phi movement, else need to calculate more exactly
double r = get_r_m(loc1_m);
int rbin = r_scale.calc_index(get_r_m(r));
double phi = get_phi(loc1_m);
double r = calc_r_m(loc1_m);
int rbin = r_scale.calc_index(calc_r_m(r));
double phi = calc_phi(loc1_m);
int phibin = phi_scale.calc_index(phi);
int E_bin = E_scale.calc_index(E_eV);
@@ -114,9 +114,9 @@ void Pop4_Container::increase_value(const double &value, const vec3 &loc1_m, con
}
double Pop4_Container::get_value(const vec3 &loc_m, const double &E_eV) {
int zbin = z_scale.calc_index(get_z_m(loc_m));
int rbin = r_scale.calc_index(get_r_m(loc_m));
int phibin = phi_scale.calc_index(get_phi(loc_m));
int zbin = z_scale.calc_index(calc_z_m(loc_m));
int rbin = r_scale.calc_index(calc_r_m(loc_m));
int phibin = phi_scale.calc_index(calc_phi(loc_m));
int E_bin = E_scale.calc_index(E_eV);
return data[zbin][rbin][phibin][E_bin];
}
+2 -2
View File
@@ -10,7 +10,7 @@
#define population4_container_hpp
#include "log_scale.h"
#include "katrin_geo.hpp"
#include "katrin_geo.h"
#include "timer.hpp"
@@ -43,7 +43,7 @@ public:
Lin_Scale get_z_scale(){return z_scale;}
Lin_Scale get_r_scale(){return r_scale;}
Lin_Scale get_phi_scale(){return phi_scale;}
Lin_Scale calc_phi_scale(){return phi_scale;}
Log_Scale get_E_scale(){return E_scale;}
};
+2 -2
View File
@@ -58,8 +58,8 @@ public:
virtual void increase_density (const Particle &upPart, const vec3 &oldLoc_m) = 0;
virtual void decrease_denisty (const vec3 &oldLoc_m, const double &energy_eV) = 0;
virtual vec3 get_average_speed_ms (const vec3 &loc_m) = 0;
virtual vec3 roll_speed_ms (const vec3 &loc_m) = 0;
virtual vec3 get_average_v_ms (const vec3 &loc_m) = 0;
virtual vec3 roll_v_ms (const vec3 &loc_m) = 0;
virtual meta_vec get_bins_meta_info() = 0;
virtual bin_content_vec get_bins_content() = 0;
+1
View File
@@ -25,6 +25,7 @@ Population_Manager Population_Builder::build(Timer *timer,UniRNG *rngUni, Normal
Populations.add(new Thermal_Population(tritium, timer, rngUni, rngNormal, num_z_bins, num_r_bins, num_phi_bins));
Populations.add(new Thermal_Population(tritiumI, timer, rngUni, rngNormal, num_z_bins, num_r_bins, num_phi_bins));
Populations.add(new Thermal_Population(tritium2I, timer, rngUni, rngNormal, num_z_bins, num_r_bins, num_phi_bins));
Populations.add(new Thermal_Population(tritium3I, timer, rngUni, rngNormal, num_z_bins, num_r_bins, num_phi_bins));
Populations.add(new T2_Population(rngUni, rngNormal));
return Populations;
+8 -8
View File
@@ -38,10 +38,10 @@ void Population_Load_Saver::write_overhead(ofstream *save_stream) {
*save_stream<<timer->get_physTime_s()<<"\t # Offset Time in seconds \n";
*save_stream<<Katrin_Geo::get_z_RW_m()<<"\t";
*save_stream<<Katrin_Geo::get_z_WGTSstart_m()<<"\t";
*save_stream<<Katrin_Geo::get_z_WGTSend_m()<<"\t";
*save_stream<<Katrin_Geo::get_radius_m()<<"\t";
*save_stream<<z_RW_m<<"\t";
*save_stream<<z_WGTS_start_m<<"\t";
*save_stream<<z_WGTS_end_m<<"\t";
*save_stream<<r_WGTS_m<<"\t";
*save_stream<<" # 1. rear wall pos 2. WGTS start pos 3. WGTS end pos 4. WGTS radius all pos in m \n";
*save_stream<<load_parameter("wgtsT2MaxDensity_m3")<<"\t";
@@ -133,25 +133,25 @@ double Population_Load_Saver::get_offset_time_line(std::ifstream *load_stream) {
void Population_Load_Saver::check_katrin_geo_line(std::ifstream *load_stream) {
double z_RW_m, z_WGTSstart_m, z_WGTSend_m, radius_m;
*load_stream>>z_RW_m;
if ( z_RW_m != Katrin_Geo::get_z_RW_m()) {
if ( z_RW_m != z_RW_m) {
std::stringstream ss;
ss<<"Population_Load_Saver::check_katrin_geo_line: z_RW missmatch.\n";
throw MyException(ss.str());
}
*load_stream>>z_WGTSstart_m;
if ( z_WGTSstart_m != Katrin_Geo::get_z_WGTSstart_m()) {
if ( z_WGTSstart_m != z_WGTS_start_m) {
std::stringstream ss;
ss<<"Population_Load_Saver::check_katrin_geo_line: z_WGTSstart missmatch.\n";
throw MyException(ss.str());
}
*load_stream>>z_WGTSend_m;
if ( z_WGTSend_m != Katrin_Geo::get_z_WGTSend_m()) {
if ( z_WGTSend_m != z_WGTS_end_m) {
std::stringstream ss;
ss<<"Population_Load_Saver::check_katrin_geo_line: z_WGTSend missmatch.\n";
throw MyException(ss.str());
}
*load_stream>>radius_m;
if ( radius_m != Katrin_Geo::get_radius_m()) {
if ( radius_m != r_WGTS_m) {
std::stringstream ss;
ss<<"Population_Load_Saver::check_katrin_geo_line: radius missmatch.\n";
throw MyException(ss.str());
@@ -26,6 +26,7 @@ public:
all_species.push_back(tritium);
all_species.push_back(tritiumI);
all_species.push_back(tritium2I);
all_species.push_back(tritium3I);
}
void save();
+5 -5
View File
@@ -10,7 +10,7 @@
#define positive_terminator_h
#include "terminator_base.h"
#include "katrin_geo.hpp"
#include "katrin_geo.h"
class Positive_Terminator : public Terminator_Base, private Energy_Terminator_Base, private MaxInteractions_Terminator_Base {
@@ -38,16 +38,16 @@ inline bool Positive_Terminator::checkTermination (const Particle &movePart) {
inline bool Positive_Terminator::check_Wall(const Particle &movePart) {
vec3 loc_m = movePart.get_Location_m();
vec3 loc_m = movePart.get_x_m();
double z_m = loc_m[2];
double r_m = sqrt( pow(loc_m[0],2) + pow(loc_m[1],2) );
if (z_m <= Katrin_Geo::get_z_RW_m()) {
if (z_m <= z_RW_m) {
return true;
}
if (z_m >= Katrin_Geo::get_z_WGTSend_m()) {
if (z_m >= z_WGTS_end_m) {
return true;
}
if (r_m >= Katrin_Geo::get_radius_m()) {
if (r_m >= r_WGTS_m) {
return true;
}
return false;
+4 -4
View File
@@ -22,11 +22,11 @@ protected:
void Positive_Mover_Drift::doWallInteraction(Particle *movePart, vec3 *oldLoc_m, double *znew_m) {
if (*znew_m >= Katrin_Geo::get_z_WGTSend_m()) {
*znew_m = Katrin_Geo::get_z_WGTSend_m();
if (*znew_m >= z_WGTS_end_m) {
*znew_m = z_WGTS_end_m;
}
if (*znew_m <= Katrin_Geo::get_z_RW_m()) {
*znew_m = Katrin_Geo::get_z_RW_m();
if (*znew_m <= z_RW_m) {
*znew_m = z_RW_m;
}
}
+3 -3
View File
@@ -38,9 +38,9 @@ inline vec3 roll_uniform_direction(ranlib::Uniform<double> *rngUni) {
return dir;
}
inline double roll_MBEnergy(const double &Temp_K, const double &mass_eV,ranlib::NormalUnit<double> *rngNormal) {
inline double roll_MBEnergy(const double &Temp_K, const double &m_eV,ranlib::NormalUnit<double> *rngNormal) {
double C = kb_eVK*Temp_K/mass_eV;
double C = kb_eVK*Temp_K/m_eV;
double beta = 0;
double sum = 0;
for (int i=0;i<3;i++) {
@@ -48,7 +48,7 @@ inline double roll_MBEnergy(const double &Temp_K, const double &mass_eV,ranlib::
}
beta = sqrt(C*(sum));
return (calc_gamma_from_beta(beta)-1)*mass_eV;
return (calc_gamma_from_beta(beta)-1)*m_eV;
}
inline double roll_Rejectionmethod(double (*pdf)(double), double xmin, double xmax, double pmax, ranlib::Uniform<double> *rngUni) {
+5 -7
View File
@@ -68,18 +68,16 @@ void Simulation::doit() {
terminatorPtr = terminators.find(curPart.get_species());
while (!terminatorPtr->checkTermination(curPart)) {
oldLoc_m = curPart.get_Location_m();
oldLoc_m = curPart.get_x_m();
macroSigma_m2 = interactionPtr->get_macroSigma_m2(curPart);
moverPtr->move(&curPart, macroSigma_m2);
if (!terminatorPtr->checkTermination(curPart)) {
IntOut = interactionPtr->do_Interaction(&curPart);
for (int i=0; i<IntOut.get_number_new_particles(); i++) {
partQue.push_back(IntOut.get_new_particles()[i]);
partQue.back().set_Id(numberTotalParticles++);
}
if (IntOut.get_decrease_population()) {
populations.find(IntOut.get_decrease_species())->decrease_denisty(IntOut.get_decrease_location(), IntOut.get_decrease_energy_eV());
}
if (IntOut.get_delete_current()) {
break;
}
@@ -116,7 +114,7 @@ void Simulation::doTC6() {
};
void Simulation::do_interaction(Electron *interactElectron) {
vec3 newLoc_m = electronQue.front().get_Location_m();
vec3 newLoc_m = electronQue.front().get_x_m();
if (Kat.check_Termination(*interactElectron)) {
stringstream ss;
ss<<"Simulation::do_interaction: Particle already terminated.";
@@ -125,10 +123,10 @@ void Simulation::do_interaction(Electron *interactElectron) {
int process = interactElectron->roll_Interaction(Kat.get_T2_flowSpeed_ms(newLoc_m),&rngUni);
switch (process) {
case 1: // Elastic Scattering
interactElectron->do_elaScattering(Kat.roll_T2_speed_ms(newLoc_m, &rngUni, &rngNormal) , &rngUni);
interactElectron->do_elaScattering(Kat.roll_T2_v_ms(newLoc_m, &rngUni, &rngNormal) , &rngUni);
break;
case 2: // Ionization
electronQue.push_back( interactElectron->do_Ionization(Kat.roll_T2_speed_ms(newLoc_m, &rngUni, &rngNormal), numberTotalElectrons, &rngUni) );
electronQue.push_back( interactElectron->do_Ionization(Kat.roll_T2_v_ms(newLoc_m, &rngUni, &rngNormal), numberTotalElectrons, &rngUni) );
numberTotalElectrons++;
// Update Ions...
break;
+3 -3
View File
@@ -14,8 +14,8 @@ using namespace std;
Size_Container::Size_Container(int num_z_bins, int num_r_bins, int num_phi_bins) {
r_scale = Lin_Scale(0, Katrin_Geo::get_radius_m(), num_r_bins);
cell_length_m = (Katrin_Geo::get_z_WGTSend_m()-Katrin_Geo::get_z_RW_m()) / (num_z_bins);
r_scale = Lin_Scale(0, r_WGTS_m, num_r_bins);
cell_length_m = (z_WGTS_end_m-z_RW_m) / (num_z_bins);
data = new double[num_r_bins];
for (int i = 0; i<num_r_bins; i++) {
@@ -59,7 +59,7 @@ double Size_Container::get_cell_volume_m3(const double &r_m) {
}
double Size_Container::get_cell_volume_m3(const vec3 &loc_m) {
double r_m = get_r_m(loc_m);
double r_m = calc_r_m(loc_m);
return get_cell_volume_m3(r_m);
}
+1 -1
View File
@@ -10,7 +10,7 @@
#define size_container_hpp
#include "lin_scale.h"
#include "katrin_geo.hpp"
#include "katrin_geo.h"
class Size_Container {
+5 -22
View File
@@ -23,18 +23,12 @@ class InteractionOut {
Particle new_particles[3];
int number_new_particles;
bool decrease_population;
species decrease_species;
vec3 decrease_location;
double decrease_energy_eV;
public:
InteractionOut() {reset();};
void reset() {
delete_current = false;
number_new_particles = 0;
decrease_population = false;
}
void set_delete_current(const bool &delete_current) {this->delete_current = delete_current;}
@@ -46,17 +40,6 @@ public:
}
int get_number_new_particles() {return number_new_particles;}
Particle *get_new_particles() {return new_particles;}
void set_decrease (const species &decrease_species, const vec3 &decrease_location, const double &decrease_energy_eV) {
this->decrease_population = true;
this->decrease_species = decrease_species;
this->decrease_location = decrease_location;
this->decrease_energy_eV = decrease_energy_eV;
}
bool get_decrease_population() {return decrease_population;}
species get_decrease_species() {return decrease_species;}
vec3 get_decrease_location() {return decrease_location;}
double get_decrease_energy_eV() {return decrease_energy_eV;}
};
@@ -76,13 +59,13 @@ public:
protected:
vec3 get_vOff_ms(const Particle &interPart, const double &minE_eV) {
double m_eV = interPart.get_Mass_eV();
vec3 v1_ms = interPart.get_Speed_ms();
vec3 v2_ms = Population->roll_speed_ms(interPart.get_Location_m());
double m_eV = interPart.get_m_eV();
vec3 v1_ms = interPart.get_v_ms();
vec3 v2_ms = Population->roll_v_ms(interPart.get_x_m());
vec3 v1Lab_ms = v1_ms - v2_ms;
double T_eV = calc_Ekin_eV_from_speed(v1Lab_ms, m_eV);
double T_eV = calc_E_eV_from_v_ms(v1Lab_ms, m_eV);
if (T_eV < minE_eV) {
T_eV = calc_Ekin_eV_from_speed(v1_ms, m_eV);
T_eV = calc_E_eV_from_v_ms(v1_ms, m_eV);
if (T_eV < minE_eV) {
std::stringstream ss;
ss<<"Sub_Interaction_Base::get_vOff_ms: T_eV < minE_eV.\n";
+3 -3
View File
@@ -11,7 +11,7 @@
#include "process_base.h"
#include "particle.hpp"
#include "katrin_geo.hpp"
#include "katrin_geo.h"
class Terminator_Base : public Process_Base {
public:
@@ -55,8 +55,8 @@ public:
}
protected:
bool check_Energy(const Particle &movePart) {
double Ekin_eV = movePart.get_EKin_eV();
if (Ekin_eV<=cutoffEnergy_eV) {
double E_eV = movePart.get_E_eV();
if (E_eV<=cutoffEnergy_eV) {
return true;
}
return false;
+1 -1
View File
@@ -24,6 +24,6 @@ Terminator_Manager Terminator_Builder::build() {
Terminator.add(new Neutral_Terminator(tritium, maxInteractions, cutoffEnergy_eV));
Terminator.add(new Positive_Terminator(tritiumI, maxInteractions, cutoffEnergy_eV));
Terminator.add(new Positive_Terminator(tritium2I, maxInteractions, cutoffEnergy_eV));
Terminator.add(new Positive_Terminator(tritium3I, maxInteractions, cutoffEnergy_eV));
return Terminator;
}
+2 -2
View File
@@ -29,7 +29,7 @@ double ThermalPop_Container::getDensity_m3(const vec3 &locXYZ_m, double physTime
void ThermalPop_Container::upDensity (const Particle &upParticle, const vec3 &oldLocXYZ_m) {
check_In_Container(oldLocXYZ_m, xyz);
vec3 zrphiOld_m = transformTo_zrphiCords(oldLocXYZ_m, xyz);
vec3 zrphiNew_m = upParticle.get_Location_m();
vec3 zrphiNew_m = upParticle.get_x_m();
check_In_Container(zrphiNew_m, zrphi);
// Check r and phi not changing, only valid for drift approximation....
@@ -41,7 +41,7 @@ void ThermalPop_Container::upDensity (const Particle &upParticle, const vec3 &ol
double r_m = zrphiOld_m[1];
double phi = zrphiOld_m[2];
double l_m = get_l_m();
double vAbs_ms = upParticle.get_SpeedAbs_ms();
double vAbs_ms = upParticle.get_vAbs_ms();
dim3Map::iterator zItr_min = Map.lower_bound(z_min_m);
dim3Map::iterator zItr_max = Map.lower_bound(z_max_m);
+31 -23
View File
@@ -9,7 +9,7 @@
#ifndef Thermal_Population_h
#define Thermal_Population_h
#include "katrin_geo.hpp"
#include "katrin_geo.h"
#include <fstream>
@@ -44,9 +44,9 @@ public:
void decrease_denisty (const vec3 &loc_m, const double &energy_eV);
public:
vec3 get_average_speed_ms (const vec3 &loc_m);
vec3 roll_speed_ms (const vec3 &loc_m);
vec3 roll_v_ms (const vec3 &loc_m);
private:
vec3 get_average_v_ms (const vec3 &loc_m);
vec3 roll_thermSpeed_ms(const vec3 &loc_m);
public:
@@ -57,7 +57,7 @@ public:
private:
Lin_Scale get_z_scale();
Lin_Scale get_r_scale();
Lin_Scale get_phi_scale();
Lin_Scale calc_phi_scale();
};
@@ -81,7 +81,11 @@ void Thermal_Population::init_containers(int num_z_bins, int num_r_bins, int num
}*/
inline double Thermal_Population::get_density_m3(const vec3 &loc_m) {
//Katrin_Geo::check_inKatrin(loc_m);
if (!in_Katrin(loc_m)) {
std::stringstream ss;
ss<<"Thermal_Population::get_density_m3: loc_m outside of Katrin.\n";
throw MyException(ss.str());
}
double physical_time_s = timer->get_physTime_s();
double cumulated_time_s_s = cumulated_times_s.get_value(loc_m);
double offset = number_annhilated.get_value(loc_m);
@@ -92,8 +96,8 @@ inline double Thermal_Population::get_density_m3(const vec3 &loc_m) {
}
inline void Thermal_Population::increase_density(const Particle &upPart, const vec3 &oldLoc_m) {
double cell_time_s = bin_sizes.get_cell_length_m()/upPart.get_SpeedAbs_ms();
cumulated_times_s.increase_value(cell_time_s, upPart.get_Location_m(), oldLoc_m);
double cell_time_s = bin_sizes.get_cell_length_m()/upPart.get_vAbs_ms();
cumulated_times_s.increase_value(cell_time_s, upPart.get_x_m(), oldLoc_m);
}
inline void Thermal_Population::decrease_denisty (const vec3 &loc_m, const double &energy_eV) {
@@ -101,9 +105,9 @@ inline void Thermal_Population::decrease_denisty (const vec3 &loc_m, const doubl
}
inline vec3 Thermal_Population::get_average_speed_ms(const vec3 &loc_m) {
if (Katrin_Geo::inWGTS(loc_m)) {
double z_wgtsHalf_m = Katrin_Geo::get_z_WGTSstart_m() + (Katrin_Geo::get_z_WGTSend_m() - Katrin_Geo::get_z_WGTSstart_m())/2;
inline vec3 Thermal_Population::get_average_v_ms(const vec3 &loc_m) {
if (in_WGTS(loc_m)) {
double z_wgtsHalf_m = z_WGTS_start_m + (z_WGTS_end_m - z_WGTS_start_m)/2;
double sign = (loc_m[2] < z_wgtsHalf_m) ? -1 : 1;
double zSpeed_ms = sign*wgtsT2FlowSpeed_ms;
return vec3(0,0,zSpeed_ms);
@@ -112,23 +116,27 @@ inline vec3 Thermal_Population::get_average_speed_ms(const vec3 &loc_m) {
}
}
inline vec3 Thermal_Population::roll_speed_ms(const vec3 &loc_m) {
Katrin_Geo::check_inKatrin(loc_m);
return get_average_speed_ms(loc_m) + roll_thermSpeed_ms(loc_m);
inline vec3 Thermal_Population::roll_v_ms(const vec3 &loc_m) {
if (!in_Katrin(loc_m)) {
std::stringstream ss;
ss<<"Thermal_Population::roll_v_ms: loc_m outside of Katrin.\n";
throw MyException(ss.str());
}
return get_average_v_ms(loc_m) + roll_thermSpeed_ms(loc_m);
}
inline vec3 Thermal_Population::roll_thermSpeed_ms(const vec3 &loc_m) {
double E_eV = roll_MBEnergy(wgtsTemp_K, m_eV, rngNormal);
double abs_speed_ms = calc_Speed_from_Ekin_eV(E_eV, m_eV);
vec3 speed_ms = roll_uniform_direction(rngUni)*abs_speed_ms;
return speed_ms;
double abs_v_ms = calc_v_ms_from_E_eV(E_eV, m_eV);
vec3 v_ms = roll_uniform_direction(rngUni)*abs_v_ms;
return v_ms;
}
inline meta_vec Thermal_Population::get_bins_meta_info() {
Lin_Scale z_scale = get_z_scale();
Lin_Scale r_scale = get_r_scale();
Lin_Scale phi_scale = get_phi_scale();
Lin_Scale phi_scale = calc_phi_scale();
meta_vec res;
pop_bin_meta_info temp_bin = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
@@ -160,7 +168,7 @@ inline meta_vec Thermal_Population::get_bins_meta_info() {
inline bin_content_vec Thermal_Population::get_bins_content() {
Lin_Scale z_scale = get_z_scale();
Lin_Scale r_scale = get_r_scale();
Lin_Scale phi_scale = get_phi_scale();
Lin_Scale phi_scale = calc_phi_scale();
bin_content_vec res;
pop_bin_content temp_bin = {0, 0, 0, 0, 0, 0};
@@ -184,7 +192,7 @@ inline bin_count4 Thermal_Population::get_bin_count4() {
bin_count4 res;
res[0] = get_z_scale().get_number_bins();
res[1] = get_r_scale().get_number_bins();
res[2] = get_phi_scale().get_number_bins();
res[2] = calc_phi_scale().get_number_bins();
res[3] = 0;
return res;
}
@@ -235,12 +243,12 @@ inline Lin_Scale Thermal_Population::get_r_scale() {
}
}
inline Lin_Scale Thermal_Population::get_phi_scale() {
if (cumulated_times_s.get_phi_scale() == number_annhilated.get_phi_scale()) {
return cumulated_times_s.get_phi_scale();
inline Lin_Scale Thermal_Population::calc_phi_scale() {
if (cumulated_times_s.calc_phi_scale() == number_annhilated.calc_phi_scale()) {
return cumulated_times_s.calc_phi_scale();
} else {
std::stringstream ss;
ss<<"Thermal_Population::get_phi_scale: Missmatch in scales.\n";
ss<<"Thermal_Population::calc_phi_scale: Missmatch in scales.\n";
throw MyException(ss.str());
}
}
+2 -2
View File
@@ -17,8 +17,8 @@ double Timer::get_physTime_s() {
}
void Timer::set_T2_activity_s() {
double r_m = Katrin_Geo::get_radius_m();
double l_m = Katrin_Geo::get_wgtsLength_m();
double r_m = r_WGTS_m;
double l_m = l_WGTS_m;
double V_m3 = pi*r_m*r_m*l_m;
double NT2 = (wgtsT2MaxDensity_m3/2)*V_m3;
T2_activity_s = NT2*decayConstT2_s;
+2 -1
View File
@@ -9,7 +9,8 @@
#ifndef timer_hpp
#define timer_hpp
#include "katrin_geo.hpp"
#include "katrin_geo.h"
class Timer {
static const double wgtsT2MaxDensity_m3;
double T2_activity_s;
+74 -34
View File
@@ -15,56 +15,96 @@ class T2_Population : public Population_Base, public RNG_Base {
static const double wgtsTemp_K;
static const double wgtsT2FlowSpeed_ms;
public:
T2_Population(UniRNG *rngUni, NormalRNG *rngNormal) : Population_Base(tritium2), RNG_Base(rngUni, rngNormal){};
int n_regimes;
double *reduction_min;
double *z_min_m;
double *slopes;
public:
T2_Population(UniRNG *rngUni, NormalRNG *rngNormal) : Population_Base(tritium2), RNG_Base(rngUni, rngNormal){
set_regimes();
};
~T2_Population() {
delete[] reduction_min;
delete[] z_min_m;
delete[] slopes;
};
private:
void set_regimes();
public:
double get_density_m3 (const vec3 &loc_m);
void increase_density (const Particle &upPart, const vec3 &oldLoc_m) {};
void decrease_denisty (const vec3 &oldLoc_m, const double &energy_eV) {};
vec3 get_average_speed_ms (const vec3 &loc_m);
vec3 roll_speed_ms (const vec3 &loc_m);
public:
vec3 roll_v_ms (const vec3 &loc_m);
private:
vec3 get_average_v_ms (const vec3 &loc_m);
vec3 roll_thermSpeed_ms(const vec3 &loc_m);
public:
meta_vec get_bins_meta_info();
bin_content_vec get_bins_content();
bin_count4 get_bin_count4();
void set_bins(bin_count4 bin_counts, bin_content_vec bin_contents) {};
private:
double calc_DensityTriangle(const double &z_m);
vec3 roll_thermSpeed_ms(const vec3 &loc_m);
double interpolate_red(const double &z_m, const double &z_min_m, const double &z_max_m, const double &red_min, const double &red_max);
};
const double T2_Population::wgtsT2MaxDensity_m3 = load_parameter("wgtsT2MaxDensity_m3");
const double T2_Population::wgtsTemp_K = load_parameter("wgtsTemp_K");
const double T2_Population::wgtsT2FlowSpeed_ms = load_parameter("wgtsT2FlowSpeed_ms");
inline double T2_Population::get_density_m3(const vec3 &loc_m) {
Katrin_Geo::check_inKatrin(loc_m);
if (!Katrin_Geo::inWGTS(loc_m)) {
return 0; // Prob change to some realisitc value -> search for one
} else {
return calc_DensityTriangle(loc_m[2]);
inline void T2_Population::set_regimes() {
n_regimes = 4;
double reds[5] = {reduction_tot_rear, reduction_WGTS_rear, 1, reduction_WGTS_front, reduction_tot_front};
double zs[5] = {z_RW_m, z_WGTS_start_m, z_WGTS_mid_m, z_WGTS_end_m, z_DPS_end_m};
reduction_min = new double[n_regimes];
double reduction_max;
z_min_m = new double[n_regimes];
double z_max_m;
slopes = new double[n_regimes];
for (int i = 0; i<n_regimes; i++) {
reduction_min[i] = reds[i];
reduction_max = reds[i+1];
z_min_m[i] = zs[i];
z_max_m = zs[i+1];
slopes[i] = (reduction_max-reduction_min[i])/(z_max_m-z_min_m[i]);
}
}
inline double T2_Population::calc_DensityTriangle(const double &z_m) {
double z_wgts_m = z_m - Katrin_Geo::get_z_WGTSstart_m(); // Cords with z=0 at beginning of WGTS
double wgtsLength_m = Katrin_Geo::get_wgtsLength_m();
double wgtsHalfLength_m = wgtsLength_m/2;
double zProjection_m = (z_wgts_m < wgtsHalfLength_m) ? z_wgts_m : wgtsLength_m - z_wgts_m;
double reduction_Factor = zProjection_m/wgtsHalfLength_m; //Correction since reflection
return reduction_Factor * wgtsT2MaxDensity_m3;
inline double T2_Population::get_density_m3(const vec3 &loc_m) {
if (!in_Katrin(loc_m)) {
std::stringstream ss;
ss<<"T2_Population::get_density_m3: loc_m outside of Katrin.\n";
throw MyException(ss.str());
}
return calc_DensityTriangle(loc_m[2]);
}
inline vec3 T2_Population::roll_speed_ms(const vec3 &loc_m) {
Katrin_Geo::check_inKatrin(loc_m);
return get_average_speed_ms(loc_m) + roll_thermSpeed_ms(loc_m);
inline double T2_Population::calc_DensityTriangle(const double &z_m) {
for (int i = (n_regimes-1); i>=0; i--) {
if (z_m>z_min_m[i]) {
double reduction_factor = reduction_min[i] + (z_m-z_min_m[i])*slopes[i];
return reduction_factor * wgtsT2MaxDensity_m3;
}
}
std::stringstream ss;
ss<<"T2_Population::calc_DensityTriangle: z_m outside of Katrin.\n";
throw MyException(ss.str());
}
inline vec3 T2_Population::roll_v_ms(const vec3 &loc_m) {
if (!in_Katrin(loc_m)) {
std::stringstream ss;
ss<<"T2_Population::roll_v_ms: loc_m outside of Katrin.\n";
throw MyException(ss.str());
}
return get_average_v_ms(loc_m) + roll_thermSpeed_ms(loc_m);
}
inline meta_vec T2_Population::get_bins_meta_info() {
@@ -85,9 +125,9 @@ inline bin_count4 T2_Population::get_bin_count4() {
throw MyException (ss.str());
}
inline vec3 T2_Population::get_average_speed_ms(const vec3 &loc_m) {
if (Katrin_Geo::inWGTS(loc_m)) {
double z_wgtsHalf_m = Katrin_Geo::get_z_WGTSstart_m() + (Katrin_Geo::get_z_WGTSend_m() - Katrin_Geo::get_z_WGTSstart_m())/2;
inline vec3 T2_Population::get_average_v_ms(const vec3 &loc_m) {
if (in_WGTS(loc_m)) {
double z_wgtsHalf_m = z_WGTS_start_m + (z_WGTS_end_m - z_WGTS_start_m)/2;
double sign = (loc_m[2] < z_wgtsHalf_m) ? -1 : 1;
double zSpeed_ms = sign*wgtsT2FlowSpeed_ms;
return vec3(0,0,zSpeed_ms);
@@ -97,10 +137,10 @@ inline vec3 T2_Population::get_average_speed_ms(const vec3 &loc_m) {
}
inline vec3 T2_Population::roll_thermSpeed_ms(const vec3 &loc_m) {
double Ekin_eV = roll_MBEnergy(wgtsTemp_K,mT2_eV,rngNormal);
double Speed_ms = calc_Speed_from_Ekin_eV(Ekin_eV, mT2_eV);
vec3 speed_ms = roll_uniform_direction(rngUni)*Speed_ms;
return speed_ms;
double E_eV = roll_MBEnergy(wgtsTemp_K, 2*mT_eV, rngNormal);
double Speed_ms = calc_v_ms_from_E_eV(E_eV, 2*mT_eV);
vec3 v_ms = roll_uniform_direction(rngUni)*Speed_ms;
return v_ms;
}
+4 -4
View File
@@ -17,7 +17,7 @@
double Uehara_eT2_ElasticScattering::calc_TCS(const double &T_eV) {
double beta = calc_beta_from_Ekin_eV(T_eV,me_eV);
double beta = calc_beta_from_E_eV(T_eV,me_eV);
double eta = calc_eta(T_eV);
double numerator = pi*ZT2*(ZT2+1)*re_m*re_m * (1-pow(beta,2));
double denominator = eta * (eta+1)*pow(beta,4);
@@ -25,7 +25,7 @@ double Uehara_eT2_ElasticScattering::calc_TCS(const double &T_eV) {
}
double Uehara_eT2_ElasticScattering::calc_SDCS(const double &T_eV, const double &theta) {
double beta = calc_beta_from_Ekin_eV(T_eV,me_eV);
double beta = calc_beta_from_E_eV(T_eV,me_eV);
double eta = calc_eta(T_eV);
double numerator = ZT2*(ZT2+1)*re_m*re_m * (1-pow(beta,2));
double denominator = pow(beta,4)*pow(1-cos(theta)+2*eta, 2);
@@ -33,7 +33,7 @@ double Uehara_eT2_ElasticScattering::calc_SDCS(const double &T_eV, const double
}
double Uehara_eT2_ElasticScattering::roll_theta(const double &T_eV, UniRNG *rngUni) {
double beta = calc_beta_from_Ekin_eV(T_eV,me_eV);
double beta = calc_beta_from_E_eV(T_eV,me_eV);
double elaEta = calc_eta(T_eV);
double const1 = 2*pi/calc_TCS(T_eV)*ZT2*(ZT2+1)*re_m*re_m*(1- pow(beta,2) )* pow(beta,-4);
double fac = pow( rngUni->random()/const1-pow(2*elaEta,-1) , -1 ) +1+2*elaEta;
@@ -42,7 +42,7 @@ double Uehara_eT2_ElasticScattering::roll_theta(const double &T_eV, UniRNG *rngU
}
double Uehara_eT2_ElasticScattering::calc_eta(const double &T_eV) {
double beta = calc_beta_from_Ekin_eV(T_eV, me_eV);
double beta = calc_beta_from_E_eV(T_eV, me_eV);
double etac = (T_eV < 50e3)? 1.198 : 1.13+3.76*pow(ZT2/(137*beta),2);
double elaTau = T_eV/me_eV;
return etac * 1.7e-5 * pow(ZT2,2./3.) / (elaTau*(elaTau+2));
+4 -4
View File
@@ -13,7 +13,7 @@ enum cordStyle{xyz, zrphi};
#include <vector>
#include "katrin_geo.hpp"
#include "katrin_geo.h"
#include "kinematics.h"
#include "base_container.h"
@@ -74,9 +74,9 @@ inline Zylindric_Cords::Zylindric_Cords(double z_min_m, double z_max_m, double r
}
inline void Zylindric_Cords::set_fromKatrinGeo() {
this->z_min_m = Katrin_Geo::get_z_RW_m();
this->z_max_m = Katrin_Geo::get_z_WGTSend_m();
this->r_max_m = Katrin_Geo::get_radius_m();
this->z_min_m = z_RW_m;
this->z_max_m = z_WGTS_end_m;
this->r_max_m = r_WGTS_m;
}
inline void Zylindric_Cords::set_l_m() {