Added Ionization
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// elastic.cpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 15.01.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// electron.cpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 15.01.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#include "electron.hpp"
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// electron.hpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 15.01.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef electron_hpp
|
||||
#define electron_hpp
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#endif /* electron_hpp */
|
||||
@@ -1,256 +0,0 @@
|
||||
//
|
||||
// interaction.cpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 13.11.18.
|
||||
// Copyright © 2018 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#include "interaction.h"
|
||||
|
||||
const double Interaction::ionET2_eV = 13.603;
|
||||
const double Interaction::ionA1 = 0.74;
|
||||
const double Interaction::ionA2 = 0.87;
|
||||
const double Interaction::ionA3 = -0.6;
|
||||
const double Interaction::ionN = 2.4;
|
||||
const double Interaction::ionBeta = 0.6;
|
||||
const double Interaction::ionGamma = 10;
|
||||
const double Interaction::ionG5 = 0.33;
|
||||
const double Interaction::iongb = 2.9;
|
||||
|
||||
Interaction::Interaction(Particle *InitParticle, Particle *ScatParticle) {
|
||||
// Check valid Interaction? e- and T2
|
||||
// Check Particle will interact... v1-v2 != 0
|
||||
P1 = InitParticle;
|
||||
P2 = ScatParticle;
|
||||
if (P1->getSpecies()!= electron || P2->getSpecies()!= tritium2) {
|
||||
cerr<<"Interaction: Interaction not defined between "<<P1->getSpecies()<<" and "<< P2->getSpecies()<<"."<<endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
//General
|
||||
|
||||
double Interaction::getSigmaTot_m2() {
|
||||
vector<double> Sigmas = getSigmas_m2();
|
||||
double sigmaTot_m2 = 0;
|
||||
for (vector<double>::iterator SigmasIt = Sigmas.begin() ; SigmasIt != Sigmas.end(); SigmasIt++) {
|
||||
sigmaTot_m2 += *SigmasIt;
|
||||
}
|
||||
return(sigmaTot_m2);
|
||||
}
|
||||
|
||||
vector<double> Interaction::getSigmas_m2() {
|
||||
vector<double> Sigmas;
|
||||
Sigmas.push_back(getSigmaEla_m2());
|
||||
Sigmas.push_back(getSigmaIon_m2());
|
||||
return(Sigmas);
|
||||
}
|
||||
|
||||
int Interaction::getInteraction(ranlib::Uniform<double> *rngUni) {
|
||||
// Check Moved Outside
|
||||
if (P1->getKinEnergy_eV()==0) {
|
||||
return(0);
|
||||
}
|
||||
vector<double> Sigmas = getSigmas_m2();
|
||||
double RandPoint = rngUni->random() * getSigmaTot_m2();
|
||||
double Sum = 0;
|
||||
|
||||
for (int i=0; i<Sigmas.size();i++ ) {
|
||||
Sum += Sigmas[i];
|
||||
if (RandPoint<Sum) {
|
||||
return(i+1);
|
||||
}
|
||||
}
|
||||
|
||||
cerr<<"Interaction::getInteraction: Error in finding Interaction."<<endl;
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Elastic Scattering:
|
||||
Using Rutherford Model with screening parameter following
|
||||
Cross-sections for water vapour for the Monte Carlo electron track structure code from 10eV to the MeV region
|
||||
S Uehara et al 1993 Phys. Med. Biol. 38 1841
|
||||
*/
|
||||
|
||||
double Interaction::getSigmaEla_m2() {
|
||||
double numerator = pi*Z2()*(Z2()+1)*re_m*re_m * (1-pow(betaLab(),2));
|
||||
double denominator = elaEta() * (elaEta()+1)*pow(betaLab(),4);
|
||||
return(numerator/denominator);
|
||||
}
|
||||
|
||||
void Interaction::doElaScat (ranlib::Uniform<double> *rngUni) {
|
||||
// Here theta and phi are COM - Angles.... prob not correct :( For m1 << m2 fine.
|
||||
double theta = ranElaTheta(rngUni);
|
||||
double phi = rngUni->random() * 2 * pi;
|
||||
doElaKin(theta, phi);
|
||||
}
|
||||
|
||||
double Interaction::elaEta() {
|
||||
double etac = (EkinLab_eV() < 50e3)? 1.198 : 1.13+3.76*pow(Z2()/(137*betaLab()),2);
|
||||
double elaTau = EkinLab_eV()/m1_eV();
|
||||
return (etac * 1.7e-5 * pow(Z2(),2./3.) /(elaTau*(elaTau+2) ));
|
||||
}
|
||||
|
||||
double Interaction::ranElaTheta(ranlib::Uniform<double> *rngUni) {
|
||||
double const1 = 2*pi/getSigmaEla_m2()*Z2()*(Z2()+1)*re_m*re_m*(1- pow(betaLab(),2) )* pow(betaLab(),-4);
|
||||
double theta = acos( pow( rngUni->random()/const1-pow(2*elaEta(),-1) , -1 ) +1+2*elaEta());
|
||||
return(theta);
|
||||
}
|
||||
|
||||
|
||||
void Interaction::doElaKin(double theta, double phi) {
|
||||
// Following Landau Lifschitz I Chapter 4 Paragraph 17
|
||||
blitz::TinyVector<double,3> n0, v1New_ms, v2New_ms;
|
||||
n0 = getNewDir(vLab_ms(), theta, phi);
|
||||
v1New_ms = (m2_eV()*calcAbs(vLab_ms())*n0 + m1_eV()*vLab_ms())/(m1_eV()+m2_eV()) + v2_ms();
|
||||
v2New_ms = (-1*m1_eV()*calcAbs(vLab_ms())*n0 + m1_eV()*vLab_ms())/(m1_eV()+m2_eV()) + v2_ms();
|
||||
P1->setSpeed_ms(v1New_ms);
|
||||
P2->setSpeed_ms(v2New_ms);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Ionization:
|
||||
Following
|
||||
Differential and total cross sections for ionization of helium and hydrogen by electrons
|
||||
M. E. Rudd 1991 Physical Review A Volume 44 Number3
|
||||
*/
|
||||
|
||||
double Interaction::getSigmaIon_m2() {
|
||||
double T = P1->getKinEnergy_eV();
|
||||
double t = T/ionET2_eV;
|
||||
double N = 2; //for tritium-molecule
|
||||
if (T<ionET2_eV) {
|
||||
return(0);
|
||||
}
|
||||
return(ionS_m2(N)*ionF(t)*iong1(t));
|
||||
}
|
||||
|
||||
Particle Interaction::doIon(int newId, ranlib::Uniform<double> *rngUni) {
|
||||
if (P1->getKinEnergy_eV() < ionET2_eV) {
|
||||
cerr<<"Interaction::doIon: EKin_eV < EIonT2_eV."<<endl;
|
||||
exit(1);
|
||||
}
|
||||
double Eorg_eV, E1_eV, E2_eV;
|
||||
Eorg_eV = P1->getKinEnergy_eV();
|
||||
|
||||
double W = ranIonW(rngUni);
|
||||
double theta = ranIonTheta(W, rngUni);
|
||||
double phi = 2*pi*rngUni->random();
|
||||
double vAbsnew_ms = calcV_msFromEkin_eV(W, P1->getMass_eV());
|
||||
double vAbsLoss_ms = calcV_msFromEkin_eV(ionET2_eV, me_eV);
|
||||
blitz::TinyVector<double,3> P1newDir, vP1new_ms, P2newDir, vP2new_ms ;
|
||||
|
||||
P1newDir = getNewDir(P1->getSpeed_ms(), theta, phi);
|
||||
vP1new_ms = vAbsnew_ms*P1newDir;
|
||||
|
||||
vP2new_ms = P1->getSpeed_ms() - vP1new_ms;
|
||||
cout<<calcEkin_eVFromVAbs_ms(calcAbs(vP2new_ms), me_eV)<<endl;
|
||||
vP2new_ms = vP2new_ms - vP2new_ms/calcAbs(vP2new_ms)*vAbsLoss_ms;
|
||||
|
||||
P1->setSpeed_ms(vP1new_ms);
|
||||
Particle eNew = Particle(me_eV, qe_e, P2->getLoc_m(), vP2new_ms, newId, P1->getId(), electron);
|
||||
|
||||
E1_eV = P1->getKinEnergy_eV();
|
||||
E2_eV = eNew.getKinEnergy_eV();
|
||||
cout<<"Ionization: Eorg_eV = "<<Eorg_eV<<", W = "<<W<<", E1_eV = "<<E1_eV<<", E2_eV = "<<E2_eV<<", Ediff_eV = "<<Eorg_eV-E2_eV-E1_eV<<"."<<endl;
|
||||
|
||||
// Change tritium to tritium+...
|
||||
return(eNew);
|
||||
}
|
||||
|
||||
double Interaction::ranIonW(ranlib::Uniform<double> *rngUni) {
|
||||
double pmax,Emin_eV, Emax_eV, Ecan_eV,eta1,eta2;
|
||||
double T = P1->getKinEnergy_eV();
|
||||
//pmax = getSigmaIon_m2(); //
|
||||
pmax = ionS_m2(2)*1.06*2;
|
||||
Emin_eV = 0;
|
||||
Emax_eV = T-ionET2_eV;
|
||||
do {
|
||||
eta1 = rngUni->random();
|
||||
eta2 = rngUni->random();
|
||||
Ecan_eV = Emin_eV + eta1*(Emax_eV - Emin_eV);
|
||||
} while(eta2*pmax > getIondSigdW_m2eV(Ecan_eV));
|
||||
return(Ecan_eV);
|
||||
}
|
||||
|
||||
double Interaction::ranIonTheta(double W, ranlib::Uniform<double> *rngUni) {
|
||||
double pmax,thetaMin, thetaMax, thetaCan,eta1,eta2;
|
||||
pmax = getIondSigdW_m2eV(W);
|
||||
thetaMin = 0;
|
||||
thetaMax = pi;
|
||||
do {
|
||||
eta1 = rngUni->random();
|
||||
eta2 = rngUni->random();
|
||||
thetaCan = thetaMin + eta1*(thetaMax - thetaMin);
|
||||
} while(eta2*pmax > getIondSigdWdTheta_m2eV(W,thetaCan));
|
||||
return(thetaCan);
|
||||
}
|
||||
|
||||
double Interaction::getIondSigdW_m2eV(double W) {
|
||||
double T = P1->getKinEnergy_eV();
|
||||
double t = T/ionET2_eV;
|
||||
double w = W/ionET2_eV;
|
||||
double N = 2;
|
||||
return(ionS_m2(N)*ionF(t)*ionf1(w,t)/ionET2_eV);
|
||||
}
|
||||
double Interaction::getIondSigdWdTheta_m2eV(double W, double theta) {
|
||||
double T = P1->getKinEnergy_eV();
|
||||
double t = T/ionET2_eV;
|
||||
double w = W/ionET2_eV;
|
||||
double N = 2;
|
||||
return( ionG1(t, w, theta, N)*( ionfbe(t,w,theta)+ionG4(t,w)*ionfb(theta) ) );
|
||||
}
|
||||
|
||||
double Interaction::ionS_m2(double N) {
|
||||
return (4*pi*N*pow(rBohr_m*ERyd_eV/ionET2_eV,2));
|
||||
}
|
||||
double Interaction::ionf1(double t, double w) {
|
||||
return ( pow(w+1,-ionN) + pow(t-w,-ionN)-pow((w+1)*(t-w),-ionN/2) );
|
||||
}
|
||||
double Interaction::iong1(double t) {
|
||||
return ( (1-pow(t,1-ionN))/(ionN-1) - pow(2/(t+1),ionN/2)*(1-pow(t,1-ionN/2))/(ionN-2) );
|
||||
}
|
||||
double Interaction::ionF(double t) {
|
||||
return ((ionA1*log(t) + ionA2 + ionA3/t)/t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
double Interaction::ionG1(double t, double w, double theta,double N) {
|
||||
double numerator = ionS_m2(N)*ionF(t)*ionf1(t,w)/ionET2_eV;
|
||||
double denominator = iongbe(t,w)+ionG4(t,w)*iongb;
|
||||
return (numerator/denominator);
|
||||
}
|
||||
double Interaction::ionG2(double t, double w) {
|
||||
return( pow(w+1/t,0.5) );
|
||||
}
|
||||
double Interaction::ionG3(double t, double w) {
|
||||
return ( ionBeta*sqrt((1-pow(ionG2(t,w),2))/w) );
|
||||
}
|
||||
|
||||
double Interaction::ionG4(double t, double w) {
|
||||
return ( ionGamma*pow(1-w/t,3)/t/(w+1) );
|
||||
}
|
||||
|
||||
double Interaction::ionfbe(double t, double w, double theta) {
|
||||
double a = pow( (cos(theta)-ionG2(t,w))/ionG3(t,w) , 2 );
|
||||
return ( 1/(1+ a) );
|
||||
}
|
||||
double Interaction::ionfb(double theta) {
|
||||
double a = pow( (cos(theta)+1)/ionG5 , 2 );
|
||||
return ( 1/(1+ a) );
|
||||
}
|
||||
double Interaction::iongbe(double t, double w) {
|
||||
double atan1, atan2;
|
||||
atan1 = atan( (1-ionG2(t,w))/ionG3(t,w) );
|
||||
atan2 = atan( (1+ionG2(t,w))/ionG3(t,w) );
|
||||
return( 2*pi*ionG3(t,w)*(atan1 + atan2) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
//
|
||||
// interaction.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 13.11.18.
|
||||
// Copyright © 2018 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef interaction_h
|
||||
#define interaction_h
|
||||
|
||||
#include "particle.h"
|
||||
|
||||
|
||||
|
||||
|
||||
// Interaction only implemented for electron on T2 background
|
||||
|
||||
class Interaction : protected Constants {
|
||||
protected:
|
||||
static const double ionET2_eV;
|
||||
static const double ionA1;
|
||||
static const double ionA2;
|
||||
static const double ionA3;
|
||||
static const double ionN;
|
||||
static const double ionG5;
|
||||
static const double iongb;
|
||||
static const double ionBeta;
|
||||
static const double ionGamma;
|
||||
public:
|
||||
virtual ~Interaction() {};
|
||||
Interaction() {};
|
||||
Interaction(Particle *InitParticle, Particle *ScatParticle);
|
||||
|
||||
Particle *getP1(){return(P1);}
|
||||
Particle *getP2(){return(P2);}
|
||||
|
||||
protected:
|
||||
Particle *P1;
|
||||
Particle *P2;
|
||||
blitz::TinyVector<double,3> v1_ms() {return(P1->getSpeed_ms()); }
|
||||
blitz::TinyVector<double,3> v2_ms() {return(P2->getSpeed_ms()); }
|
||||
blitz::TinyVector<double,3> vLab_ms() {return(v1_ms()-v2_ms()); }
|
||||
|
||||
double m1_eV() {return(P1->getMass_eV()); }
|
||||
double m2_eV() {return(P2->getMass_eV()); }
|
||||
double Z1() {return(P1->getCharge_e()); }
|
||||
double Z2() {return(P2->getCharge_e()); }
|
||||
|
||||
double EkinLab_eV() {
|
||||
return(calcEkin_eVFromVAbs_ms(calcAbs(vLab_ms()), m1_eV()));
|
||||
}
|
||||
double betaLab() {return(calcAbs(vLab_ms())/c_ms); }
|
||||
|
||||
// General
|
||||
public:
|
||||
double getSigmaTot_m2();
|
||||
vector<double> getSigmas_m2();
|
||||
int getInteraction(ranlib::Uniform<double> *rngUni);
|
||||
|
||||
// Elastic Scattering
|
||||
public:
|
||||
double getSigmaEla_m2();
|
||||
void doElaScat (ranlib::Uniform<double> *rngUni);
|
||||
protected:
|
||||
double elaEta();
|
||||
double ranElaTheta(ranlib::Uniform<double> *rngUni);
|
||||
void doElaKin(double theta, double phi);
|
||||
|
||||
|
||||
|
||||
// Ionization
|
||||
// sigma and dSigma/dW
|
||||
public:
|
||||
double getSigmaIon_m2();
|
||||
Particle doIon(int newId, ranlib::Uniform<double> *rngUni);
|
||||
protected:
|
||||
double ranIonW(ranlib::Uniform<double> *rngUni);
|
||||
double ranIonTheta(double W, ranlib::Uniform<double> *rngUni);
|
||||
public:
|
||||
double getIondSigdW_m2eV(double W);
|
||||
protected:
|
||||
double ionS_m2 (double N);
|
||||
double ionf1(double t, double w);
|
||||
double iong1(double t);
|
||||
double ionF(double t);
|
||||
|
||||
// dSigma/dWdTheta
|
||||
public:
|
||||
double getIondSigdWdTheta_m2eV(double t, double theta);
|
||||
protected:
|
||||
double ionG1(double t, double w, double theta, double N);
|
||||
double ionG2(double t, double w);
|
||||
double ionG3(double t, double w);
|
||||
double ionG4(double t, double w);
|
||||
|
||||
double ionfbe(double t, double w, double theta);
|
||||
double ionfb(double theta);
|
||||
double iongbe(double t, double w);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* interaction_h */
|
||||
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// ionization.cpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 15.01.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -9,8 +9,8 @@
|
||||
#ifndef katrin_h
|
||||
#define katrin_h
|
||||
|
||||
#include "parameter.h"
|
||||
#include "particle.h"
|
||||
#include "../base/parameter.h"
|
||||
#include "../particle/particle.h"
|
||||
|
||||
class Katrin: public Parameter
|
||||
{
|
||||
|
||||
@@ -87,7 +87,6 @@ Particle::Particle(double mass_eV, double charge_e,blitz::TinyVector<double,3> l
|
||||
s = spec;
|
||||
}
|
||||
|
||||
|
||||
double Particle::borisFly_m(blitz::TinyVector<double, 3> E_Vm , blitz::TinyVector<double, 3> B_T , double dt_s) {
|
||||
double distance_m;
|
||||
x_m += dt_s/2 * v_ms;
|
||||
@@ -111,7 +110,6 @@ void Particle::changeSpeedBoris(blitz::TinyVector<double, 3> E_Vm , blitz::TinyV
|
||||
v_ms = vPlus_ms + q_C/m_kg*E_Vm*0.5*dt_s;
|
||||
}
|
||||
|
||||
|
||||
void Particle::loseEkin_eV(double Eloss_eV) {
|
||||
double eNew_eV = getKinEnergy_eV() - Eloss_eV;
|
||||
double vAbsNew_ms = calcV_msFromEkin_eV(eNew_eV, m_eV);
|
||||
|
||||
Reference in New Issue
Block a user