57 lines
1.6 KiB
C++
57 lines
1.6 KiB
C++
//
|
|
// katrin.cpp
|
|
// mc_electron
|
|
//
|
|
// Created by Christian Reiling on 20.09.18.
|
|
// Copyright © 2018 Christian Reiling. All rights reserved.
|
|
//
|
|
|
|
|
|
#include "katrin.h"
|
|
|
|
|
|
|
|
blitz::TinyVector<double,3> Katrin::getMagField(blitz::TinyVector<double,3> loc_m) {
|
|
blitz::TinyVector<double,3> MagField_T;
|
|
MagField_T = 0,0,wgtsMagField_T;
|
|
return(MagField_T);
|
|
}
|
|
|
|
blitz::TinyVector<double,3> Katrin::getElField(blitz::TinyVector<double,3> loc_m) {
|
|
blitz::TinyVector<double,3> ElField_Vm;
|
|
ElField_Vm = 0,0,0;
|
|
return (ElField_Vm);
|
|
}
|
|
|
|
double Katrin::getTritiumDensity(blitz::TinyVector<double,3> loc_m) {
|
|
return(wgtsT2Density_m3);
|
|
}
|
|
|
|
Particle Katrin::getT2AverScatPart(blitz::TinyVector<double,3> loc_m, ranlib::Uniform<double> *rngUni) {
|
|
blitz::TinyVector<double,3> speed_ms;
|
|
// Get Linear Flow
|
|
double sign = (loc_m[2] < wgtsLength_m/2.) ? -1 : 1;
|
|
double flow_ms = sign*wgtsT2FlowSpeed_ms;
|
|
speed_ms = 0,0,flow_ms;
|
|
Particle ScatPart;
|
|
ScatPart = Particle(mT2_eV, ZT2, speed_ms, tritium2);
|
|
ScatPart.setLoc_m(loc_m);
|
|
return (ScatPart);
|
|
}
|
|
|
|
Particle Katrin::getT2ScatPart(blitz::TinyVector<double,3> loc_m, ranlib::Uniform<double> *rngUni, ranlib::NormalUnit<double> *rngNormal) {
|
|
Particle ScatPart = getT2AverScatPart(loc_m, rngUni);
|
|
blitz::TinyVector<double,3> speed_ms, flowOffset_ms, tempOffset_ms;
|
|
// Get Linear Flow
|
|
flowOffset_ms = ScatPart.getSpeed_ms();
|
|
|
|
// Get Temperature Motion
|
|
double tempOffsetABS_ms = calcV_msFromEkin_eV(getRandEnergyMaxwell(wgtsTemp_K,mT2_eV,rngNormal), mT2_eV);
|
|
tempOffset_ms = getRandDir(rngUni)*tempOffsetABS_ms;
|
|
|
|
speed_ms = flowOffset_ms + tempOffset_ms;
|
|
ScatPart.setSpeed_ms(speed_ms);
|
|
return (ScatPart);
|
|
}
|
|
|