New input options and fCUm now calculates the number of ions passing by (to plot dN/dE easily

This commit is contained in:
Jorge Gonzalez 2025-04-17 17:07:07 +02:00
commit f25abb3213
15 changed files with 169 additions and 27 deletions

View file

@ -4,7 +4,7 @@ import numpy as np
import readBC
paths = ['../2025-04-10_08.40.09/']
paths = ['../2025-04-15_13.33.28/']
time, n_i, u_i, T_i, Zinj, Z_Tne = readBC.read(paths[0] + 'bc.csv')
fig, ax = plt.subplots()
@ -14,7 +14,7 @@ n_e = n_i * Zinj
plt.plot(time, n_e / n_e[0], label = f"$n_e$ ($\\times {n_e[0] * 1e-6:.0e} \\; cm^{{-3}})$")
plt.plot(time, T_i / T_i[0], label = f"$T \\; (\\times{T_i[0]:.1f} \\; eV)$")
plt.plot(time, Zinj, label = "Zinj")
plt.plot(time, Z_Tne, label = "Z_Tne")
# plt.plot(time, Z_Tne, label = "Z_Tne")
plt.semilogy()
plt.legend()
plt.show()

View file

@ -16,27 +16,30 @@ m_i = 1.9712e-25
# paths = ['../2024-12-10_18.45.17/', '../Poisson_50ns_T30Z11/']
# paths = ['../2024-12-11_12.38.27/', '../Poisson_polytropic_fa_T30Z11/', '../Poisson_fa_T30Z11/']
# paths = ['../Poisson_partialAblation/','../Poisson_partialAblation_lowerT/','../Poisson_partialAblation_lowT/','../Poisson_partialAblation_highT/']
paths = ['../polytropic_80ns_T30/']
paths = ['../2025-04-17_14.39.34/']
labels = [path[3:-1] for path in paths]
m2s2_to_eV = m_i*0.5/e
for path, label in zip(paths, labels):
Zlist = readZlist.read(path+'ZList.csv')
filesCum_i = sorted(glob.glob(path+'time_*_fCum_i.csv'))
_, _, v, _ = readF.read(filesCum_i[-1])
sumF = np.zeros(len(v))
E = v**2*m2s2_to_eV
for Z in Zlist:
filename='time_*_Z_{:.1f}_fCum_i.csv'.format(Z)
filesCum_i = sorted(glob.glob(path+filename))
time, x, v, f_i = readF.read(filesCum_i[-1])
time, rCum, v, f_i = readF.read(filesCum_i[-1])
sumF += f_i[0]
plt.plot(v**2*m_i*0.5/e, f_i[0]*e/m_i/v, label=Z)
plt.plot(E, 4.0*np.pi*rCum[0]**2*f_i[0]/E, label=Z)
plt.plot(E, 4.0*np.pi*rCum[0]**2*sumF/E, label='sum', color='k', linestyle='dashed')
print(time)
plt.plot(v**2*m_i*0.5/e, sumF*e/m_i/v, label='sum', color='k', linestyle='dashed')
plt.yscale('log')
plt.ylim([1e16,5e27])
plt.ylabel('Sum f(e) / sqrt(e) (m^-3 eV^-1)')
plt.ylim([1e8,5e11])
plt.ylabel('dN / dE (eV^-1)')
plt.xscale('log')
plt.xlim([1e0,1e4])
plt.xlabel('e (eV)')

View file

@ -12,7 +12,8 @@ from scipy.constants import e, k
# paths = ['../quasiNeutral_partialAblation/','../Poisson_partialAblation/']
# paths = ['../2024-10-02_14.30.44/']
# paths = ['../quasiNeutral_fullAblation/','../Poisson_fullAblation/']
paths = ['../2025-04-09_16.45.52/']
# paths = ['../2025-04-10_11.59.02/']
paths = ['../polytropic_80ns_T30/']
labels = [path[3:-1] for path in paths]
for path, label in zip(paths, labels):
@ -21,7 +22,7 @@ for path, label in zip(paths, labels):
start = 80
end = 85#len(filesPhi)
every = 1
fig, ax = plt.subplots(4, sharex='all')
fig, ax = plt.subplots(3, sharex='all')
ax[1].set_yscale('log')
ax[1].set_ylim(bottom=1e10, top=1e24)
_, r, _, _, _ = readPhi.read(filesPhi[0])
@ -50,7 +51,6 @@ for path, label in zip(paths, labels):
ax[1].plot(r, sum_Zni)
ax[1].plot(r, n_e, color='k', linestyle='dashed')
ax[2].plot(r, ave_ui)
ax[3].plot(r, ave_Ti)
ax[0].set_title(label)
ax[0].legend()

View file

@ -8,7 +8,7 @@ def read(filename):
df = pandas.read_csv(filename,skiprows=2,nrows=1)
Z = df['Z'].to_numpy()[0]
df = pandas.read_csv(filename,skiprows=2,nrows=1,header=None)
df = pandas.read_csv(filename,skiprows=4,nrows=1,header=None)
x = df.to_numpy()[0][1:]
df = pandas.read_csv(filename,skiprows=5,header=None)
f = []