1. Added precalculation of integral values in thermal regime. 2. Minor Changes in Injection of \beta-electrons and ions.
67 lines
1.9 KiB
C++
67 lines
1.9 KiB
C++
//
|
|
// drift_base.h
|
|
// mc_electron
|
|
//
|
|
// Created by Christian Reiling on 16.05.19.
|
|
// Copyright © 2019 Christian Reiling. All rights reserved.
|
|
//
|
|
|
|
#ifndef drift_base_h
|
|
#define drift_base_h
|
|
|
|
#include "mover_base.h"
|
|
|
|
|
|
// Drift Approximation: Assume constant B and only movement out in z=0, z=wgtsLength_m...
|
|
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 ¯o_sigma_m);
|
|
|
|
protected:
|
|
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 ¯o_sigma_m) = 0;
|
|
|
|
};
|
|
|
|
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, 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, 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 ¯o_sigma_m) {
|
|
double zold_m = movePart->get_x_m()[2];
|
|
|
|
vec3 v_ms = movePart->get_v_ms();
|
|
double vTotAbs_ms = calc_vec3_abs(v_ms);
|
|
double vForwardAbs_ms = calc_vec3_abs(vec3(0,0,v_ms[2]));
|
|
double zDir = v_ms[2] <= 0 ? -1 : 1;
|
|
double znew_m;
|
|
if (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/macro_sigma_m;
|
|
znew_m = zold_m + zDir*vForwardAbs_ms/vTotAbs_ms * distance_m;
|
|
}
|
|
return znew_m;
|
|
}
|
|
|
|
|
|
|
|
#endif /* drift_base_h */
|