I'm stupid and I deleted the previous repository...

So, code is working, this case reproduce a Diko's peak with Poisson
equation by changing the boundary conditions over time.
This commit is contained in:
Jorge Gonzalez 2024-09-26 17:58:45 +02:00
commit 8eab3b5610
13 changed files with 821 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,41 @@
import readPhi
import readF
import matplotlib.pyplot as plt
import glob
import numpy as np
from scipy.constants import e, k
m_i = 1.9712e-25
paths = ['../quasiNeutral_fullAblation/','../Poisson_fullAblation/']
# paths = ['../quasiNeutral_partialAblation/','../Poisson_partialAblation/']
for path in paths:
filesCum_i = sorted(glob.glob(path+'time_*_fCum_i.csv'))
start = 0
end = len(filesCum_i)
every = 100
for fileCum_i in filesCum_i[start:end:every]:
time, x, v, f_i = readF.read(fileCum_i)
plt.plot(v**2*m_i*0.5/e, f_i[0]*e/m_i/v, label='{:.3f} ns'.format(time*1e9))
time, x, v, f_i = readF.read(filesCum_i[-1])
plt.plot(v**2*m_i*0.5/e, f_i[0]*e/m_i/v, label='{:.3f} ns'.format(time*1e9), color='k')
plt.yscale('log')
plt.ylim([1e18,1e24])
plt.ylabel('Sum f(e) / sqrt(e) (m^-3 eV^-1)')
plt.xscale('log')
plt.xlim([1e0,1e4])
plt.xlabel('e (eV)')
plt.legend()
plt.title('r = {:.1f} mm, time_max={:.1f} ns '.format(x[0]*1e3, time*1e9) + path)
plt.show()

22
scripts_python/plotF.py Normal file
View file

@ -0,0 +1,22 @@
import readPhi
import readF
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
import glob
import numpy as np
from scipy.constants import e, k
path = '../2024-09-26_11.48.04/'
filesF_i = sorted(glob.glob(path+'time_*_f_i.csv'))
start = 0
end = len(filesF_i)
every = 50
time, x, v, f_i = readF.read(filesF_i[-1])
plt.title('t = {:.3f} ns'.format(time*1e9))
norm = Normalize(vmin=4., vmax=20., clip=False)
plt.imshow(np.log10(f_i), cmap='cividis', interpolation='None', aspect='auto', origin='lower', extent=[v[0],v[-1],x[0],x[-1]], norm=norm)
plt.show()

38
scripts_python/plotMom.py Normal file
View file

@ -0,0 +1,38 @@
import readPhi
import readMom
import readF
import matplotlib.pyplot as plt
import glob
import numpy as np
from scipy.constants import e, k
# paths = ['../quasiNeutral_fullAblation/','../2024-09-26_11.48.04/']
# paths = ['../2024-09-26_12.47.11/']
paths = ['../quasiNeutral_partialAblation/','../2024-09-26_13.58.24/']
# path = '../quasiNeutral_fullAblation/'
# path = '../quasiNeutral_partialAblatio/'
for path in paths:
filesPhi = sorted(glob.glob(path+'time_*_phi.csv'))
filesMom_i = sorted(glob.glob(path+'time_*_mom_i.csv'))
start = 0
end = len(filesMom_i)
every = 100
fig, ax = plt.subplots(4, sharex='all')
for fileMom_i, filePhi in zip(filesMom_i[start:end+1:every], filesPhi[start:end+1:every]):
time, r, phi, n_e = readPhi.read(filePhi)
time, r, n_i, u_i, T_i, Zave = readMom.read(fileMom_i)
ax[0].plot(r, phi, label='t = {:.3f} ns'.format(time*1e9))
ax[1].set_yscale('log')
ax[1].set_ylim([1e14,2e25])
ax[1].plot(r, Zave*n_i)
ax[1].plot(r, n_e, color='k', linestyle='dashed')
ax[2].plot(r, u_i)
ax[3].plot(r, T_i)
ax[0].set_title(path)
ax[0].legend()
plt.show()

18
scripts_python/readF.py Normal file
View file

@ -0,0 +1,18 @@
import pandas
def read(filename):
# Get time
df = pandas.read_csv(filename,skiprows=0,nrows=1)
time = df['t (s)'].to_numpy()[0]
df = pandas.read_csv(filename,skiprows=2,nrows=1,header=None)
x = df.to_numpy()[0][1:]
df = pandas.read_csv(filename,skiprows=3,header=None)
f = []
for col in df:
if col == 0:
v = df[col].to_numpy()
else:
f.append(df[col].to_numpy())
return time, x, v, f

17
scripts_python/readMom.py Normal file
View file

@ -0,0 +1,17 @@
import pandas
def read(filename):
# Get time
df = pandas.read_csv(filename,skiprows=0,nrows=1)
time = df['t (s)'].to_numpy()[0]
df = pandas.read_csv(filename,skiprows=2)
x = df['r (m)'].to_numpy()
n_i = df['n_i (m^-3)'].to_numpy()
u_i = df['u_i (m s^-1)'].to_numpy()
T_i = df['T_i (eV)'].to_numpy()
Z = df['Zave'].to_numpy()
return time, x, n_i, u_i, T_i, Z

15
scripts_python/readPhi.py Normal file
View file

@ -0,0 +1,15 @@
import pandas
def read(filename):
# Get time
df = pandas.read_csv(filename,skiprows=0,nrows=1)
time = df['t (s)'].to_numpy()[0]
df = pandas.read_csv(filename,skiprows=2)
x = df['r (m)'].to_numpy()
phi = df['phi (V)'].to_numpy()
n_e = df['n_e (m^-3)'].to_numpy()
return time, x, phi, n_e