- Added individul operators for species and better selecting process. - Switched to C arrays for main loop operations and calculating array indizes using knowledge of binning instead of doing sorted search - Added Recombination - Reworked elastic scattering kinematics - Added inelastic scattering kinematics
85 lines
2.7 KiB
C++
85 lines
2.7 KiB
C++
//
|
|
// tritium2_population.h
|
|
// mc_electron
|
|
//
|
|
// Created by Christian Reiling on 17.05.19.
|
|
// Copyright © 2019 Christian Reiling. All rights reserved.
|
|
//
|
|
|
|
#ifndef tritium2_population_h
|
|
#define tritium2_population_h
|
|
|
|
|
|
class T2_Population : public Population_Base, public RNG_Base {
|
|
static const double wgtsT2MaxDensity_m3;
|
|
static const double wgtsTemp_K;
|
|
static const double wgtsT2FlowSpeed_ms;
|
|
|
|
public:
|
|
T2_Population(UniRNG *rngUni, NormalRNG *rngNormal) : Population_Base(tritium2), RNG_Base(rngUni, rngNormal){};
|
|
|
|
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) {};
|
|
|
|
vec3 get_average_speed_ms (const vec3 &loc_m);
|
|
vec3 roll_speed_ms (const vec3 &loc_m);
|
|
|
|
|
|
private:
|
|
double calc_DensityTriangle(const double &z_m);
|
|
|
|
private:
|
|
vec3 roll_thermSpeed_ms(const vec3 &loc_m);
|
|
|
|
};
|
|
|
|
|
|
const double T2_Population::wgtsT2MaxDensity_m3 = getParameter("wgtsT2MaxDensity_m3");
|
|
const double T2_Population::wgtsTemp_K = getParameter("wgtsTemp_K");
|
|
const double T2_Population::wgtsT2FlowSpeed_ms = getParameter("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 (zero);
|
|
} else {
|
|
return (calc_DensityTriangle(loc_m[2]));
|
|
}
|
|
}
|
|
|
|
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 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 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;
|
|
double sign = (loc_m[2] < z_wgtsHalf_m) ? -1 : 1;
|
|
double zSpeed_ms = sign*wgtsT2FlowSpeed_ms;
|
|
return ( vec3(0,0,zSpeed_ms) );
|
|
} else {
|
|
return (vec3(0,0,0));
|
|
}
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
|
|
#endif /* tritium2_population_h */
|