72 lines
1.9 KiB
Python
72 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
|
|
|
|
import precalculation.functions.importDataFromKarl as karl
|
|
|
|
# Input
|
|
# =======================
|
|
|
|
thesis_path = "/home/jonas/new_workspace/notes/katrin-plasma/docs/phd/jkellerer"
|
|
output_file = thesis_path+"/fig/Chapter4_KARL/ZeroElectricFieldCase/current.pdf"
|
|
|
|
karl_data_dir = "/home/jonas/new_workspace/Coding/KARL/calcs/thesis_plots/sim_data/sim1/"
|
|
karl_filename = "df_part_e.csv"
|
|
|
|
# Calculation
|
|
# =======================
|
|
|
|
data = karl.KarlParticleData(karl_data_dir, karl_filename)
|
|
current_distribution_center = data.getCurrentDistribution(z_pos=3)
|
|
current_distribution_rw = data.getCurrentDistribution(z_pos=-3)
|
|
|
|
energies = current_distribution_center['Emid']
|
|
current_center = current_distribution_center['j'] *1E-4
|
|
current_center_neg = current_center * -1
|
|
|
|
current_rw = current_distribution_rw['j'] * 1E-4
|
|
|
|
|
|
# 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))
|
|
|
|
#data.plotDensityDistribution(fig=fig, ax=ax)
|
|
|
|
ax.plot(energies, current_rw, label='Rearwall')
|
|
|
|
ax.plot(energies, current_center, '--', label='Center pos.')
|
|
#ax.plot(energies, current_center_neg, 'o', label='Center neg.')
|
|
|
|
|
|
|
|
ax.set_xscale('log')
|
|
ax.set_yscale('log')
|
|
ax.set_xlabel(r'Energy $E$ [eV]')
|
|
ax.set_ylabel(r'Current distribution $\frac{\partial j}{\partial E}$ $\left[ \frac{1}{cm^2 eV}\right]$')
|
|
|
|
ax.legend()
|
|
|
|
plt.show()
|
|
|
|
fig.savefig(output_file,bbox_inches='tight') |