Files
katrin-plasma/docs/phd/jkellerer/figCode/Chapter2_KATRIN/ParticleInteractions/electronHI.py
T
2021-03-04 11:47:03 +01:00

343 lines
11 KiB
Python

import numpy as np
import os
import sys
from astropy import units as u
from astropy import constants as const
import matplotlib
import matplotlib.pyplot as plt
import subprocess
from scipy import interpolate
import matplotlib.colors
homebase = os.getenv('HOMEBASE')
if homebase == None:
homebase = "/home/jonas/new_workspace/Coding/ACRONYM/acronym"
includes = homebase + "/src/grpic/boundaries_3d"
sys.path.append(includes)
import precalculation.functions.plasmaFunctions as plasmaFuncs
import analysis.plotDataFromAcronym.plot_standards as pltStd
# Input
# =======================
thesis_path = "/home/jonas/new_workspace/notes/katrin-plasma/docs/phd/jkellerer"
output_folder = thesis_path+"/fig/Chapter2_KATRIN/ParticleInteractions/"
data_path = thesis_path + "/figCode/Chapter2_KATRIN/ParticleInteractions/data/"
# Calculation
# =======================
class electronCrossSection:
def elastic(E_eV):
#yoon
data = np.genfromtxt(
data_path+"TCS_concatenated.txt",
dtype=float,
delimiter=" ",
skip_header=1)
interpolation = interpolate.interp1d(
data[:,0], data[:,1], bounds_error=False,fill_value=np.any(E_eV))
return interpolation(E_eV)
def rotationalExcitation(E_eV):
#yoon
data = np.genfromtxt(
data_path+"rot_exc_j02.dat",
dtype=float,
delimiter=" ",
skip_header=2)
interpolation = interpolate.interp1d(
data[:,0], data[:,1], bounds_error=False,fill_value=np.any(E_eV))
factor = np.where(E_eV<data[0,0],0,1)
factor *= np.where(E_eV>data[-1,0],0,1)
return interpolation(E_eV) * factor
def vibrationalExcitation(E_eV):
#yoon
data = np.genfromtxt(
data_path+"vib_exc_v01.dat",
dtype=float,
delimiter=" ",
skip_header=2)
interpolation = interpolate.interp1d(
data[:,0], data[:,1], bounds_error=False,fill_value=np.any(E_eV))
factor = np.where(E_eV<data[0,0],0,1)
factor *= np.where(E_eV>data[-1,0],0,1)
return interpolation(E_eV) * factor
def Janev_eT2_Ionization_ndiss(E_eV):
deltaE_eV = 15.42
x = E_eV/deltaE_eV
C0 = 2.05*deltaE_eV
return np.abs(np.where(
E_eV<deltaE_eV,
0.,
1.828/x*pow(1-pow(x,-0.92),2.19)*np.log(C0*x)*1e-20))
def Janev_eT2_Ionization_diss_g(E_eV):
deltaE_eV = 18.15
x = E_eV/deltaE_eV
return np.abs(np.where(
E_eV<deltaE_eV,
0.,
0.02905*pow(x,-1.25)*pow(1-pow(x,-2.78),1.886)*1e-20))
def Janev_eT2_Ionization_diss_u(E_eV):
deltaE_eV = 30.6
x = E_eV/deltaE_eV
return np.abs(np.where(
E_eV<deltaE_eV,
0.,
0.5927*pow(x,-1.2)*pow(1-pow(x,-1.22),3.375)*1e-20))
def JanevIonizationTotal(E_eV):
return electronCrossSection.Janev_eT2_Ionization_ndiss(E_eV)\
+ electronCrossSection.Janev_eT2_Ionization_diss_g(E_eV)\
+ electronCrossSection.Janev_eT2_Ionization_diss_u(E_eV)
def JanevElectricExcitationNu(E_eV,n):
if n=='B1Sigmau':
deltaE_eV = 12.754
alpha = 0.550
A1 = 3.651e-2
A2 = -0.8405
A3 = 1.2365
A4 = 2.5236
if n=='Bp1Sigu':
deltaE_eV = 14.85
alpha = 0.550
A1 = 6.827e-3
A2 = -0.1572
A3 = 0.23122
A4 = 0.47191
if n=='Bpp1Sigu':
deltaE_eV = 15.47
alpha = 0.550
A1 = 2.446e-3
A2 = -5.631e-2
A3 = 6.2846e-2
A4 = 0.16908
if n=='C1Piu':
deltaE_eV = 13.29
alpha = 0.552
A1 = 3.653e-2
A2 = -0.8398
A3 = 1.2368
A4 = 2.8740
if n=='D1Piu':
deltaE_eV = 14.996
alpha = 0.552
A1 = 8.913e-3
A2 = -0.2049
A3 = 0.30178
A4 = 0.70126
if n=='Dp1Piu':
deltaE_eV = 15.555
alpha = 0.552
A1 = 3.872e-3
A2 = -8.902e-2
A3 = 0.13110
A4 = 0.30464
x = E_eV/deltaE_eV
fac1 = 5.984/deltaE_eV/x*pow(1-1/x,alpha)
fac2 = (A1 + A2/x + A3/x/x + A4*np.log(x))
return np.abs(np.where(
E_eV<deltaE_eV,
0.,
fac1 * fac2 * 1e-20))
def JanevElectricExcitationNuTotal(E_eV):
return electronCrossSection.JanevElectricExcitationNu(E_eV,'B1Sigmau')\
+ electronCrossSection.JanevElectricExcitationNu(E_eV,'Bp1Sigu')\
+ electronCrossSection.JanevElectricExcitationNu(E_eV,'Bpp1Sigu')\
+ electronCrossSection.JanevElectricExcitationNu(E_eV,'C1Piu')\
+ electronCrossSection.JanevElectricExcitationNu(E_eV,'D1Piu')\
+ electronCrossSection.JanevElectricExcitationNu(E_eV,'Dp1Piu')
def JanevElectricExcitationNg(E_eV, n):
if n=='EF1Sigpg':
deltaE_eV = 13.13
alpha = 2.71
A1 = 0.8322
if n=='HHb1Sigpg':
deltaE_eV = 14.98
alpha = 2.71
A1 = 2.913e-2
if n=='GK1Sigpg':
deltaE_eV = 14.816
alpha = 2.75
A1 = 1.43e-2
if n=='I1Pig':
deltaE_eV = 14.824
alpha = 2.80
A1 = 5.409e-2
x = E_eV/deltaE_eV
return np.abs(np.where(
E_eV<deltaE_eV,
0.,
5.984*A1/deltaE_eV/x*pow(1-1/x,alpha) * 1e-20))
def JanevElectricExcitationNgTotal(E_eV):
return electronCrossSection.JanevElectricExcitationNg(E_eV,'EF1Sigpg')\
+ electronCrossSection.JanevElectricExcitationNg(E_eV,'HHb1Sigpg')\
+ electronCrossSection.JanevElectricExcitationNg(E_eV,'GK1Sigpg')\
+ electronCrossSection.JanevElectricExcitationNg(E_eV,'I1Pig')
def JanevElectricExcitationN(E_eV, n):
if n=='a3Sigpg':
deltaE_eV = 11.72
beta = 4.5
gamma = 1.55
A = 0.544
if n=='b3Sigpu':
deltaE_eV = 7.93
beta = 2.33
gamma = 3.78
A = 11.16
if n=='c3Piu':
deltaE_eV = 11.72
beta = 5.5
gamma = 1.65
A = 1.43
if n=='e3Sigpu' :
deltaE_eV = 13.0
beta = 4.5
gamma = 1.60
A = 0.190
if n=='d3Piu':
deltaE_eV = 13.6
beta = 5.5
gamma = 1.75
A = 0.375
x = E_eV/deltaE_eV
return np.abs(np.where(
E_eV<deltaE_eV,
0.,
A*pow(x,-3)*pow(1-pow(x,-beta),gamma) * 1e-20))
def JanevElectricExcitationNTotal(E_eV):
return electronCrossSection.JanevElectricExcitationN(E_eV,'a3Sigpg')\
+ electronCrossSection.JanevElectricExcitationN(E_eV,'b3Sigpu')\
+ electronCrossSection.JanevElectricExcitationN(E_eV,'c3Piu')\
+ electronCrossSection.JanevElectricExcitationN(E_eV,'e3Sigpu')\
+ electronCrossSection.JanevElectricExcitationN(E_eV,'d3Piu')
def JanevElectricExcitationTotal(E_eV):
return electronCrossSection.JanevElectricExcitationNTotal(E_eV)\
+ electronCrossSection.JanevElectricExcitationNgTotal(E_eV)\
+ electronCrossSection.JanevElectricExcitationNuTotal(E_eV)
def radiativeRecombinationH(E_eV):
alpha = 1./137
a_bohr = 5.29E-11 #m
Jz = (4.8E-10)**4*9.1E-28/(2*(1.05E-27)**2)
nu = (Jz/(E_eV*1.6021E-12))**(1/2)
factor = nu**6 * np.exp(-4*nu*np.arctan(1/nu)) / ((1-np.exp(-2*np.pi*nu))*(nu**2+1)**2)
sig0 = 2**8*np.pi**2/3 * factor * alpha**3 * a_bohr**2
sig_factor = (1.202+0.5782*np.log(nu**2+1)+0.2148*np.log(nu**2+1)**2)/(1+0.3425*np.log(nu**2+1))
return sig_factor * sig0
def dissociativeRecombinationH2(E_eV):
const1 = ( (E_eV)**0.665 * (1 + 1.1*(E_eV)**0.512 + 0.011*(E_eV)**3.10))**(-1)
const2 = 0.133 * np.exp(-0.35*(E_eV-6.05)**2)
return 17.3e-20 * (const1+const2)
def dissociativeExcitationH3(E_eV):
delta_E = 14.75
expc = np.exp(- 50.32*(E_eV)**-1.177/(1+1.019e-14*(E_eV)**7.462))
cross_section = 82.56e-20*(E_eV)**-0.521*(1-(15.0/E_eV)**5.15) * expc
return np.where(E_eV < delta_E, 0, cross_section)
def dissociativeRecombinationH3(E_eV):
sigLDR = 3e-20*(E_eV)**(-0.725)/(1+4.45*(E_eV)**1.2)
sig_small = 0.0646e-20 * (E_eV)**1.478
sig_big = 634.22e-20 * (E_eV)**(-2.605)
sigHDR = 1/(1/sig_small + 1/sig_big)
return sigLDR + sigHDR;
def dissociatveRecombinationH5(E_eV):
# Pettersson
return np.where(
(E_eV<0.017),
pow(10,-18.87) * pow(E_eV, -1.2),
np.where(
(E_eV < 0.159),
pow(10,-19.93) * pow(E_eV, -1.78),
pow(10,-21.5) * pow(E_eV, -3.75))
)
energies_eV = np.logspace(-3,4,100)
sigma_elastic = electronCrossSection.elastic(energies_eV)*1E4
sigma_rot_exc = electronCrossSection.rotationalExcitation(energies_eV)*1E4
sigma_vib_exc = electronCrossSection.vibrationalExcitation(energies_eV)*1E4
sigma_ionization = electronCrossSection.JanevIonizationTotal(energies_eV)*1E4
sigma_el_exc = electronCrossSection.JanevElectricExcitationTotal(energies_eV)*1E4
sigma_total = sigma_elastic + sigma_rot_exc + sigma_vib_exc + sigma_ionization + sigma_el_exc
sigma_rec_h = electronCrossSection.radiativeRecombinationH(energies_eV)*1E4
sigma_rec_h2 = electronCrossSection.dissociativeRecombinationH2(energies_eV)*1E4
sigma_rec_h3 = electronCrossSection.dissociativeRecombinationH3(energies_eV)*1E4
sigma_dis_exc =electronCrossSection.dissociativeExcitationH3(energies_eV)*1E4
sigma_rec_h5 = electronCrossSection.dissociatveRecombinationH5(energies_eV)*1E4
# Plot
# =======================
pltStd.setRcParams()
prop_cycle = plt.rcParams['axes.prop_cycle']
colors = prop_cycle.by_key()['color']
(width, height) = pltStd.set_size('thesis')
fig, ax = plt.subplots(1, 1, figsize=(width, height))
ax.plot(energies_eV, sigma_total, '-', label=r'total H$_2$')
ax.plot(energies_eV, sigma_rec_h2, '--',label=r'diss rec. H$_2^+$')
ax.plot(energies_eV, sigma_rec_h3, '--',label=r'diss. rec. H$_3^+$')
ax.plot(energies_eV, sigma_rec_h5, '--',label=r'disc. rec. H$_5^+$')
ax.plot(energies_eV, sigma_rec_h, ':',label=r'rec. H$^+$')
ax.plot(energies_eV, sigma_dis_exc, '-.',label=r'diss. exc. H$_3^+$')
#ax.plot(energies_eV, sigma_elastic, '--',label=r'elastic scattering')
#ax.plot(energies_eV, sigma_ionization, '-.',label=r'ionization')
#ax.plot(energies_eV, sigma_el_exc, linestyle=(0, (3, 1, 1, 1, 1, 1)),label=r'el.exc.')
#ax.plot(energies_eV, sigma_rot_exc, ':',label=r'rot. exc.')
#ax.plot(energies_eV, sigma_vib_exc, ':',label=r'vib. exc.')
ax.set_ylim((1E-23, 8E-12))
ax.set_xscale('log')
ax.set_yscale('log')
ax.set_ylabel(r'Cross section $\sigma$ [cm$^{2}$]')
ax.set_xlabel(r'Energy $E$ [eV]')
ax.legend(loc='upper right',ncol=2)
plt.savefig(output_folder + "eTI_overview.pdf",bbox_inches='tight')
plt.show()