Files
katrin-plasma/docs/phd/jkellerer/figCode/Chapter6_Results/FullKatrinSimulation/backgrounds.py
T
2021-03-04 11:47:03 +01:00

70 lines
1.9 KiB
Python

import numpy as np
import os
import sys
from astropy import units as u
import matplotlib
import matplotlib.pyplot as plt
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_file = thesis_path+"/fig/Chapter6_Results/FullKatrinSimulation/backgrounds.pdf"
# Calculation
# =======================
z_neutrals = np.array([0, 3, 8, 13])
neutrals = np.array([1E11, 1E12, 1E15, 1E12])
z_current_left = np.array([0,3,8])
current_left = np.array([-19, -20, -30])
z_current_right = np.array([8, 13])
current_right = np.array([30, 20])
z_thermal = np.array([0, 3, 8, 13])
thermal_e = np.array([1E5, 3E5, 1E6, 3E5])
# Plot
# =======================
pltStd.setRcParams()
prop_cycle = plt.rcParams['axes.prop_cycle']
colors = prop_cycle.by_key()['color']
(width, height) = pltStd.set_size('thesis')
fig, (ax0, ax1, ax2) = plt.subplots(3, 1, figsize=(width, height*1.5))
ax0.plot(z_neutrals, neutrals, '-', label=r'no Bg.', color=colors[0])
ax0.set_ylabel(r'Gas density $n_{T_2}$ $\left[ \frac{1}{cm^3} \right]$')
ax0.set_yscale('log')
ax1.plot(z_current_left, current_left, color=colors[1])
ax1.plot(z_current_right, current_right, color=colors[1])
ax1.hlines(0, 0, 13, linestyles='--', color='tab:gray')
ax1.vlines(8, -30, 30, linestyles=':', color=colors[1])
ax1.set_ylabel(r'Current $j_{z}$ $\left[ \frac{statC}{cm^2 s} \right]$')
ax2.plot(z_thermal, thermal_e, color=colors[2])
ax2.set_ylabel(r'Density $n_{e,th}$ $\left[ \frac{1}{cm^3} \right]$')
ax2.set_xlabel(r'Position $z$ [m]')
plt.show()
fig.savefig(output_file,bbox_inches='tight')