Major update:
1. Added precalculation of integral values in thermal regime. 2. Minor Changes in Injection of \beta-electrons and ions.
This commit is contained in:
@@ -13,10 +13,12 @@
|
||||
#include "janev_T2IT2_cluster.h"
|
||||
|
||||
|
||||
class T2IT2_Cluster : public TI_thermal_Interaction_Base {
|
||||
class T2IT2_Cluster : public TI_thermal_binary_Precomputed_Interaction_Base {
|
||||
public:
|
||||
T2IT2_Cluster(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Interaction_Base(T2Population, rngUni) {}
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {return Janev_T2IT2_Cluster::get_TCS(E_eV);}
|
||||
T2IT2_Cluster(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, 2*mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
}
|
||||
double get_microSigma_m2(const double &E_eV) {return Janev_T2IT2_Cluster::get_TCS(E_eV);}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -14,11 +14,13 @@
|
||||
#include "janev_T2IT2_cx.h"
|
||||
|
||||
|
||||
class T2IT2_CX : public TI_thermal_Interaction_Base {
|
||||
class T2IT2_CX : public TI_thermal_binary_Precomputed_Interaction_Base {
|
||||
Elastic_Kinematic_Base kinematics;
|
||||
public:
|
||||
T2IT2_CX(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Interaction_Base(T2Population, rngUni), kinematics(2*mT_eV, 2*mT_eV) {}
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {return Janev_T2IT2_CX::get_TCS(E_eV);}
|
||||
T2IT2_CX(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, 2*mT_eV), kinematics(2*mT_eV, 2*mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
}
|
||||
double get_microSigma_m2(const double &E_eV) {return Janev_T2IT2_CX::get_TCS(E_eV);}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class T2Ie_DissExc : public Interaction_Base {
|
||||
public:
|
||||
T2Ie_DissExc(Population_Base *ePopulation, UniRNG *rngUni) : Interaction_Base(ePopulation, rngUni) {}
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {return Janev_eT2I_DissExc::get_TCS(E_eV);}
|
||||
double get_microSigma_m2(const double &E_eV) {return Janev_eT2I_DissExc::get_TCS(E_eV);}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -10,16 +10,20 @@
|
||||
#define T2Ie_recombination_h
|
||||
|
||||
#include "sub_interaction_base.h"
|
||||
#include "precomputed_interaction_base.h"
|
||||
#include "janev_eT2I_recombination.h"
|
||||
|
||||
class T2Ie_Recombination : public TI_e_Interaction_Base {
|
||||
class T2Ie_Recombination : public TI_e_Precomputed_Interaction_Base {
|
||||
public:
|
||||
T2Ie_Recombination(Population_Base *ePopulation, UniRNG *rngUni) : TI_e_Interaction_Base(ePopulation, rngUni) {}
|
||||
T2Ie_Recombination(Population_Base *ePopulation, UniRNG *rngUni) : TI_e_Precomputed_Interaction_Base(ePopulation, rngUni, 2*mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
}
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
protected:
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return Janev_eT2I_Recombination::get_TCS(E_eV);
|
||||
}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
inline InteractionOut T2Ie_Recombination::do_Interaction (Particle *interPart) {
|
||||
|
||||
@@ -13,14 +13,16 @@
|
||||
#include "tabata_T3IT2_elastic.h"
|
||||
|
||||
|
||||
class T3IT2_Elastic : public TI_thermal_Interaction_Base {
|
||||
class T3IT2_Elastic : public TI_thermal_binary_Precomputed_Interaction_Base {
|
||||
Tabata_T3IT2_Elastic tcs_gen;
|
||||
Elastic_Kinematic_Base kinematics;
|
||||
|
||||
public:
|
||||
T3IT2_Elastic(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Interaction_Base(T2Population, rngUni), kinematics(3*mT_eV, 2*mT_eV) {};
|
||||
T3IT2_Elastic(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, 3*mT_eV), kinematics(3*mT_eV, 2*mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
};
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {return tcs_gen.get_TCS(E_eV);}
|
||||
double get_microSigma_m2(const double &E_eV) {return tcs_gen.get_TCS(E_eV);}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -12,12 +12,14 @@
|
||||
#include "sub_interaction_base.h"
|
||||
// CS from Gerlich:
|
||||
|
||||
class T3IT2_RadAsc : public TI_thermal_Interaction_Base {
|
||||
class T3IT2_RadAsc : public TI_thermal_binary_Precomputed_Interaction_Base {
|
||||
|
||||
public:
|
||||
T3IT2_RadAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Interaction_Base(T2Population, rngUni) {};
|
||||
T3IT2_RadAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, 3*mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
};
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
double v_ms = calc_v_ms_from_E_eV(E_eV, 3*mT_eV);
|
||||
return 5e-23/v_ms;
|
||||
}
|
||||
|
||||
@@ -12,14 +12,16 @@
|
||||
#include "sub_interaction_base.h"
|
||||
// CS from Gerlich:
|
||||
|
||||
class T3IT2_TerAsc : public TI_thermal_Interaction_Base {
|
||||
class T3IT2_TerAsc : public TI_thermal_tenary_Precomputed_Interaction_Base {
|
||||
|
||||
public:
|
||||
T3IT2_TerAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Interaction_Base(T2Population, rngUni) {};
|
||||
T3IT2_TerAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_tenary_Precomputed_Interaction_Base(T2Population, rngUni, 3*mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
};
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_divbyn_m2(const double &E_eV) {
|
||||
double v_ms = calc_v_ms_from_E_eV(E_eV, 3*mT_eV);
|
||||
return 7e-41*Population->get_density_m3(loc_m)/v_ms;
|
||||
return 7e-41*v_ms;
|
||||
}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ class T3Ie_DissExc : public Interaction_Base {
|
||||
public:
|
||||
T3Ie_DissExc(Population_Base *ePopulation, UniRNG *rngUni) : Interaction_Base(ePopulation, rngUni) {}
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {return Janev_eT3I_DissExc::get_TCS(E_eV);}
|
||||
double get_microSigma_m2(const double &E_eV) {return Janev_eT3I_DissExc::get_TCS(E_eV);}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -9,16 +9,21 @@
|
||||
#ifndef T3Ie_recombination_h
|
||||
#define T3Ie_recombination_h
|
||||
|
||||
#include "sub_interaction_base.h"
|
||||
#include "precomputed_interaction_base.h"
|
||||
#include "janev_eT3I_recombination.h"
|
||||
|
||||
class T3Ie_Recombination : public TI_e_Interaction_Base {
|
||||
class T3Ie_Recombination : public TI_e_Precomputed_Interaction_Base {
|
||||
public:
|
||||
T3Ie_Recombination(Population_Base *ePopulation, UniRNG *rngUni) : TI_e_Interaction_Base(ePopulation, rngUni) {}
|
||||
T3Ie_Recombination(Population_Base *ePopulation, UniRNG *rngUni) : TI_e_Precomputed_Interaction_Base(ePopulation, rngUni, 3*mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
}
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
protected:
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return Janev_eT3I_Recombination::get_TCS(E_eV);
|
||||
}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
inline InteractionOut T3Ie_Recombination::do_Interaction (Particle *interPart) {
|
||||
|
||||
@@ -10,14 +10,16 @@
|
||||
#define T5IT2_elastic_h
|
||||
|
||||
|
||||
class T5IT2_Elastic : public TI_thermal_Interaction_Base {
|
||||
class T5IT2_Elastic : public TI_thermal_binary_Precomputed_Interaction_Base {
|
||||
Tabata_T3IT2_Elastic tcs_gen; // Obviously wrong, but should be good enough.
|
||||
Elastic_Kinematic_Base kinematics;
|
||||
|
||||
public:
|
||||
T5IT2_Elastic(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Interaction_Base(T2Population, rngUni), kinematics(5*mT_eV, 2*mT_eV) {};
|
||||
T5IT2_Elastic(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, 5*mT_eV), kinematics(5*mT_eV, 2*mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
};
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {return tcs_gen.get_TCS(E_eV);}
|
||||
double get_microSigma_m2(const double &E_eV) {return tcs_gen.get_TCS(E_eV);}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -11,17 +11,21 @@
|
||||
|
||||
|
||||
#include "sub_interaction_base.h"
|
||||
#include "precomputed_interaction_base.h"
|
||||
|
||||
#include "petterson_eT5I_recombination.h"
|
||||
|
||||
class T5Ie_Recombination : public TI_e_Interaction_Base {
|
||||
class T5Ie_Recombination : public TI_e_Precomputed_Interaction_Base {
|
||||
public:
|
||||
T5Ie_Recombination(Population_Base *ePopulation, UniRNG *rngUni) : TI_e_Interaction_Base(ePopulation, rngUni) {}
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
T5Ie_Recombination(Population_Base *ePopulation, UniRNG *rngUni) : TI_e_Precomputed_Interaction_Base(ePopulation, rngUni, 5*mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
}
|
||||
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
protected:
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return Pettersson_eT5I_Recombination::get_TCS(E_eV);
|
||||
}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +33,7 @@ inline InteractionOut T5Ie_Recombination::do_Interaction (Particle *interPart) {
|
||||
InteractionOut res;
|
||||
res.set_delete_current(true);
|
||||
|
||||
double E_eV = calc_E_eV_from_v_ms(Population->roll_v_ms(interPart->get_x_m()), me_eV); // should be computed properly using chances.
|
||||
//double E_eV = calc_E_eV_from_v_ms(Population->roll_v_ms(interPart->get_x_m()), me_eV); // should be computed properly using chances.
|
||||
//Population->decrease_denisty(interPart->get_x_m(), E_eV);
|
||||
|
||||
return res;
|
||||
|
||||
@@ -14,14 +14,16 @@
|
||||
#include "tabata_TIT2_elastic.h"
|
||||
|
||||
|
||||
class TIT2_Elastic : public TI_thermal_Interaction_Base {
|
||||
class TIT2_Elastic : public TI_thermal_binary_Precomputed_Interaction_Base {
|
||||
Tabata_TIT2_Elastic tcs_gen;
|
||||
Elastic_Kinematic_Base kinematics;
|
||||
|
||||
public:
|
||||
TIT2_Elastic(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Interaction_Base(T2Population, rngUni), kinematics(mT_eV, 2*mT_eV) {};
|
||||
TIT2_Elastic(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, mT_eV), kinematics(mT_eV, 2*mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
};
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {return tcs_gen.get_TCS(E_eV);}
|
||||
double get_microSigma_m2(const double &E_eV) {return tcs_gen.get_TCS(E_eV);}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -12,12 +12,14 @@
|
||||
#include "sub_interaction_base.h"
|
||||
// CS from Plasil:2012
|
||||
|
||||
class TIT2_RadAsc : public TI_thermal_Interaction_Base {
|
||||
class TIT2_RadAsc : public TI_thermal_binary_Precomputed_Interaction_Base {
|
||||
|
||||
public:
|
||||
TIT2_RadAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Interaction_Base(T2Population, rngUni) {};
|
||||
TIT2_RadAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_binary_Precomputed_Interaction_Base(T2Population, rngUni, mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
};
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
double v_ms = calc_v_ms_from_E_eV(E_eV, mT_eV);
|
||||
return 5e-23/v_ms;
|
||||
}
|
||||
|
||||
@@ -12,14 +12,16 @@
|
||||
#include "sub_interaction_base.h"
|
||||
// CS from Plasil:2012
|
||||
|
||||
class TIT2_TerAsc : public TI_thermal_Interaction_Base {
|
||||
class TIT2_TerAsc : public TI_thermal_tenary_Precomputed_Interaction_Base {
|
||||
|
||||
public:
|
||||
TIT2_TerAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_Interaction_Base(T2Population, rngUni) {};
|
||||
TIT2_TerAsc(Population_Base *T2Population, UniRNG *rngUni) : TI_thermal_tenary_Precomputed_Interaction_Base(T2Population, rngUni, mT_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
};
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_divbyn_m2(const double &E_eV) {
|
||||
double v_ms = calc_v_ms_from_E_eV(E_eV, mT_eV);
|
||||
return 2.6e-41*Population->get_density_m3(loc_m)/v_ms;
|
||||
return 2.6e-41/v_ms;
|
||||
}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "katrin_geo.h"
|
||||
|
||||
#include "error_types.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -17,30 +17,30 @@ class Drift_Base : public Mover_Base {
|
||||
public:
|
||||
Drift_Base(species this_species, Particle_Logger_Base *Logger, Population_Base *Population) : Mover_Base(this_species, Logger, Population) {};
|
||||
|
||||
void move(Particle *movePart, const double ¯oSigma_m);
|
||||
void move(Particle *movePart, const double ¯o_sigma_m);
|
||||
|
||||
protected:
|
||||
double get_zNew_m(Particle *movePart, const double ¯oSigma_m);
|
||||
double get_zNew_m(Particle *movePart, const double ¯o_sigma_m);
|
||||
virtual void doWallInteraction(Particle *movePart, vec3 *oldLoc_m, double *znew_m) = 0;
|
||||
virtual void do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯oSigma_m) = 0;
|
||||
virtual void do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯o_sigma_m) = 0;
|
||||
|
||||
};
|
||||
|
||||
inline void Drift_Base::move(Particle *movePart, const double ¯oSigma_m) {
|
||||
inline void Drift_Base::move(Particle *movePart, const double ¯o_sigma_m) {
|
||||
vec3 oldLoc_m = movePart->get_x_m();
|
||||
vec3 newLoc_m = oldLoc_m;
|
||||
|
||||
double znew_m = get_zNew_m(movePart, macroSigma_m);
|
||||
double znew_m = get_zNew_m(movePart, macro_sigma_m);
|
||||
doWallInteraction(movePart, &oldLoc_m, &znew_m);
|
||||
newLoc_m[2] = znew_m;
|
||||
|
||||
movePart->set_x_m(newLoc_m);
|
||||
do_E_calculus(movePart, oldLoc_m, macroSigma_m);
|
||||
do_E_calculus(movePart, oldLoc_m, macro_sigma_m);
|
||||
Logger->log(*movePart, oldLoc_m);
|
||||
Population->increase_density(*movePart, oldLoc_m);
|
||||
}
|
||||
|
||||
inline double Drift_Base::get_zNew_m(Particle *movePart, const double ¯oSigma_m) {
|
||||
inline double Drift_Base::get_zNew_m(Particle *movePart, const double ¯o_sigma_m) {
|
||||
double zold_m = movePart->get_x_m()[2];
|
||||
|
||||
vec3 v_ms = movePart->get_v_ms();
|
||||
@@ -48,14 +48,14 @@ inline double Drift_Base::get_zNew_m(Particle *movePart, const double ¯oSigm
|
||||
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_m == 0) {
|
||||
if (macro_sigma_m == 0) {
|
||||
if (zDir == -1) {
|
||||
znew_m = z_RW_m - 2*l_WGTS_m;
|
||||
} else {
|
||||
znew_m = z_WGTS_end_m + 2*l_WGTS_m;
|
||||
}
|
||||
} else {
|
||||
double distance_m = 1/macroSigma_m;
|
||||
double distance_m = 1/macro_sigma_m;
|
||||
znew_m = zold_m + zDir*vForwardAbs_ms/vTotAbs_ms * distance_m;
|
||||
}
|
||||
return znew_m;
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
class eT2I_DissExc : public Excitation_Base {
|
||||
public:
|
||||
eT2I_DissExc(Population_Base *T2IPopulation, UniRNG *rngUni, DCS_Base *dcs_gen) : Excitation_Base(T2IPopulation, rngUni, Janev_eT2I_DissExc::get_deltaE_eV(), dcs_gen) {}
|
||||
eT2I_DissExc(Population_Base *T2IPopulation, UniRNG *rngUni, DCS_Base *dcs_gen) : Excitation_Base(T2IPopulation, rngUni, me_eV, Janev_eT2I_DissExc::get_deltaE_eV(), dcs_gen) {}
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {return Janev_eT2I_DissExc::get_TCS(E_eV);}
|
||||
double get_microSigma_m2(const double &E_eV) {return Janev_eT2I_DissExc::get_TCS(E_eV);}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
#include "sub_interaction_base.h"
|
||||
#include "janev_eT2I_recombination.h"
|
||||
|
||||
class eT2I_Recombination : public e_thermal_Interaction_Base {
|
||||
class eT2I_Recombination : public e_thermal_Precomputed_Interaction_Base {
|
||||
public:
|
||||
eT2I_Recombination(Population_Base *T2IPopulation, UniRNG *rngUni) : e_thermal_Interaction_Base(T2IPopulation, rngUni) {}
|
||||
eT2I_Recombination(Population_Base *T2IPopulation, UniRNG *rngUni) : e_thermal_Precomputed_Interaction_Base(T2IPopulation, rngUni, me_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
}
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return Janev_eT2I_Recombination::get_TCS(E_eV);
|
||||
}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#define eT2_elastic_h
|
||||
|
||||
#include "sub_interaction_base.h"
|
||||
#include "precomputed_interaction_base.h"
|
||||
#include "uehara_eT2_elastic.hpp"
|
||||
#include "tcs_container.hpp"
|
||||
#include "dcs_theta_container.hpp"
|
||||
@@ -17,19 +18,20 @@
|
||||
#include "dcs_base.h"
|
||||
|
||||
|
||||
class eT2_Elastic : public e_thermal_Interaction_Base {
|
||||
class eT2_Elastic : public e_thermal_Precomputed_Interaction_Base {
|
||||
TCS_Container tcs_data;
|
||||
DCS_Base *dcs_gen;
|
||||
Elastic_Kinematic_Base kinematics;
|
||||
|
||||
public:
|
||||
eT2_Elastic(Population_Base *T2Population, UniRNG *rngUni, DCS_Base *dcs_gen) : e_thermal_Interaction_Base(T2Population, rngUni),
|
||||
eT2_Elastic(Population_Base *T2Population, UniRNG *rngUni, DCS_Base *dcs_gen) : e_thermal_Precomputed_Interaction_Base(T2Population, rngUni, me_eV),
|
||||
tcs_data(scale_start, scale_end, 1e3, get_data_path() + "eT2_ela_TCS.dat"),
|
||||
kinematics(me_eV, 2*mT_eV) {
|
||||
this->dcs_gen = dcs_gen;
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
}
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {return tcs_data.get_value(E_eV);}
|
||||
double get_microSigma_m2(const double &E_eV) {return tcs_data.get_value(E_eV);}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
class eT2_ElExc_Nu_Analytic : public Excitation_Base {
|
||||
Janev_eT2_ElExc_Nu janev_Nu;
|
||||
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) {};
|
||||
eT2_ElExc_Nu_Analytic(Population_Base *T2Population, UniRNG *rngUni, Janev_eT2_ElExc_Nu janev_Nu_in, DCS_Base *dcs_gen) : Excitation_Base(T2Population, rngUni, me_eV, janev_Nu_in.get_deltaE_eV(), dcs_gen), janev_Nu(janev_Nu_in) {};
|
||||
|
||||
private:
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return janev_Nu.get_TCS_m2(E_eV);
|
||||
}
|
||||
};
|
||||
@@ -26,10 +26,10 @@ private:
|
||||
class eT2_ElExc_Ng_Analytic : public Excitation_Base {
|
||||
Janev_eT2_ElExc_Ng janev_Ng;
|
||||
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) {};
|
||||
eT2_ElExc_Ng_Analytic(Population_Base *T2Population, UniRNG *rngUni, Janev_eT2_ElExc_Ng janev_Ng_in, DCS_Base *dcs_gen) : Excitation_Base(T2Population, rngUni, me_eV, janev_Ng_in.get_deltaE_eV(), dcs_gen), janev_Ng(janev_Ng_in) {};
|
||||
|
||||
private:
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return janev_Ng.get_TCS_m2(E_eV);
|
||||
}
|
||||
};
|
||||
@@ -38,10 +38,10 @@ private:
|
||||
class eT2_ElExc_n_Analytic : public Excitation_Base {
|
||||
Janev_eT2_ElExc_n janev_n;
|
||||
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) {};
|
||||
eT2_ElExc_n_Analytic(Population_Base *T2Population, UniRNG *rngUni, Janev_eT2_ElExc_n janev_n_in, DCS_Base *dcs_gen) : Excitation_Base(T2Population, rngUni, me_eV, janev_n_in.get_deltaE_eV(), dcs_gen), janev_n(janev_n_in) {};
|
||||
|
||||
private:
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return janev_n.get_TCS_m2(E_eV);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,12 +22,19 @@
|
||||
class eT2_Ionization_Base : public e_thermal_Interaction_Base {
|
||||
double deltaE_eV;
|
||||
public:
|
||||
eT2_Ionization_Base(Population_Base *T2Population, UniRNG *rngUni, double deltaE_eV) : e_thermal_Interaction_Base(T2Population, rngUni){
|
||||
eT2_Ionization_Base(Population_Base *T2Population, UniRNG *rngUni, double deltaE_eV) : e_thermal_Interaction_Base(T2Population, rngUni, me_eV){
|
||||
this->deltaE_eV = deltaE_eV;
|
||||
};
|
||||
double get_macro_sigma_m(const Particle &interPart) {
|
||||
if (interPart.get_E_eV() < deltaE_eV) {
|
||||
return 0;
|
||||
} else {
|
||||
return e_thermal_Interaction_Base::get_macro_sigma_m(interPart);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
virtual double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) = 0;
|
||||
virtual double get_microSigma_m2(const double &E_eV) = 0;
|
||||
public:
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
protected:
|
||||
@@ -121,9 +128,6 @@ class eT2_Ionization_BED_Base : public eT2_Ionization_Base {
|
||||
public:
|
||||
eT2_Ionization_BED_Base(Population_Base *T2Population, UniRNG *rngUni) : eT2_Ionization_Base(T2Population, rngUni, EionT2_eV){};
|
||||
|
||||
protected:
|
||||
//virtual double get_microSigma_m2(const double &T_eV) = 0;
|
||||
|
||||
protected:
|
||||
void add_Tritiums(InteractionOut *InterOut, const Particle &interPart) {
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
@@ -139,7 +143,7 @@ public:
|
||||
eT2_Ionization_BED_Analytic(Population_Base *T2Population, UniRNG *rngUni) : eT2_Ionization_BED_Base(T2Population, rngUni) {};
|
||||
|
||||
protected:
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return BED_eT2_Ionization::calc_TCS(E_eV);
|
||||
}
|
||||
double roll_ionW_eV(const double &T_eV) {
|
||||
@@ -170,7 +174,7 @@ public:
|
||||
{};
|
||||
|
||||
protected:
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return tcs_data.get_value(E_eV);
|
||||
}
|
||||
double roll_ionW_eV(const double &T_eV) {
|
||||
@@ -187,7 +191,7 @@ public:
|
||||
eT2_Ionization_Janev_ndiss(Population_Base *T2Population, UniRNG *rngUni) : eT2_Ionization_Base(T2Population, rngUni, Janev_eT2_Ionization_ndiss::get_deltaE_eV()), dcs_data(Janev_eT2_Ionization_ndiss::get_deltaE_eV(), scale_end, 100, 50, (get_data_path() + "eT2_ion_DCS.dat")) {};
|
||||
|
||||
protected:
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return Janev_eT2_Ionization_ndiss::get_TCS_m2(E_eV);
|
||||
}
|
||||
|
||||
@@ -211,7 +215,7 @@ public:
|
||||
eT2_Ionization_Janev_diss_g(Population_Base *T2Population, UniRNG *rngUni) : eT2_Ionization_Base(T2Population, rngUni, Janev_eT2_Ionization_diss_g::get_deltaE_eV()), dcs_data(Janev_eT2_Ionization_diss_g::get_deltaE_eV(), scale_end, 100, 50, (get_data_path() + "eT2_ion_DCS.dat")) {};
|
||||
|
||||
protected:
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return Janev_eT2_Ionization_diss_g::get_TCS_m2(E_eV);
|
||||
}
|
||||
|
||||
@@ -240,7 +244,7 @@ public:
|
||||
eT2_Ionization_Janev_diss_u(Population_Base *T2Population, UniRNG *rngUni) : eT2_Ionization_Base(T2Population, rngUni, Janev_eT2_Ionization_diss_u::get_deltaE_eV()), dcs_data(Janev_eT2_Ionization_diss_u::get_deltaE_eV(), scale_end, 100, 50, (get_data_path() + "eT2_ion_DCS.dat")) {};
|
||||
|
||||
protected:
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return Janev_eT2_Ionization_diss_u::get_TCS_m2(E_eV);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ class eT2_VibExc01 : public Excitation_Base {
|
||||
Janev_eT2_VibExc calculator;
|
||||
public:
|
||||
eT2_VibExc01(Population_Base *T2Population, UniRNG *rngUni, DCS_Base *dcs_gen) : calculator(1),
|
||||
Excitation_Base(T2Population, rngUni, 0.516, dcs_gen) {};
|
||||
Excitation_Base(T2Population, rngUni, me_eV, 0.516, dcs_gen) {};
|
||||
|
||||
private:
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return calculator.get_TCS(E_eV);
|
||||
}
|
||||
};
|
||||
@@ -29,10 +29,10 @@ class eT2_VibExc02 : public Excitation_Base {
|
||||
Janev_eT2_VibExc calculator;
|
||||
public:
|
||||
eT2_VibExc02(Population_Base *T2Population, UniRNG *rngUni, DCS_Base *dcs_gen) : calculator(2),
|
||||
Excitation_Base(T2Population, rngUni, 1.003, dcs_gen) {};
|
||||
Excitation_Base(T2Population, rngUni, me_eV, 1.003, dcs_gen) {};
|
||||
|
||||
private:
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return calculator.get_TCS(E_eV);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
class eT3I_DissExc : public Excitation_Base {
|
||||
public:
|
||||
eT3I_DissExc(Population_Base *T3IPopulation, UniRNG *rngUni, DCS_Base *dcs_gen) : Excitation_Base(T3IPopulation, rngUni, Janev_eT3I_DissExc::get_deltaE_eV(), dcs_gen) {}
|
||||
eT3I_DissExc(Population_Base *T3IPopulation, UniRNG *rngUni, DCS_Base *dcs_gen) : Excitation_Base(T3IPopulation, rngUni, me_eV, Janev_eT3I_DissExc::get_deltaE_eV(), dcs_gen) {}
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {return Janev_eT3I_DissExc::get_TCS(E_eV);}
|
||||
double get_microSigma_m2(const double &E_eV) {return Janev_eT3I_DissExc::get_TCS(E_eV);}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
#include "sub_interaction_base.h"
|
||||
#include "janev_eT3I_recombination.h"
|
||||
|
||||
class eT3I_Recombination : public e_thermal_Interaction_Base {
|
||||
class eT3I_Recombination : public e_thermal_Precomputed_Interaction_Base {
|
||||
public:
|
||||
eT3I_Recombination(Population_Base *T3IPopulation, UniRNG *rngUni) : e_thermal_Interaction_Base(T3IPopulation, rngUni) {}
|
||||
eT3I_Recombination(Population_Base *T3IPopulation, UniRNG *rngUni) : e_thermal_Precomputed_Interaction_Base(T3IPopulation, rngUni, me_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
}
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {return Janev_eT3I_Recombination::get_TCS(E_eV);}
|
||||
double get_microSigma_m2(const double &E_eV) {return Janev_eT3I_Recombination::get_TCS(E_eV);}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
};
|
||||
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
#include "sub_interaction_base.h"
|
||||
#include "petterson_eT5I_recombination.h"
|
||||
|
||||
class eT5I_Recombination : public e_thermal_Interaction_Base {
|
||||
class eT5I_Recombination : public e_thermal_Precomputed_Interaction_Base {
|
||||
public:
|
||||
eT5I_Recombination(Population_Base *T5IPopulation, UniRNG *rngUni) : e_thermal_Interaction_Base(T5IPopulation, rngUni) {}
|
||||
eT5I_Recombination(Population_Base *T5IPopulation, UniRNG *rngUni) : e_thermal_Precomputed_Interaction_Base(T5IPopulation, rngUni, me_eV) {
|
||||
calc_values(); // need to call here, because, constructor can't call pure virtual function
|
||||
}
|
||||
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
return Pettersson_eT5I_Recombination::get_TCS(E_eV);
|
||||
}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
|
||||
@@ -17,14 +17,14 @@ class E_Mover_E_Drift : public E_Mover_Drift {
|
||||
public:
|
||||
E_Mover_E_Drift(Particle_Logger_Base *Logger, Population_Base *Population) : E_Mover_Drift(Logger, Population) {};
|
||||
protected:
|
||||
void do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯oSigma_m);
|
||||
void do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯o_sigma_m);
|
||||
};
|
||||
|
||||
inline void E_Mover_E_Drift::do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯oSigma_m) {
|
||||
if (macroSigma_m <= 0) {
|
||||
inline void E_Mover_E_Drift::do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯o_sigma_m) {
|
||||
if (macro_sigma_m <= 0) {
|
||||
return;
|
||||
}
|
||||
double t_s = 1/macroSigma_m/calc_vec3_abs(movePart->get_v_ms());
|
||||
double t_s = 1/macro_sigma_m/calc_vec3_abs(movePart->get_v_ms());
|
||||
vec3 newLoc_m = movePart->get_x_m();
|
||||
vec3 E_Vm = 0.5 * (Katrin_Fields::getElField_Vm(oldLoc_m) + Katrin_Fields::getElField_Vm(newLoc_m));
|
||||
double B_T = calc_vec3_abs( 0.5 * (Katrin_Fields::getMagField_T(oldLoc_m) + Katrin_Fields::getMagField_T(newLoc_m)) );
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
this->dt_s = dt_s;
|
||||
};
|
||||
|
||||
void move(Particle *movePart, const double ¯oSigma_m);
|
||||
void move(Particle *movePart, const double ¯o_sigma_m);
|
||||
|
||||
private:
|
||||
double doBoris_singleStep_m(Particle *movePart, const vec3 &E_Vm , const vec3 &B_T);
|
||||
@@ -28,18 +28,18 @@ private:
|
||||
void doBoris_LogzDirChange(Particle *movePart, double *oldzDir, vec3 *oldLoc_m);
|
||||
};
|
||||
|
||||
void E_Mover_Boris::move(Particle *movePart, const double ¯oSigma_m) {
|
||||
void E_Mover_Boris::move(Particle *movePart, const double ¯o_sigma_m) {
|
||||
// Prepare detection for change of z direction for logging
|
||||
double oldzDir = movePart->get_v_ms()[2] < 0 ? -1 : 1;
|
||||
vec3 oldLoc_m = movePart->get_x_m();
|
||||
|
||||
if (macroSigma_m == 0) { // If infinite movement distance let electron leave at only exit... Prob extremly faulty, but also impossible.
|
||||
if (macro_sigma_m == 0) { // If infinite movement distance let electron leave at only exit... Prob extremly faulty, but also impossible.
|
||||
movePart->set_x_m(z_RW_m);
|
||||
Logger->log(*movePart,oldLoc_m);
|
||||
return;
|
||||
}
|
||||
|
||||
double distance_m = 1/macroSigma_m;
|
||||
double distance_m = 1/macro_sigma_m;
|
||||
|
||||
double traveledDistance_m = 0;
|
||||
vec3 loc_m, E_Vm ,B_T;
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
E_Mover_Drift(Particle_Logger_Base *Logger, Population_Base *Population) : Drift_Base(electron, Logger, Population) {};
|
||||
protected:
|
||||
void doWallInteraction(Particle *movePart, vec3 *oldLoc_m, double *znew_m);
|
||||
void do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯oSigma_m);
|
||||
void do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯o_sigma_m);
|
||||
};
|
||||
|
||||
inline void E_Mover_Drift::doWallInteraction(Particle *movePart, vec3 *oldLoc_m, double *znew_m) {
|
||||
@@ -41,7 +41,7 @@ inline void E_Mover_Drift::doWallInteraction(Particle *movePart, vec3 *oldLoc_m,
|
||||
}
|
||||
}
|
||||
|
||||
inline void E_Mover_Drift::do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯oSigma_m) {
|
||||
inline void E_Mover_Drift::do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯o_sigma_m) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,19 @@ protected:
|
||||
double deltaE_eV;
|
||||
|
||||
public:
|
||||
Excitation_Base(Population_Base *Population, UniRNG *rngUni, double deltaE_eV, DCS_Base *dcs_gen) : e_thermal_Interaction_Base(Population, rngUni) {
|
||||
Excitation_Base(Population_Base *Population, UniRNG *rngUni, double m_eV, double deltaE_eV, DCS_Base *dcs_gen) : e_thermal_Interaction_Base(Population, rngUni, m_eV) {
|
||||
this->deltaE_eV = deltaE_eV;
|
||||
this->dcs_gen = dcs_gen;
|
||||
}
|
||||
|
||||
double get_macro_sigma_m(const Particle &interPart) {
|
||||
if (interPart.get_E_eV() < deltaE_eV) {
|
||||
return 0;
|
||||
} else {
|
||||
return e_thermal_Interaction_Base::get_macro_sigma_m(interPart);
|
||||
}
|
||||
}
|
||||
InteractionOut do_Interaction (Particle *interPart);
|
||||
private:
|
||||
//virtual double get_microSigma_m2(const double &Ekin_EV) = 0;
|
||||
};
|
||||
|
||||
inline InteractionOut Excitation_Base::do_Interaction (Particle *interPart) {
|
||||
@@ -46,11 +51,12 @@ inline InteractionOut Excitation_Base::do_Interaction (Particle *interPart) {
|
||||
class Exp_Excitation_Base : public Excitation_Base {
|
||||
TCS_Container tcs_data;
|
||||
public:
|
||||
Exp_Excitation_Base(Population_Base *T2Population, UniRNG *rngUni, double deltaE_eV, DCS_Base *dcs_gen, std::string load_file_name) : Excitation_Base(T2Population, rngUni, deltaE_eV, dcs_gen),
|
||||
Exp_Excitation_Base(Population_Base *T2Population, UniRNG *rngUni, double m_eV, double deltaE_eV, DCS_Base *dcs_gen, std::string load_file_name) : Excitation_Base(T2Population, rngUni, m_eV, deltaE_eV, dcs_gen),
|
||||
tcs_data(scale_start, scale_end, 1e3, get_data_path() + load_file_name) {};
|
||||
|
||||
|
||||
private:
|
||||
double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) {
|
||||
double get_microSigma_m2(const double &E_eV) {
|
||||
if (E_eV < deltaE_eV) {
|
||||
return 0;
|
||||
} else {
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
//
|
||||
// injector.cpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 13.04.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#include "read_system.h"
|
||||
|
||||
#include "injector.hpp"
|
||||
#include "katrin_geo.h"
|
||||
|
||||
const int Injector::injectionMethod = load_parameter("INJECTION");
|
||||
const double Injector::injectionEnergy_eV = load_parameter("INJ_E");
|
||||
|
||||
Particle Injector::injectElectron (const int &newId) {
|
||||
|
||||
double r_m = r_WGTS_m*sqrt(rngUni->random());
|
||||
double phi = rngUni->random()*2*pi;
|
||||
|
||||
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 E_eV;
|
||||
switch(injectionMethod) {
|
||||
case 0: // Fermi
|
||||
E_eV = roll_FermiEnergy_eV();
|
||||
break;
|
||||
case 1: //Delta
|
||||
E_eV = injectionEnergy_eV;
|
||||
break;
|
||||
case 2: //Maxwell Boltzman
|
||||
E_eV = roll_MBEnergy(injectionEnergy_eV/kb_eVK,me_eV, rngNormal);
|
||||
break;
|
||||
default:
|
||||
throw MyException("Katrin::injectElectron: Invalid Injection Method.");
|
||||
break;
|
||||
}
|
||||
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 v_ms = calc_v_ms_from_E_eV(pow(rngUni->random(),1./3.), me_eV);
|
||||
//double v_ms = -100;
|
||||
//return PartFac.create_e(vec3(0,0,z_WGTS_end_m), vec3(0,0,-v_ms),newId, newId);
|
||||
}
|
||||
|
||||
double Injector::roll_FermiEnergy_eV() {
|
||||
double pmax,E_min_eV, E_max_eV, Ecan_eV,eta1,eta2;
|
||||
pmax = 1.5e-28; // From Plotting EnergyDistributionBetaDecay
|
||||
E_min_eV = scale_start;
|
||||
E_max_eV = TritiumDecayEndpoint_eV;
|
||||
do {
|
||||
eta1 = rngUni->random();
|
||||
eta2 = rngUni->random();
|
||||
Ecan_eV = E_min_eV + eta1*(E_max_eV - E_min_eV);
|
||||
} while(eta2*pmax > get_FermiDecaySpectrumDensity(Ecan_eV));
|
||||
return Ecan_eV;
|
||||
}
|
||||
|
||||
double Injector::get_FermiDecaySpectrumDensity(const double &E_eV) {
|
||||
if (E_eV>TritiumDecayEndpoint_eV) {
|
||||
return 0;
|
||||
} else{
|
||||
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 &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));
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// injector.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 14.11.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef injector_h
|
||||
#define injector_h
|
||||
|
||||
#include "population_base.h"
|
||||
|
||||
#include <queue>
|
||||
#include "random_operations.h"
|
||||
|
||||
|
||||
class Injector : RNG_Base {
|
||||
int method;
|
||||
double energy_eV;
|
||||
int ions;
|
||||
Population_Base *T2Population;
|
||||
|
||||
Particle_Builder PartFac;
|
||||
|
||||
public:
|
||||
Injector() : RNG_Base(nullptr, nullptr) {};
|
||||
Injector(UniRNG *rngUni, NormalRNG *rngNormal, Population_Base *T2Population, int method, double energy_eV, int ions) : RNG_Base(rngUni, rngNormal){
|
||||
this->T2Population = T2Population;
|
||||
this->method = method;
|
||||
this->energy_eV = energy_eV;
|
||||
this->ions = ions;
|
||||
};
|
||||
|
||||
int inject (std::queue<Particle> *particle_queue, const int &last_ID);
|
||||
private:
|
||||
double roll_FermiEnergy_eV();
|
||||
double get_FermiDecaySpectrumDensity(const double &E_eV);
|
||||
double get_FermiFunction(const double &Z, const double &E_eV);
|
||||
};
|
||||
|
||||
inline int Injector::inject (std::queue<Particle> *particle_queue, const int &last_ID) {
|
||||
vec3 loc_m = T2Population->roll_x_ms();
|
||||
|
||||
double E_eV;
|
||||
switch(method) {
|
||||
case 0: // Fermi
|
||||
E_eV = roll_FermiEnergy_eV();
|
||||
break;
|
||||
case 1: //Delta
|
||||
E_eV = energy_eV;
|
||||
break;
|
||||
case 2: //Maxwell Boltzman
|
||||
E_eV = roll_MBEnergy(energy_eV/kb_eVK, me_eV, rngNormal);
|
||||
break;
|
||||
default:
|
||||
throw MyException("Katrin::injectElectron: Invalid Injection Method.");
|
||||
break;
|
||||
}
|
||||
vec3 v_ms = roll_uniform_direction(rngUni) * calc_v_ms_from_E_eV(E_eV,me_eV);
|
||||
particle_queue->push(PartFac.create_e(loc_m, v_ms, last_ID+1, last_ID+1));
|
||||
|
||||
if (ions == 0) {
|
||||
return 1;
|
||||
} else {
|
||||
vec3 vTI_ms = T2Population->roll_v_ms(loc_m);
|
||||
particle_queue->push(PartFac.create_T2I(loc_m, vTI_ms, last_ID+2, last_ID+2));
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline double Injector::roll_FermiEnergy_eV() {
|
||||
double pmax,E_min_eV, E_max_eV, Ecan_eV,eta1,eta2;
|
||||
pmax = 1.5e-28; // From Plotting EnergyDistributionBetaDecay
|
||||
E_min_eV = scale_start;
|
||||
E_max_eV = TritiumDecayEndpoint_eV;
|
||||
do {
|
||||
eta1 = rngUni->random();
|
||||
eta2 = rngUni->random();
|
||||
Ecan_eV = E_min_eV + eta1*(E_max_eV - E_min_eV);
|
||||
} while(eta2*pmax > get_FermiDecaySpectrumDensity(Ecan_eV));
|
||||
return Ecan_eV;
|
||||
}
|
||||
|
||||
inline double Injector::get_FermiDecaySpectrumDensity(const double &E_eV) {
|
||||
if (E_eV>TritiumDecayEndpoint_eV) {
|
||||
return 0;
|
||||
} else{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
inline 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));
|
||||
}
|
||||
|
||||
|
||||
#endif /* injector_h */
|
||||
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// injector.hpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 13.04.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef injector_hpp
|
||||
#define injector_hpp
|
||||
|
||||
#include "particle.hpp"
|
||||
|
||||
#include "random_operations.h"
|
||||
|
||||
|
||||
class Injector : RNG_Base {
|
||||
static const int injectionMethod;
|
||||
static const double injectionEnergy_eV;
|
||||
|
||||
Particle_Builder PartFac;
|
||||
|
||||
public:
|
||||
Injector() : RNG_Base(nullptr, nullptr) {};
|
||||
Injector(UniRNG *rngUni, NormalRNG *rngNormal) : RNG_Base(rngUni, rngNormal){};
|
||||
|
||||
Particle injectElectron (const int &newId);
|
||||
private:
|
||||
double roll_FermiEnergy_eV();
|
||||
double get_FermiDecaySpectrumDensity(const double &E_eV);
|
||||
double get_FermiFunction(const double &Z, const double &E_eV);
|
||||
};
|
||||
|
||||
|
||||
#endif /* injector_hpp */
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// injector_builder.cpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 14.11.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#include "injector_builder.hpp"
|
||||
|
||||
const int Injector_Builder::method = load_parameter("INJECTION");
|
||||
const double Injector_Builder::energy_eV = load_parameter("INJ_E");
|
||||
const int Injector_Builder::ions = load_parameter("INJ_TI");
|
||||
|
||||
Injector Injector_Builder::build(UniRNG *rngUni, NormalRNG *rngNormal, Population_Manager *populations) {
|
||||
Population_Base *T2Population = populations->find(tritium2);
|
||||
return Injector(rngUni, rngNormal, T2Population, method, energy_eV, ions);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// injector_builder.hpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 14.11.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef injector_builder_hpp
|
||||
#define injector_builder_hpp
|
||||
|
||||
#include "injector.h"
|
||||
#include "population_builder.hpp"
|
||||
|
||||
|
||||
class Injector_Builder {
|
||||
static const int method;
|
||||
static const double energy_eV;
|
||||
static const int ions;
|
||||
|
||||
public:
|
||||
Injector_Builder() {};
|
||||
|
||||
static Injector build(UniRNG *rngUni, NormalRNG *rngNormal, Population_Manager *populations);
|
||||
};
|
||||
#endif /* injector_builder_hpp */
|
||||
@@ -29,16 +29,16 @@ public:
|
||||
void add(Interaction_Base *addSubInteraction);
|
||||
|
||||
InteractionOut do_Interaction(Particle *interPart);
|
||||
double get_macroSigma_m(const Particle &interPart);
|
||||
double get_macro_sigma_m(const Particle &interPart);
|
||||
};
|
||||
|
||||
inline InteractionOut Interaction_Channel_Base::do_Interaction(Particle *interPart) {
|
||||
double macroSigma_m = get_macroSigma_m(*interPart);
|
||||
double macro_sigma_m = get_macro_sigma_m(*interPart);
|
||||
double currentStackedSigma = 0;
|
||||
double targetStackedSigma = rngUni->random() * macroSigma_m;
|
||||
double targetStackedSigma = rngUni->random() * macro_sigma_m;
|
||||
|
||||
for (int i = 0; i < numSubInteractions; i++) {
|
||||
currentStackedSigma += SubInteractions[i]->get_macroSigma_m(*interPart);
|
||||
currentStackedSigma += SubInteractions[i]->get_macro_sigma_m(*interPart);
|
||||
if (currentStackedSigma >= targetStackedSigma) {
|
||||
return SubInteractions[i]->do_Interaction(interPart);
|
||||
}
|
||||
@@ -49,12 +49,12 @@ inline InteractionOut Interaction_Channel_Base::do_Interaction(Particle *interPa
|
||||
}
|
||||
|
||||
|
||||
inline double Interaction_Channel_Base::get_macroSigma_m(const Particle &interPart) {
|
||||
double macroSigma_m = 0;
|
||||
inline double Interaction_Channel_Base::get_macro_sigma_m(const Particle &interPart) {
|
||||
double macro_sigma_m = 0;
|
||||
for (int i = 0; i < numSubInteractions; i++) {
|
||||
macroSigma_m += SubInteractions[i]->get_macroSigma_m(interPart);
|
||||
macro_sigma_m += SubInteractions[i]->get_macro_sigma_m(interPart);
|
||||
}
|
||||
return macroSigma_m;
|
||||
return macro_sigma_m;
|
||||
}
|
||||
|
||||
inline void Interaction_Channel_Base::add(Interaction_Base *addSubInteraction) {
|
||||
|
||||
@@ -93,7 +93,7 @@ Interaction_Channel_Base* Interaction_Builder::build_electron(Population_Manager
|
||||
|
||||
|
||||
if (load_parameter("eT2_ROT") == 2) {
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, 4.41e-4, exc_dcs, "rot_exc_j02.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, me_eV, 4.41e-4, exc_dcs, "rot_exc_j02.dat"));
|
||||
} else if (load_parameter("eT2_ROT") != 0) {
|
||||
throw MyException ("eT2_ROT invalid.");
|
||||
}
|
||||
@@ -102,7 +102,7 @@ Interaction_Channel_Base* Interaction_Builder::build_electron(Population_Manager
|
||||
eInteraction->add(new eT2_VibExc01(T2Population, rngUni, exc_dcs));
|
||||
eInteraction->add(new eT2_VibExc02(T2Population, rngUni, exc_dcs));
|
||||
} else if (load_parameter("eT2_VIB") == 2) {
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, 0.516, exc_dcs, "vib_exc_v01.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, me_eV, 0.516, exc_dcs, "vib_exc_v01.dat"));
|
||||
} else if (load_parameter("eT2_VIB") != 0) {
|
||||
throw MyException ("eT2_VIB invalid.");
|
||||
}
|
||||
@@ -151,13 +151,13 @@ void Interaction_Builder::build_e_el_janev(Interaction_Channel_Base* eInteractio
|
||||
}
|
||||
|
||||
void Interaction_Builder::build_e_el_exp(Interaction_Channel_Base* eInteraction, UniRNG *rngUni, Population_Base *T2Population, DCS_Base *exc_dcs) {
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, 8.48, exc_dcs, "el_exc_b3sigpu.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, 11.18, exc_dcs, "el_exc_B1sigpu.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, 11.76, exc_dcs, "el_exc_c3piu.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, 11.79, exc_dcs, "el_exc_a3sigpg.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, 12.29, exc_dcs, "el_exc_C1piu.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, 12.3, exc_dcs, "el_exc_EF1sigpg.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, 13.23, exc_dcs, "el_exc_e3sigpu.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, me_eV, 8.48, exc_dcs, "el_exc_b3sigpu.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, me_eV, 11.18, exc_dcs, "el_exc_B1sigpu.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, me_eV, 11.76, exc_dcs, "el_exc_c3piu.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, me_eV, 11.79, exc_dcs, "el_exc_a3sigpg.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, me_eV, 12.29, exc_dcs, "el_exc_C1piu.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, me_eV, 12.3, exc_dcs, "el_exc_EF1sigpg.dat"));
|
||||
eInteraction->add(new Exp_Excitation_Base(T2Population, rngUni, me_eV, 13.23, exc_dcs, "el_exc_e3sigpu.dat"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#define katrin_fields_hpp
|
||||
|
||||
#include "error_types.h"
|
||||
#include "katrin_geo.h"
|
||||
#include "read_system.h"
|
||||
#include "vec3_container.hpp"
|
||||
|
||||
@@ -23,20 +22,10 @@ public:
|
||||
Katrin_Fields() {};
|
||||
|
||||
static vec3 getMagField_T(vec3 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) {
|
||||
if (!in_Katrin(loc_m)) {
|
||||
std::stringstream ss;
|
||||
ss<<"Katrin_Fields::getElField_Vm: loc_m outside of Katrin.\n";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
return e_field.get_data (loc_m);
|
||||
//return vec3(0,0,0);
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// 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 */
|
||||
@@ -10,8 +10,6 @@
|
||||
#define energetic_base_h
|
||||
|
||||
|
||||
#include "katrin_geo.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "population_container.hpp"
|
||||
@@ -34,6 +32,7 @@ public:
|
||||
Content get_density_m3(const int &E_bin, const Bins &loc_bins);
|
||||
Sum_bounds get_sumation_bounds(const vec3 &loc_m);
|
||||
|
||||
vec3 roll_x_ms() {throw MyException ("Not yet implemented as not needed at this point.");}
|
||||
vec3 roll_v_ms (const vec3 &loc_m);
|
||||
vec3 get_drift_v_ms(const vec3 &loc_m) {return vec3(0,0,0);} // Dummy as integration is made over energy mids
|
||||
double get_thermal_v_ms() {return 0;} // Dummy as integration is made over energy mids
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
int get_number_bins();
|
||||
|
||||
int calc_index(const double &x);
|
||||
bool in_scale(const double &x);
|
||||
double get_lower_bin_bound(const int &index);
|
||||
double get_bin_mid(const int &index);
|
||||
double get_upper_bin_bound(const int &index);
|
||||
@@ -75,6 +76,10 @@ inline int Lin_Scale::calc_index(const double &x) {
|
||||
return std::ceil((x-min_x)/delta_x) - 1;
|
||||
}
|
||||
|
||||
inline bool Lin_Scale::in_scale(const double &x) {
|
||||
return (x >= min_x) && (x <= max_x);
|
||||
}
|
||||
|
||||
inline double Lin_Scale::get_lower_bin_bound(const int &index) {
|
||||
return min_x + double(index) * delta_x;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
int get_number_bins();
|
||||
|
||||
int calc_index(const double &x);
|
||||
bool in_scale(const double &x);
|
||||
double get_lower_bin_bound(const int &index);
|
||||
double get_bin_mid(const int &index);
|
||||
double get_upper_bin_bound(const int &index);
|
||||
@@ -52,6 +53,11 @@ inline int Log_Scale::calc_index(const double &x) {
|
||||
return lin_scale.calc_index(p);
|
||||
}
|
||||
|
||||
inline bool Log_Scale::in_scale(const double &x) {
|
||||
double p = std::log10(x);
|
||||
return lin_scale.in_scale(p);
|
||||
}
|
||||
|
||||
inline double Log_Scale::get_lower_bin_bound(const int &index) {
|
||||
double p = lin_scale.get_lower_bin_bound(index);
|
||||
return pow(10,p);
|
||||
|
||||
@@ -4,7 +4,7 @@ OBJS := particle_looper.o \
|
||||
tcs_container.o dcs_theta_container.o dcs_ionization_container.o \
|
||||
population_container.o velocity_container.o vec3_container.o \
|
||||
thermalPop_container.o energeticPop_container.o \
|
||||
particle.o injector.o timer.o katrin_fields.o \
|
||||
particle.o injector_builder.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 \
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#define mover_base_h
|
||||
|
||||
#include "process_base.h"
|
||||
#include "katrin_geo.h"
|
||||
#include "katrin_fields.hpp"
|
||||
#include "particle.hpp"
|
||||
|
||||
@@ -29,7 +28,7 @@ public:
|
||||
this->Population = Population;
|
||||
}
|
||||
|
||||
virtual void move(Particle *movePart, const double ¯oSigma_m) = 0;
|
||||
virtual void move(Particle *movePart, const double ¯o_sigma_m) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -15,16 +15,16 @@ class Neutral_Mover : public Mover_Base {
|
||||
public:
|
||||
Neutral_Mover(species this_species, Particle_Logger_Base *Logger, Population_Base *Population) : Mover_Base(this_species, Logger, Population) {};
|
||||
|
||||
void move(Particle *movePart, const double ¯oSigma_m);
|
||||
void move(Particle *movePart, const double ¯o_sigma_m);
|
||||
private:
|
||||
void wall_correction(vec3 *newLoc_m, const vec3 &oldLoc_m);
|
||||
};
|
||||
|
||||
inline void Neutral_Mover::move(Particle *movePart, const double ¯oSigma_m) {
|
||||
inline void Neutral_Mover::move(Particle *movePart, const double ¯o_sigma_m) {
|
||||
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_m <= 0) ? 1e3 : 1/macroSigma_m; //sloppy trick to "leave" wgts
|
||||
double distance = (macro_sigma_m <= 0) ? 1e3 : 1/macro_sigma_m; //sloppy trick to "leave" wgts
|
||||
|
||||
vec3 newLoc_m = oldLoc_m + distance * move_direction;
|
||||
wall_correction(&newLoc_m, oldLoc_m);
|
||||
@@ -35,18 +35,16 @@ inline void Neutral_Mover::move(Particle *movePart, const double ¯oSigma_m)
|
||||
}
|
||||
|
||||
inline void Neutral_Mover::wall_correction(vec3 *newLoc_m, const vec3 &oldLoc_m) {
|
||||
if (!in_Katrin(*newLoc_m)) {
|
||||
if (*newLoc_m[2] < z_RW_m) {
|
||||
newLoc_m[2] = z_RW_m;
|
||||
}
|
||||
if (*newLoc_m[2] > z_WGTS_end_m) {
|
||||
newLoc_m[2] = z_WGTS_end_m;
|
||||
}
|
||||
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);
|
||||
}
|
||||
if (*newLoc_m[2] < z_RW_m) {
|
||||
newLoc_m[2] = z_RW_m;
|
||||
}
|
||||
if (*newLoc_m[2] > z_WGTS_end_m) {
|
||||
newLoc_m[2] = z_WGTS_end_m;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ void Particle_Looper::init_managers() {
|
||||
part_loggers = Particle_Logger_Builder::build(&h5f);
|
||||
populations = Population_Builder::build(&timer, &rngUni, &rngNormal);
|
||||
|
||||
injector = Injector(&rngUni, &rngNormal);
|
||||
injector = Injector_Builder::build(&rngUni, &rngNormal, &populations);
|
||||
movers = Mover_Builder::build(&part_loggers, &populations);
|
||||
interactions = Interaction_Builder::build(&populations, &rngUni);
|
||||
terminators = Terminator_Builder::build();
|
||||
@@ -30,9 +30,10 @@ void Particle_Looper::do_loops(int target_decays) {
|
||||
int number_decays = 0;
|
||||
while ( (number_decays < target_decays) || (!particle_queue.empty()) ) {
|
||||
if (particle_queue.empty()) {
|
||||
particle_queue.push(injector.injectElectron(get_new_id()));
|
||||
number_decays++;
|
||||
local_decays++;
|
||||
int num_new = injector.inject(&particle_queue, get_last_id());
|
||||
number_decays = number_decays + 1;
|
||||
local_decays = local_decays + 1;
|
||||
ID_counter = ID_counter + num_new;
|
||||
}
|
||||
process_first(&particle_queue);
|
||||
}
|
||||
@@ -46,12 +47,13 @@ void Particle_Looper::process_first(std::queue<Particle> *particle_queue) {
|
||||
Terminator_Base *terminatorPtr = terminators.find(curPart.get_species());
|
||||
|
||||
InteractionOut IntOut;
|
||||
double macroSigma_m;
|
||||
double macro_sigma_m;
|
||||
vec3 oldLoc_m;
|
||||
while (!terminatorPtr->check_terminlization(curPart)) {
|
||||
oldLoc_m = curPart.get_x_m();
|
||||
macroSigma_m = interactionPtr->get_macroSigma_m(curPart);
|
||||
moverPtr->move(&curPart, macroSigma_m);
|
||||
macro_sigma_m = interactionPtr->get_macro_sigma_m(curPart);
|
||||
|
||||
moverPtr->move(&curPart, macro_sigma_m);
|
||||
if (terminatorPtr->check_terminlization(curPart)) {
|
||||
break; // Don't double check terminlization, else n_double.
|
||||
} else {
|
||||
@@ -70,8 +72,12 @@ void Particle_Looper::process_first(std::queue<Particle> *particle_queue) {
|
||||
}
|
||||
|
||||
long int Particle_Looper::get_new_id() {
|
||||
long int res = ID_offset + ID_counter;
|
||||
ID_counter++;
|
||||
return ID_offset + ID_counter;
|
||||
}
|
||||
|
||||
long int Particle_Looper::get_last_id() {
|
||||
long int res = ID_offset + ID_counter;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "logger_builder.hpp"
|
||||
#include "population_builder.hpp"
|
||||
|
||||
#include "injector.hpp"
|
||||
#include "injector_builder.hpp"
|
||||
#include "mover_builder.hpp"
|
||||
#include "interaction_builder.hpp"
|
||||
#include "terminator_builder.hpp"
|
||||
@@ -69,6 +69,7 @@ public:
|
||||
private:
|
||||
void process_first(std::queue<Particle> *particle_queue);
|
||||
long int get_new_id();
|
||||
long int get_last_id();
|
||||
|
||||
public:
|
||||
void do_logging_off_loops(int target_decays);
|
||||
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
virtual Sum_bounds get_sumation_bounds(const vec3 &loc_m) = 0;
|
||||
double get_m_eV() {return m_eV;}
|
||||
|
||||
virtual vec3 roll_x_ms() = 0;
|
||||
virtual vec3 roll_v_ms (const vec3 &loc_m) = 0;
|
||||
virtual vec3 get_drift_v_ms(const vec3 &loc_m) = 0;
|
||||
virtual double get_thermal_v_ms() = 0;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "log_scale.h"
|
||||
#include "random_operations.h"
|
||||
#include "katrin_geo.h"
|
||||
|
||||
|
||||
struct Bins {
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#define positive_terminator_h
|
||||
|
||||
#include "terminator_base.h"
|
||||
#include "katrin_geo.h"
|
||||
|
||||
class PosNeu_Terminator : public Terminator_Base {
|
||||
public:
|
||||
|
||||
@@ -16,15 +16,15 @@ public:
|
||||
Positive_Mover_E_Drift(species this_species, Particle_Logger_Base *Logger, Population_Base *Population) : Positive_Mover_Drift(this_species, Logger, Population) {};
|
||||
|
||||
protected:
|
||||
void do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯oSigma_m);
|
||||
void do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯o_sigma_m);
|
||||
};
|
||||
|
||||
|
||||
inline void Positive_Mover_E_Drift::do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯oSigma_m) {
|
||||
if (macroSigma_m <= 0) {
|
||||
inline void Positive_Mover_E_Drift::do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯o_sigma_m) {
|
||||
if (macro_sigma_m <= 0) {
|
||||
return;
|
||||
}
|
||||
double t_s = 1/macroSigma_m/calc_vec3_abs(movePart->get_v_ms());
|
||||
double t_s = 1/macro_sigma_m/calc_vec3_abs(movePart->get_v_ms());
|
||||
vec3 newLoc_m = movePart->get_x_m();
|
||||
vec3 E_Vm = 0.5 * (Katrin_Fields::getElField_Vm(oldLoc_m) + Katrin_Fields::getElField_Vm(newLoc_m));
|
||||
double B_T = calc_vec3_abs( 0.5 * (Katrin_Fields::getMagField_T(oldLoc_m) + Katrin_Fields::getMagField_T(newLoc_m)) );
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
|
||||
protected:
|
||||
void doWallInteraction(Particle *movePart, vec3 *oldLoc_m, double *znew_m);
|
||||
void do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯oSigma_m);
|
||||
void do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯o_sigma_m);
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ inline void Positive_Mover_Drift::doWallInteraction(Particle *movePart, vec3 *ol
|
||||
}
|
||||
}
|
||||
|
||||
inline void Positive_Mover_Drift::do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯oSigma_m) {
|
||||
inline void Positive_Mover_Drift::do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯o_sigma_m) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
//
|
||||
// precomputed_interaction_base.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 15.11.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef precomputed_interaction_base_h
|
||||
#define precomputed_interaction_base_h
|
||||
|
||||
#include "sub_interaction_base.h"
|
||||
#include "log_scale.h"
|
||||
|
||||
|
||||
class e_thermal_Precomputed_Interaction_Base : public e_thermal_Interaction_Base { // Precomputed Interactions of electrons with thermal Populations
|
||||
Log_Scale E_scale; // E_scale for Interpolation calculation
|
||||
double *precomputed_values;
|
||||
|
||||
public:
|
||||
e_thermal_Precomputed_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : e_thermal_Interaction_Base(Population, rngUni, m_eV), E_scale(1e-6, 1e-1, 1e5) {
|
||||
precomputed_values = new double [E_scale.get_number_bins()];
|
||||
}
|
||||
void calc_values(); // must be called by derived class, can't call in this constructor, due to virtual pure
|
||||
double get_macro_sigma_m(const Particle &interPart);
|
||||
private:
|
||||
double lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
|
||||
};
|
||||
|
||||
inline void e_thermal_Precomputed_Interaction_Base::calc_values() {
|
||||
for (int i=0; i<E_scale.get_number_bins(); i++) {
|
||||
precomputed_values[i] = calc_microSigma_m2(E_scale.get_bin_mid(i));
|
||||
}
|
||||
}
|
||||
|
||||
inline double e_thermal_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
double v_ms = calc_vec3_abs(interPart.get_v_ms() - Population->get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur"
|
||||
double E_eV = m_eV/2*pow(v_ms/c_ms, 2); // Lab energy without thermal integration
|
||||
|
||||
if (E_scale.in_scale(E_eV)) {
|
||||
return lookup_macro_sigma_m(E_eV, loc_m);
|
||||
} else {
|
||||
return calc_macro_sigma_m(E_eV, loc_m);
|
||||
}
|
||||
}
|
||||
|
||||
inline double e_thermal_Precomputed_Interaction_Base::lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
||||
int i = E_scale.calc_index(E_eV);
|
||||
return precomputed_values[i] * Population->get_density_m3(loc_m);
|
||||
}
|
||||
|
||||
|
||||
class TI_thermal_binary_Precomputed_Interaction_Base : public TI_thermal_binary_Interaction_Base { // Precomputed Interactions of electrons with thermal Populations
|
||||
Log_Scale E_scale; // E_scale for Interpolation calculation
|
||||
double *precomputed_values;
|
||||
|
||||
public:
|
||||
TI_thermal_binary_Precomputed_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : TI_thermal_binary_Interaction_Base(Population, rngUni, m_eV), E_scale(1e-6, 1e-1, 1e5) {
|
||||
precomputed_values = new double [E_scale.get_number_bins()];
|
||||
}
|
||||
void calc_values(); // must be called by derived class, can't call in this constructor, due to virtual pure
|
||||
double get_macro_sigma_m(const Particle &interPart);
|
||||
private:
|
||||
double lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
|
||||
};
|
||||
|
||||
inline void TI_thermal_binary_Precomputed_Interaction_Base::calc_values() {
|
||||
for (int i=0; i<E_scale.get_number_bins(); i++) {
|
||||
precomputed_values[i] = calc_microSigma_m2(E_scale.get_bin_mid(i));
|
||||
}
|
||||
}
|
||||
|
||||
inline double TI_thermal_binary_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
double v_ms = calc_vec3_abs(interPart.get_v_ms() - Population->get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur"
|
||||
double E_eV = m_eV/2*pow(v_ms/c_ms, 2); // Lab energy without thermal integration
|
||||
|
||||
if (E_scale.in_scale(E_eV)) {
|
||||
return lookup_macro_sigma_m(E_eV, loc_m);
|
||||
} else {
|
||||
return calc_macro_sigma_m(E_eV, loc_m);
|
||||
}
|
||||
}
|
||||
|
||||
inline double TI_thermal_binary_Precomputed_Interaction_Base::lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
||||
int i = E_scale.calc_index(E_eV);
|
||||
return precomputed_values[i] * Population->get_density_m3(loc_m);
|
||||
}
|
||||
|
||||
|
||||
class TI_thermal_tenary_Precomputed_Interaction_Base : public TI_thermal_tenary_Interaction_Base { // Precomputed Interactions of electrons with thermal Populations
|
||||
Log_Scale E_scale; // E_scale for Interpolation calculation
|
||||
double *precomputed_values;
|
||||
|
||||
public:
|
||||
TI_thermal_tenary_Precomputed_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : TI_thermal_tenary_Interaction_Base(Population, rngUni, m_eV), E_scale(1e-6, 1e-1, 1e5) {
|
||||
precomputed_values = new double [E_scale.get_number_bins()];
|
||||
}
|
||||
void calc_values(); // must be called by derived class, can't call in this constructor, due to virtual pure
|
||||
double get_macro_sigma_m(const Particle &interPart);
|
||||
private:
|
||||
double lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
|
||||
};
|
||||
|
||||
inline void TI_thermal_tenary_Precomputed_Interaction_Base::calc_values() {
|
||||
for (int i=0; i<E_scale.get_number_bins(); i++) {
|
||||
precomputed_values[i] = calc_microSigma_divbyn_m2(E_scale.get_bin_mid(i));
|
||||
}
|
||||
}
|
||||
|
||||
inline double TI_thermal_tenary_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
double v_ms = calc_vec3_abs(interPart.get_v_ms() - Population->get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur"
|
||||
double E_eV = m_eV/2*pow(v_ms/c_ms, 2); // Lab energy without thermal integration
|
||||
|
||||
if (E_scale.in_scale(E_eV)) {
|
||||
return lookup_macro_sigma_m(E_eV, loc_m);
|
||||
} else {
|
||||
return calc_macro_sigma_m(E_eV, loc_m);
|
||||
}
|
||||
}
|
||||
|
||||
inline double TI_thermal_tenary_Precomputed_Interaction_Base::lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
||||
int i = E_scale.calc_index(E_eV);
|
||||
return precomputed_values[i] * pow(Population->get_density_m3(loc_m),2);
|
||||
}
|
||||
|
||||
class TI_e_Precomputed_Interaction_Base : public TI_e_Interaction_Base { // Precompute Interactions of ions with kinetic e Populations
|
||||
|
||||
Log_Scale E_scale; // E_scale for Interpolation calculation
|
||||
double **precomputed_values;
|
||||
|
||||
public:
|
||||
TI_e_Precomputed_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double mI_eV) : TI_e_Interaction_Base(Population, rngUni, mI_eV), E_scale(1e-6, 1e-1, 1e5) {
|
||||
precomputed_values = new double *[E_scale.get_number_bins()];
|
||||
for (int EI_bin=0; EI_bin<E_scale.get_number_bins(); EI_bin++) {
|
||||
precomputed_values[EI_bin] = new double[num_Ee_bins];
|
||||
}
|
||||
}
|
||||
void calc_values();
|
||||
double get_macro_sigma_m(const Particle &interPart);
|
||||
|
||||
private:
|
||||
double lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m);
|
||||
};
|
||||
|
||||
|
||||
inline void TI_e_Precomputed_Interaction_Base::calc_values() {
|
||||
for (int EI_bin=0; EI_bin<E_scale.get_number_bins(); EI_bin++) {
|
||||
for (int Ee_bin = 0; Ee_bin<num_Ee_bins; Ee_bin++) {
|
||||
precomputed_values[EI_bin][Ee_bin] = calc_microSigma_m2(E_scale.get_bin_mid(EI_bin), Ee_bin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline double TI_e_Precomputed_Interaction_Base::get_macro_sigma_m(const Particle &interPart) {
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
double E_eV = interPart.get_E_eV();
|
||||
|
||||
if (E_scale.in_scale(E_eV)) {
|
||||
return lookup_macro_sigma_m(E_eV, loc_m);
|
||||
} else {
|
||||
return calc_macro_sigma_m(E_eV, loc_m);
|
||||
}
|
||||
}
|
||||
|
||||
inline double TI_e_Precomputed_Interaction_Base::lookup_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
||||
int EI_bin = E_scale.calc_index(E_eV);
|
||||
double *microSigmas = precomputed_values[EI_bin];
|
||||
|
||||
Sum_bounds bounds = Population->get_sumation_bounds(loc_m);
|
||||
Content cont;
|
||||
|
||||
double macro_sigma_m = 0;
|
||||
for (int Ee_bin = 0; Ee_bin<num_Ee_bins; Ee_bin++) {
|
||||
cont = Population->get_density_m3(Ee_bin, bounds.loc_bins);
|
||||
macro_sigma_m += microSigmas[Ee_bin] * cont.n_m3;
|
||||
}
|
||||
return macro_sigma_m;
|
||||
}
|
||||
|
||||
#endif /* precomputed_interaction_base_h */
|
||||
@@ -50,46 +50,60 @@ public:
|
||||
this->Population = Population;
|
||||
this->rngUni = rngUni;
|
||||
};
|
||||
virtual double get_macroSigma_m(const Particle &interPart) = 0;
|
||||
virtual double get_macro_sigma_m(const Particle &interPart) = 0;
|
||||
virtual InteractionOut do_Interaction (Particle *interPart) = 0;
|
||||
};
|
||||
|
||||
class e_thermal_Interaction_Base : public Interaction_Base { // Interactions of electrons with thermal Populations
|
||||
double v_thermal_ms, v_limit_ms;
|
||||
protected:
|
||||
double E_limit;
|
||||
|
||||
double m_eV; // energy of kinetic particle for CS measurement : e-
|
||||
double mI_eV; // energy of massic initial particle : TI
|
||||
|
||||
double v_therm; // typical spped for thermal population
|
||||
|
||||
|
||||
public:
|
||||
e_thermal_Interaction_Base(Population_Base *Population, UniRNG *rngUni) : Interaction_Base(Population, rngUni) {
|
||||
e_thermal_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : Interaction_Base(Population, rngUni) {
|
||||
Sum_bounds bounds = Population->get_sumation_bounds(vec3(0,0,0));
|
||||
if (bounds.num_E_bins > 1) {
|
||||
throw MyException("Population is not thermal, when expected thermal.");
|
||||
}
|
||||
v_thermal_ms = Population->get_thermal_v_ms(); // Typical Speed of "Thermal Blur"
|
||||
v_limit_ms = v_thermal_ms * 2000;
|
||||
this->m_eV = m_eV;
|
||||
mI_eV = Population->get_m_eV();
|
||||
v_therm = Population->get_thermal_v_ms(); // Typical Speed of "Thermal Blur"
|
||||
E_limit = m_eV/2*pow(v_therm/c_ms * 2000, 2);
|
||||
}
|
||||
|
||||
double get_macroSigma_m(const Particle &interPart) {
|
||||
// Calulate average interaction cross section by integration over theta
|
||||
double get_macro_sigma_m(const Particle &interPart) {
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
double m_eV = interPart.get_m_eV();
|
||||
double v1_ms = calc_vec3_abs(interPart.get_v_ms() - Population->get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur"
|
||||
double micro_sigma;
|
||||
if (v1_ms > v_limit_ms) { // 0.005 represents 1% variation in energy
|
||||
double E_eV = m_eV/2 * pow(v1_ms/c_ms,2);
|
||||
micro_sigma = get_microSigma_m2(E_eV, loc_m);
|
||||
} else {
|
||||
auto integrand = [&](double theta) {
|
||||
double E_eV = m_eV/2 * (pow(v1_ms,2) + pow(v_thermal_ms,2) - 2*v1_ms*v_thermal_ms*cos(theta)) * pow(c_ms, -2);
|
||||
return get_microSigma_m2(E_eV, loc_m);
|
||||
};
|
||||
micro_sigma = integrate(integrand, 0., pi, 5, simpson());
|
||||
}
|
||||
return micro_sigma*Population->get_density_m3(loc_m);
|
||||
double v_ms = calc_vec3_abs(interPart.get_v_ms() - Population->get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur"
|
||||
double E_eV = m_eV/2*pow(v_ms/c_ms, 2); // Lab energy without thermal integration
|
||||
return calc_macro_sigma_m(E_eV, loc_m);
|
||||
}
|
||||
private:
|
||||
virtual double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) = 0;
|
||||
virtual double get_microSigma_m2(const double &E_eV) = 0;
|
||||
|
||||
protected:
|
||||
vec3 get_vOff_ms(const Particle &interPart, const double &minE_eV) { // Get energy after los
|
||||
double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
||||
return calc_microSigma_m2(E_eV)*Population->get_density_m3(loc_m);
|
||||
}
|
||||
|
||||
double calc_microSigma_m2(const double &E_eV) {
|
||||
if (E_eV > E_limit) { // 0.005 represents 1% variation in energy
|
||||
return get_microSigma_m2(E_eV);
|
||||
} else {
|
||||
double v1_ms = sqrt(2*E_eV/mI_eV)*c_ms;
|
||||
auto integrand = [&](double theta) {
|
||||
double E_eV = m_eV/2 * (pow(v1_ms,2) + pow(v_therm,2) - 2*v1_ms*v_therm*cos(theta)) * pow(c_ms, -2);
|
||||
return get_microSigma_m2(E_eV);
|
||||
};
|
||||
return integrate(integrand, 0., pi, 30, simpson());
|
||||
}
|
||||
}
|
||||
|
||||
vec3 get_vOff_ms(const Particle &interPart, const double &minE_eV) { // Implemented for derived classes
|
||||
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());
|
||||
@@ -108,176 +122,150 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
class TI_thermal_Interaction_Base : public Interaction_Base { // Interactions of ions with thermal Populations
|
||||
double v_thermal_ms;
|
||||
class TI_thermal_binary_Interaction_Base : public Interaction_Base { // Interactions of electrons with thermal Populations
|
||||
protected:
|
||||
double m_eV; // energy of kinetic particle for CS measurement : TI
|
||||
double m2_eV; // energy of massic initial particle : T2
|
||||
double v_therm; // typical spped for thermal population
|
||||
|
||||
public:
|
||||
TI_thermal_Interaction_Base(Population_Base *Population, UniRNG *rngUni) : Interaction_Base(Population, rngUni) {
|
||||
TI_thermal_binary_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : Interaction_Base(Population, rngUni) {
|
||||
Sum_bounds bounds = Population->get_sumation_bounds(vec3(0,0,0));
|
||||
if (bounds.num_E_bins > 1) {
|
||||
throw MyException("Population is not thermal, when expected thermal.");
|
||||
}
|
||||
v_thermal_ms = Population->get_thermal_v_ms(); // Typical Speed of "Thermal Blur"
|
||||
this->m_eV = m_eV;
|
||||
m2_eV = Population->get_m_eV();
|
||||
v_therm = Population->get_thermal_v_ms(); // Typical Speed of "Thermal Blur"
|
||||
}
|
||||
|
||||
double get_macroSigma_m(const Particle &interPart) {
|
||||
// Calulate average interaction cross section by integration over theta
|
||||
double get_macro_sigma_m(const Particle &interPart) {
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
double m_eV = interPart.get_m_eV();
|
||||
double v1_ms = calc_vec3_abs(interPart.get_v_ms() - Population->get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur"
|
||||
auto integrand = [&](double theta) {
|
||||
double E_eV = m_eV/2 * (pow(v1_ms,2) + pow(v_thermal_ms,2) - 2*v1_ms*v_thermal_ms*cos(theta)) * pow(c_ms, -2);
|
||||
return get_microSigma_m2(E_eV, loc_m);
|
||||
};
|
||||
double micro_sigma = integrate(integrand, 0., pi, 5, simpson());
|
||||
|
||||
return micro_sigma*Population->get_density_m3(loc_m);
|
||||
double v_ms = calc_vec3_abs(interPart.get_v_ms() - Population->get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur"
|
||||
double E_eV = m_eV/2*pow(v_ms/c_ms, 2); // Lab energy without thermal integration
|
||||
return calc_macro_sigma_m(E_eV, loc_m);
|
||||
}
|
||||
private:
|
||||
virtual double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) = 0;
|
||||
virtual double get_microSigma_m2(const double &E_eV) = 0;
|
||||
|
||||
protected:
|
||||
double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
||||
return calc_microSigma_m2(E_eV)*Population->get_density_m3(loc_m);
|
||||
}
|
||||
|
||||
double calc_microSigma_m2(const double &E_eV) {
|
||||
double v1_ms = sqrt(2*E_eV/m2_eV)*c_ms;
|
||||
auto integrand = [&](double theta) {
|
||||
double E_eV = m_eV/2 * (pow(v1_ms,2) + pow(v_therm,2) - 2*v1_ms*v_therm*cos(theta)) * pow(c_ms, -2);
|
||||
return get_microSigma_m2(E_eV);
|
||||
};
|
||||
return integrate(integrand, 0., pi, 30, simpson());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class TI_thermal_tenary_Interaction_Base : public Interaction_Base { // Interactions of electrons with thermal Populations
|
||||
protected:
|
||||
double m_eV; // energy of kinetic particle for CS measurement : TI
|
||||
double m2_eV; // energy of massic initial particle : T2
|
||||
double v_therm; // typical spped for thermal population
|
||||
|
||||
public:
|
||||
TI_thermal_tenary_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double m_eV) : Interaction_Base(Population, rngUni) {
|
||||
Sum_bounds bounds = Population->get_sumation_bounds(vec3(0,0,0));
|
||||
if (bounds.num_E_bins > 1) {
|
||||
throw MyException("Population is not thermal, when expected thermal.");
|
||||
}
|
||||
this->m_eV = m_eV;
|
||||
m2_eV = Population->get_m_eV();
|
||||
v_therm = Population->get_thermal_v_ms(); // Typical Speed of "Thermal Blur"
|
||||
}
|
||||
|
||||
double get_macro_sigma_m(const Particle &interPart) {
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
double v_ms = calc_vec3_abs(interPart.get_v_ms() - Population->get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur"
|
||||
double E_eV = m_eV/2*pow(v_ms/c_ms, 2); // Lab energy without thermal integration
|
||||
return calc_macro_sigma_m(E_eV, loc_m);
|
||||
}
|
||||
private:
|
||||
virtual double get_microSigma_divbyn_m2(const double &E_eV) = 0;
|
||||
|
||||
protected:
|
||||
double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
||||
return calc_microSigma_divbyn_m2(E_eV)*pow(Population->get_density_m3(loc_m), 2);
|
||||
}
|
||||
|
||||
double calc_microSigma_divbyn_m2(const double &E_eV) {
|
||||
double v1_ms = sqrt(2*E_eV/m2_eV)*c_ms;
|
||||
auto integrand = [&](double theta) {
|
||||
double E_eV = m_eV/2 * (pow(v1_ms,2) + pow(v_therm,2) - 2*v1_ms*v_therm*cos(theta)) * pow(c_ms, -2);
|
||||
return get_microSigma_divbyn_m2(E_eV);
|
||||
};
|
||||
return integrate(integrand, 0., pi, 30, simpson());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class TI_e_Interaction_Base : public Interaction_Base { // Interactions of ions with kinetic e Populations
|
||||
int E_kin_bin;
|
||||
protected:
|
||||
double m_eV; // energy of kinetic particle for CS measurement : e-
|
||||
double mI_eV; // energy of massic initial particle : TI
|
||||
int num_Ee_bins; // number of Ee_bins in Populations
|
||||
double *Ee_mids; // values for energy mids of Ee_bins in Populations
|
||||
double *ve_mids; // corresponding v_values
|
||||
|
||||
public:
|
||||
TI_e_Interaction_Base(Population_Base *Population, UniRNG *rngUni) : Interaction_Base(Population, rngUni) {
|
||||
TI_e_Interaction_Base(Population_Base *Population, UniRNG *rngUni, double mI_eV) : Interaction_Base(Population, rngUni) {
|
||||
m_eV = Population->get_m_eV();
|
||||
this->mI_eV = mI_eV;
|
||||
|
||||
Sum_bounds bounds = Population->get_sumation_bounds(vec3(0,0,0));
|
||||
if (bounds.num_E_bins <= 1) {
|
||||
num_Ee_bins = bounds.num_E_bins;
|
||||
if (num_Ee_bins <= 1) {
|
||||
throw MyException("Population is not kinetic, when kinetic thermal.");
|
||||
}
|
||||
m_eV = Population->get_m_eV();
|
||||
}
|
||||
|
||||
double get_macroSigma_m(const Particle &interPart) {
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
double v1_ms = interPart.get_vAbs_ms();
|
||||
ve_mids = new double[num_Ee_bins];
|
||||
Ee_mids = new double[num_Ee_bins];
|
||||
|
||||
Content cont;
|
||||
double macro_Sigma_m2 = 0;
|
||||
double E_eV, v2_ms, micro_sigma;
|
||||
Sum_bounds bounds = Population->get_sumation_bounds(interPart.get_x_m());
|
||||
for (int E_bin = 0; E_bin<bounds.num_E_bins; E_bin++) {
|
||||
cont = Population->get_density_m3(E_bin, bounds.loc_bins);
|
||||
v2_ms = sqrt(2*cont.E_eV/m_eV)*c_ms;
|
||||
if (v2_ms*0.005 > v1_ms) { // 0.005 represents 1% variation in energy
|
||||
E_eV = m_eV/2 * pow(v2_ms/c_ms,2);
|
||||
micro_sigma = get_microSigma_m2(E_eV, loc_m);
|
||||
} else {
|
||||
auto integrand = [&](double theta) {
|
||||
double E_eV = m_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2);
|
||||
return get_microSigma_m2(E_eV, loc_m);
|
||||
};
|
||||
micro_sigma = integrate(integrand, 0., pi, 5, simpson());
|
||||
macro_Sigma_m2 += micro_sigma * cont.n_m3;
|
||||
}
|
||||
for (int Ee_bin = 0; Ee_bin<num_Ee_bins; Ee_bin++) {
|
||||
cont = Population->get_density_m3(Ee_bin, Bins{0,0,0});
|
||||
Ee_mids[Ee_bin] = cont.E_eV;
|
||||
ve_mids[Ee_bin] = sqrt(2*cont.E_eV/m_eV)*c_ms;
|
||||
}
|
||||
return macro_Sigma_m2;
|
||||
}
|
||||
private:
|
||||
virtual double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) = 0;
|
||||
};
|
||||
|
||||
|
||||
/*class Interaction_Base {
|
||||
|
||||
double get_macro_sigma_m(const Particle &interPart) {
|
||||
return calc_macro_sigma_m(interPart.get_E_eV(), interPart.get_x_m());
|
||||
}
|
||||
protected:
|
||||
Population_Base *Population;
|
||||
UniRNG *rngUni;
|
||||
virtual double get_microSigma_m2(const double &E_eV) = 0;
|
||||
|
||||
public:
|
||||
Interaction_Base(Population_Base *Population, UniRNG *rngUni) {
|
||||
this->Population = Population;
|
||||
this->rngUni = rngUni;
|
||||
};
|
||||
|
||||
double get_macroSigma_m(const Particle &interPart);
|
||||
private:
|
||||
virtual double get_microSigma_m2(const double &E_eV, const vec3 &loc_m) = 0;
|
||||
double get_macroSigma_m_thermal(const Particle &interPart);
|
||||
double get_macroSigma_m_kinetic(const Particle &interPart, const Sum_bounds &bounds);
|
||||
|
||||
public:
|
||||
virtual InteractionOut do_Interaction (Particle *interPart) = 0;
|
||||
|
||||
protected:
|
||||
vec3 get_vOff_ms(const Particle &interPart, const double &minE_eV);
|
||||
};
|
||||
|
||||
inline double Interaction_Base::get_macroSigma_m(const Particle &interPart) {
|
||||
Sum_bounds bounds = Population->get_sumation_bounds(interPart.get_x_m());
|
||||
if (bounds.num_E_bins <= 1) { //thermal
|
||||
return get_macroSigma_m_thermal(interPart);
|
||||
} else { //kinetic
|
||||
return get_macroSigma_m_kinetic(interPart, bounds);
|
||||
double calc_macro_sigma_m(const double &E_eV, const vec3 &loc_m) {
|
||||
Sum_bounds bounds = Population->get_sumation_bounds(loc_m);
|
||||
Content cont;
|
||||
double macro_sigma_m = 0;
|
||||
for (int Ee_bin = 0; Ee_bin<num_Ee_bins; Ee_bin++) {
|
||||
cont = Population->get_density_m3(Ee_bin, bounds.loc_bins);
|
||||
macro_sigma_m += calc_microSigma_m2(E_eV, Ee_bin) * cont.n_m3;
|
||||
}
|
||||
return macro_sigma_m;
|
||||
}
|
||||
}
|
||||
|
||||
inline double Interaction_Base::get_macroSigma_m_thermal(const Particle &interPart) {
|
||||
// Calulate average interaction cross section by integration over theta
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
double m_eV = interPart.get_m_eV();
|
||||
double v1_ms = calc_vec3_abs(interPart.get_v_ms() - Population->get_drift_v_ms(loc_m)); // Shift to "Labframe without thermal blur"
|
||||
double v2_ms = Population->get_thermal_v_ms(loc_m); // Typical Speed of "Thermal Blur"
|
||||
double micro_sigma;
|
||||
if (v1_ms*0.005 > v2_ms) { // 0.005 represents 1% variation in energy
|
||||
double E_eV = m_eV/2 * pow(v1_ms/c_ms,2);
|
||||
micro_sigma = get_microSigma_m2(E_eV, loc_m);
|
||||
} else {
|
||||
auto integrand = [&](double theta) {
|
||||
double E_eV = m_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2);
|
||||
return get_microSigma_m2(E_eV, loc_m);
|
||||
};
|
||||
micro_sigma = integrate(integrand, 0., pi, 30, simpson());
|
||||
}
|
||||
return micro_sigma*Population->get_density_m3(loc_m);
|
||||
}
|
||||
|
||||
inline double Interaction_Base::get_macroSigma_m_kinetic(const Particle &interPart, const Sum_bounds &bounds) {
|
||||
vec3 loc_m = interPart.get_x_m();
|
||||
double m_eV = Population->get_m_eV(); // Since CS is given in lab frame of "kinetic particle hitting fixed T" Fix this more elegant later.
|
||||
double v1_ms = interPart.get_vAbs_ms();
|
||||
|
||||
Content cont;
|
||||
double v2_ms;
|
||||
double macro_Sigma_m2 = 0;
|
||||
double micro_sigma, E_eV;
|
||||
for (int E_bin = 0; E_bin<bounds.num_E_bins; E_bin++) {
|
||||
cont = Population->get_density_m3(E_bin, bounds.loc_bins);
|
||||
v2_ms = sqrt(2*cont.E_eV/m_eV)*c_ms;
|
||||
if (v2_ms > v1_ms*0.005) { // 0.005 represents 1% variation in energy
|
||||
E_eV = m_eV/2 * pow(v2_ms/c_ms,2);
|
||||
micro_sigma = get_microSigma_m2(E_eV, loc_m);
|
||||
double calc_microSigma_m2(const double &E1_eV, const int &Ee_bin) {
|
||||
double v1_ms = sqrt(2*E1_eV/mI_eV)*c_ms;
|
||||
double v2_ms = ve_mids[Ee_bin];
|
||||
|
||||
if (v2_ms*0.005 > v1_ms) { // 0.005 represents 1% variation in energy
|
||||
return get_microSigma_m2(Ee_mids[Ee_bin]); // location is dummy again...
|
||||
} else {
|
||||
auto integrand = [&](double theta) {
|
||||
double E_eV = m_eV/2 * (pow(v1_ms,2) + pow(v2_ms,2) - 2*v1_ms*v2_ms*cos(theta)) * pow(c_ms, -2);
|
||||
return get_microSigma_m2(E_eV, loc_m);
|
||||
return get_microSigma_m2(E_eV); // location is dummy again...
|
||||
};
|
||||
micro_sigma = integrate(integrand, 0., pi, 30, simpson());
|
||||
macro_Sigma_m2 += micro_sigma * cont.n_m3;
|
||||
return integrate(integrand, 0., pi, 30, simpson());
|
||||
}
|
||||
}
|
||||
return macro_Sigma_m2;
|
||||
}
|
||||
};
|
||||
|
||||
inline vec3 Interaction_Base::get_vOff_ms(const Particle &interPart, const double &minE_eV) {
|
||||
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_E_eV_from_v_ms(v1Lab_ms, m_eV);
|
||||
if (T_eV < minE_eV) {
|
||||
T_eV = calc_E_eV_from_v_ms(v1_ms, m_eV);
|
||||
if (T_eV < minE_eV) {
|
||||
std::stringstream ss;
|
||||
ss<<"Interaction_Base::get_vOff_ms: T_eV < minE_eV.\nT_eV= "<< T_eV<<"\t minE_eV= "<<minE_eV<<"\n";
|
||||
throw MyException (ss.str());
|
||||
}
|
||||
return vec3(0,0,0);
|
||||
}
|
||||
return v2_ms;
|
||||
}
|
||||
|
||||
*/
|
||||
#endif /* sub_interaction_base_h */
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "process_base.h"
|
||||
#include "particle.hpp"
|
||||
#include "katrin_geo.h"
|
||||
|
||||
struct Termination_Stats {
|
||||
int n_total = 0;
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#ifndef Thermal_Population_h
|
||||
#define Thermal_Population_h
|
||||
|
||||
#include "katrin_geo.h"
|
||||
|
||||
#include "population_base.h"
|
||||
#include "wgts_kinematics.h"
|
||||
|
||||
@@ -49,6 +47,7 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
vec3 roll_x_ms() {throw MyException ("Not yet implemented as not needed at this point.");}
|
||||
vec3 roll_v_ms (const vec3 &loc_m) {return kinematics->get_v_ms(loc_m);}
|
||||
vec3 get_drift_v_ms(const vec3 &loc_m) {return kinematics->get_v_offset_ms(loc_m);}
|
||||
double get_thermal_v_ms() {return kinematics->get_thermal_v_ms();}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "timer.hpp"
|
||||
|
||||
#include "constants.h"
|
||||
#include "read_system.h"
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#ifndef timer_hpp
|
||||
#define timer_hpp
|
||||
|
||||
#include "katrin_geo.h"
|
||||
|
||||
class Timer {
|
||||
static const double wgtsT2MaxDensity_m3;
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
Content get_density_m3(const int &E_bin, const Bins &loc_bins);
|
||||
Sum_bounds get_sumation_bounds(const vec3 &loc_m);
|
||||
|
||||
vec3 roll_x_ms();
|
||||
vec3 roll_v_ms (const vec3 &loc_m) {return kinematics->get_v_ms(loc_m);}
|
||||
vec3 get_drift_v_ms(const vec3 &loc_m) {return kinematics->get_v_offset_ms(loc_m);}
|
||||
double get_thermal_v_ms() {return kinematics->get_thermal_v_ms();}
|
||||
@@ -94,5 +95,18 @@ inline Sum_bounds T2_Population::get_sumation_bounds(const vec3 &loc_m) {
|
||||
return res;
|
||||
}
|
||||
|
||||
inline vec3 T2_Population::roll_x_ms() {
|
||||
double r_m = r_WGTS_m*sqrt(rngUni->random());
|
||||
double phi = rngUni->random()*2*pi;
|
||||
|
||||
double eta1, eta2, z_can_m;
|
||||
do {
|
||||
eta1 = rngUni->random();
|
||||
eta2 = rngUni->random();
|
||||
z_can_m = z_RW_m + eta1*(z_WGTS_end_m - z_RW_m);
|
||||
} while(eta2*wgtsT2MaxDensity_m3 > get_density_m3(vec3(0,0, z_can_m)));
|
||||
return vec3 (r_m*cos(phi) ,r_m*sin(phi) ,z_can_m);
|
||||
}
|
||||
|
||||
|
||||
#endif /* tritium2_population_h */
|
||||
|
||||
@@ -13,8 +13,6 @@ enum cordStyle{xyz, zrphi};
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "katrin_geo.h"
|
||||
|
||||
#include "kinematics.h"
|
||||
#include "base_container.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user