backup save

This commit is contained in:
Jonas Kellerer
2021-03-04 11:47:03 +01:00
parent e7c298983e
commit 9e5c2f068f
241 changed files with 2354544 additions and 319 deletions
@@ -0,0 +1,283 @@
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)
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
# 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')
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-18, 2E-15))
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='center left')
plt.savefig(output_folder + "eT2_overview.pdf",bbox_inches='tight')
plt.show()