119 lines
3.4 KiB
Python
119 lines
3.4 KiB
Python
#!/bin/python3
|
|
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
|
|
|
|
# Specific includes
|
|
# =======================
|
|
|
|
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
|
|
|
|
# inputs
|
|
# =====================
|
|
|
|
paper_path = "/home/jonas/new_workspace/notes/paper/docs/paper/monte-carlo-electron-spectrum/"
|
|
filename_laura = paper_path + "calculations/T2_Density/laura_particle_density_scaled_to_80K.csv"
|
|
output_folder = paper_path+"/figures/"
|
|
|
|
z_rw = -828.56 # cm from center
|
|
|
|
z_pump2_left = -672.95 # cm from center
|
|
z_pump2_right = -645.55 # cm from center
|
|
z_pump1_left = -529.450 # cm from center
|
|
z_pump1_right = -502.05 # cm from center
|
|
|
|
z_pump3_left = -z_pump2_left - z_rw # cm from center
|
|
z_pump3_right = -z_pump2_right - z_rw # cm from center
|
|
z_pump4_left = -z_pump1_left - z_rw # cm from center
|
|
z_pump4_right = -z_pump1_right - z_rw # cm from center
|
|
|
|
# calculation
|
|
# ======================
|
|
|
|
data_lau = np.genfromtxt(filename_laura,delimiter=',',skip_header=1)
|
|
ylim = [1E11, 2.4E15]
|
|
|
|
z_lau = data_lau[:,1] - z_rw
|
|
n_lau = data_lau[:,2]*1E-6
|
|
n_min_lau = data_lau[:,3]*1E-6
|
|
n_max_lau = data_lau[:,4]*1E-6
|
|
|
|
max_density = 6.337599e20 # 1/m^3
|
|
|
|
|
|
densities_karl = np.array([5E-4, 0.002, 0.02, 1, 0.02, 0.002, 5E-4])*max_density / 1E6
|
|
zs_karl = np.array([-8.2856, -6.57, -5, 0, 5, 6.57, 8.2856])*100 - z_rw
|
|
|
|
#densities_karl = np.array([5E-4, 0.033, 1, 0.033])*max_density / 1E6
|
|
#zs_karl = np.array([-8, -5, 0, 5])*100
|
|
|
|
dz = 1
|
|
|
|
zs = np.array([])
|
|
densities = np.array([])
|
|
for i in np.arange(0, zs_karl.size - 1):
|
|
zs_sec = np.arange(zs_karl[i], zs_karl[i+1], dz)
|
|
ns_sec = np.linspace(densities_karl[i], densities_karl[i+1], zs_sec.size)
|
|
|
|
zs = np.append(zs, zs_sec)
|
|
densities = np.append(densities, ns_sec)
|
|
|
|
# plots
|
|
# ======================
|
|
|
|
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*0.7),sharex=True)
|
|
|
|
ax.set_facecolor('#e7e7e7ff')
|
|
ax.grid(color='white')
|
|
ax.set_axisbelow(True)
|
|
|
|
ax.plot(z_lau/100, n_lau, '--', label="Kuckert")
|
|
ax.fill_between(z_lau/100, n_min_lau, n_max_lau,
|
|
facecolor=colors[0], alpha=0.1)
|
|
|
|
ax.plot(zs/100, densities, color=colors[1], label="KARL")
|
|
|
|
|
|
ax.vlines((z_pump2_left- z_rw)/100, ylim[0], ylim[1], linestyle=':', color='gray')
|
|
ax.vlines((z_pump2_right- z_rw)/100, ylim[0], ylim[1], linestyle=':', color='gray')
|
|
|
|
ax.vlines((z_pump1_left- z_rw)/100, ylim[0], ylim[1], linestyle=':', color='gray')
|
|
ax.vlines((z_pump1_right- z_rw)/100, ylim[0], ylim[1], linestyle=':', color='gray')
|
|
|
|
|
|
ax.vlines((z_pump3_left)/100, ylim[0], ylim[1], linestyle=':', color='gray')
|
|
ax.vlines((z_pump3_right)/100, ylim[0], ylim[1], linestyle=':', color='gray')
|
|
|
|
ax.vlines((z_pump4_left)/100, ylim[0], ylim[1], linestyle=':', color='gray')
|
|
ax.vlines((z_pump4_right)/100, ylim[0], ylim[1], linestyle=':', color='gray')
|
|
|
|
|
|
ax.set_yscale('log')
|
|
ax.legend()
|
|
|
|
ax.set_ylabel(r'Density $n$ (cm$^{-3}$)')
|
|
ax.set_xlabel(r'Distance to rear wall $z$ (m)')
|
|
|
|
ax.set_xlim((0,16) )
|
|
ax.set_ylim(ylim)
|
|
|
|
plt.savefig(output_folder+"nT2_vs_z.pdf",bbox_inches='tight')
|
|
plt.show() |