n_e as boundary condition
Now n_e is given as the density at the boundary and n_i at the boundary is calculated once Z is known. This aims to eliminate the iterative process.
This commit is contained in:
parent
af63194cb2
commit
0c27b98e2e
6 changed files with 38 additions and 38 deletions
|
|
@ -175,13 +175,13 @@ module output
|
||||||
end do
|
end do
|
||||||
end subroutine writeOutputMom
|
end subroutine writeOutputMom
|
||||||
|
|
||||||
subroutine writeOutputBoundary(t, dt, n, u, Temp, Zinj)
|
subroutine writeOutputBoundary(t, dt, n, u, Temp, Z_Tne, Zinj)
|
||||||
use constantParameters, only: eV_to_K
|
use constantParameters, only: eV_to_K
|
||||||
use referenceValues, only: t_ref, n_ref, u_ref, Temp_ref
|
use referenceValues, only: t_ref, n_ref, u_ref, Temp_ref
|
||||||
|
|
||||||
integer, intent(in):: t
|
integer, intent(in):: t
|
||||||
real(dp), intent(in):: dt
|
real(dp), intent(in):: dt
|
||||||
real(dp), intent(in):: n, u, Temp, Zinj
|
real(dp), intent(in):: n, u, Temp, Z_Tne, Zinj
|
||||||
character(len=6), parameter:: filename = 'bc.csv'
|
character(len=6), parameter:: filename = 'bc.csv'
|
||||||
logical:: res
|
logical:: res
|
||||||
|
|
||||||
|
|
@ -189,14 +189,14 @@ module output
|
||||||
if (.not. res) then
|
if (.not. res) then
|
||||||
write (*, '(A, A)') 'Writing: ', filename
|
write (*, '(A, A)') 'Writing: ', filename
|
||||||
open(unit=dataBC_id, file=pathOutput // filename, action='write', position='append')
|
open(unit=dataBC_id, file=pathOutput // filename, action='write', position='append')
|
||||||
write(dataBC_id, '(A,4(' // formatSep // ',A))') 't (s)', 'n (m^-3)', 'u (m s^-1)', 'T (eV)','Zinj'
|
write(dataBC_id, '(A,5(' // formatSep // ',A))') 't (s)', 'n_i (m^-3)', 'u_i (m s^-1)', 'T_i (eV)', 'Zinj','Z_Tne'
|
||||||
close(dataBC_id)
|
close(dataBC_id)
|
||||||
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
open(unit=dataBC_id, file=pathOutput // filename, action='write', position='append')
|
open(unit=dataBC_id, file=pathOutput // filename, action='write', position='append')
|
||||||
write(dataBC_id, '(' // formatFloat // ',4('// formatSep // ',' // formatFloat // '))') &
|
write(dataBC_id, '(' // formatFloat // ',5('// formatSep // ',' // formatFloat // '))') &
|
||||||
t*dt*t_ref, n*n_ref, u*u_ref, Temp*Temp_ref/eV_to_K, Zinj
|
t*dt*t_ref, n*n_ref, u*u_ref, Temp*Temp_ref/eV_to_K, Zinj, Z_Tne
|
||||||
|
|
||||||
close(dataBC_id)
|
close(dataBC_id)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,17 @@ import numpy as np
|
||||||
import readBC
|
import readBC
|
||||||
|
|
||||||
|
|
||||||
paths = ['../polytropic_80ns_T30/']
|
paths = ['../2025-04-10_08.40.09/']
|
||||||
time, n, u, T, Zinj = readBC.read(paths[0] + 'bc.csv')
|
time, n_i, u_i, T_i, Zinj, Z_Tne = readBC.read(paths[0] + 'bc.csv')
|
||||||
|
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
|
|
||||||
|
n_e = n_i * Zinj
|
||||||
|
|
||||||
plt.plot(time, n / n[0], label = f"$n_i$ ($\\times {n[0] * 1e-6:.0e} \\; cm^{{-3}})$")
|
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 / T[0], label = f"$T \\; (\\times{T[0]:.1f} \\; eV)$")
|
plt.plot(time, T_i / T_i[0], label = f"$T \\; (\\times{T_i[0]:.1f} \\; eV)$")
|
||||||
plt.plot(time, Zinj, label = "Injection species")
|
plt.plot(time, Zinj, label = "Zinj")
|
||||||
|
plt.plot(time, Z_Tne, label = "Z_Tne")
|
||||||
plt.semilogy()
|
plt.semilogy()
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ m_i = 1.9712e-25
|
||||||
# paths = ['../2024-12-10_18.45.17/', '../Poisson_50ns_T30Z11/']
|
# 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 = ['../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 = ['../Poisson_partialAblation/','../Poisson_partialAblation_lowerT/','../Poisson_partialAblation_lowT/','../Poisson_partialAblation_highT/']
|
||||||
paths = ['../polytropic_80ns_T60/']
|
paths = ['../polytropic_80ns_T30/']
|
||||||
labels = [path[3:-1] for path in paths]
|
labels = [path[3:-1] for path in paths]
|
||||||
|
|
||||||
for path, label in zip(paths, labels):
|
for path, label in zip(paths, labels):
|
||||||
|
|
@ -26,10 +26,12 @@ for path, label in zip(paths, labels):
|
||||||
sumF = np.zeros(len(v))
|
sumF = np.zeros(len(v))
|
||||||
|
|
||||||
for Z in Zlist:
|
for Z in Zlist:
|
||||||
filesCum_i = sorted(glob.glob(path+'time_*_Z{:.0f}000_fCum_i.csv'.format(Z)))
|
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, x, v, f_i = readF.read(filesCum_i[-1])
|
||||||
sumF += f_i[0]
|
sumF += f_i[0]
|
||||||
plt.plot(v**2*m_i*0.5/e, f_i[0]*e/m_i/v, label=Z)
|
plt.plot(v**2*m_i*0.5/e, f_i[0]*e/m_i/v, label=Z)
|
||||||
|
print(time)
|
||||||
plt.plot(v**2*m_i*0.5/e, sumF*e/m_i/v, label='sum', color='k', linestyle='dashed')
|
plt.plot(v**2*m_i*0.5/e, sumF*e/m_i/v, label='sum', color='k', linestyle='dashed')
|
||||||
|
|
||||||
plt.yscale('log')
|
plt.yscale('log')
|
||||||
|
|
|
||||||
|
|
@ -12,15 +12,15 @@ from scipy.constants import e, k
|
||||||
# paths = ['../quasiNeutral_partialAblation/','../Poisson_partialAblation/']
|
# paths = ['../quasiNeutral_partialAblation/','../Poisson_partialAblation/']
|
||||||
# paths = ['../2024-10-02_14.30.44/']
|
# paths = ['../2024-10-02_14.30.44/']
|
||||||
# paths = ['../quasiNeutral_fullAblation/','../Poisson_fullAblation/']
|
# paths = ['../quasiNeutral_fullAblation/','../Poisson_fullAblation/']
|
||||||
paths = ['../2025-04-08_09.36.52/']
|
paths = ['../2025-04-09_16.45.52/']
|
||||||
labels = [path[3:-1] for path in paths]
|
labels = [path[3:-1] for path in paths]
|
||||||
|
|
||||||
for path, label in zip(paths, labels):
|
for path, label in zip(paths, labels):
|
||||||
Zlist = readZlist.read(path+'ZList.csv')
|
Zlist = readZlist.read(path+'ZList.csv')
|
||||||
filesPhi = sorted(glob.glob(path+'time_*_phi.csv'))
|
filesPhi = sorted(glob.glob(path+'time_*_phi.csv'))
|
||||||
start = 0
|
start = 80
|
||||||
end = 20#len(filesPhi)
|
end = 85#len(filesPhi)
|
||||||
every = 5
|
every = 1
|
||||||
fig, ax = plt.subplots(4, sharex='all')
|
fig, ax = plt.subplots(4, sharex='all')
|
||||||
ax[1].set_yscale('log')
|
ax[1].set_yscale('log')
|
||||||
ax[1].set_ylim(bottom=1e10, top=1e24)
|
ax[1].set_ylim(bottom=1e10, top=1e24)
|
||||||
|
|
@ -30,7 +30,8 @@ for path, label in zip(paths, labels):
|
||||||
ave_ui = np.zeros(len(r))
|
ave_ui = np.zeros(len(r))
|
||||||
ave_Ti = np.zeros(len(r))
|
ave_Ti = np.zeros(len(r))
|
||||||
for Z in Zlist:
|
for Z in Zlist:
|
||||||
filesMom_i = sorted(glob.glob(path+'time_*_Z{:.0f}000_mom_i.csv'.format(Z)))
|
filename='time_*_Z_{:.1f}_mom_i.csv'.format(Z)
|
||||||
|
filesMom_i = sorted(glob.glob(path+filename))
|
||||||
fileMom_i = filesMom_i[t]
|
fileMom_i = filesMom_i[t]
|
||||||
time, r, n_i, u_i, T_i, Zave = readMom.read(fileMom_i)
|
time, r, n_i, u_i, T_i, Zave = readMom.read(fileMom_i)
|
||||||
sum_Zni += Zave*n_i
|
sum_Zni += Zave*n_i
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,12 @@ def read(filename):
|
||||||
# Get time
|
# Get time
|
||||||
df = pandas.read_csv(filename)
|
df = pandas.read_csv(filename)
|
||||||
time = df['t (s)'].to_numpy()
|
time = df['t (s)'].to_numpy()
|
||||||
n = df['n (m^-3)'].to_numpy()
|
n = df['n_i (m^-3)'].to_numpy()
|
||||||
u = df['u (m s^-1)'].to_numpy()
|
u = df['u_i (m s^-1)'].to_numpy()
|
||||||
T = df['T (eV)'].to_numpy()
|
T = df['T_i (eV)'].to_numpy()
|
||||||
Zinj = df['Zinj'].to_numpy()
|
Zinj = df['Zinj'].to_numpy()
|
||||||
|
Z_Tne = df['Z_Tne'].to_numpy()
|
||||||
|
|
||||||
return time, n, u, T, Zinj
|
return time, n, u, T, Zinj, Z_Tne
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
28
vlaplex.f90
28
vlaplex.f90
|
|
@ -166,7 +166,7 @@ program VlaPlEx
|
||||||
write(*, '(A,ES0.4e3)') 'CFL: ', dt*vf/dr
|
write(*, '(A,ES0.4e3)') 'CFL: ', dt*vf/dr
|
||||||
|
|
||||||
nzMin = 3
|
nzMin = 3
|
||||||
nzMax = 14
|
nzMax = 13
|
||||||
nz = nzMax - nzMin + 1
|
nz = nzMax - nzMin + 1
|
||||||
nz = nz + 1 ! Add bin for low Z plasma
|
nz = nz + 1 ! Add bin for low Z plasma
|
||||||
! Allocate vectors
|
! Allocate vectors
|
||||||
|
|
@ -189,7 +189,7 @@ program VlaPlEx
|
||||||
n_e = 0.0_dp
|
n_e = 0.0_dp
|
||||||
T_e = 0.0_dp
|
T_e = 0.0_dp
|
||||||
Zave = 0.0_dp
|
Zave = 0.0_dp
|
||||||
Z_list(1) = 1.0_dp ! Low Z bin
|
Z_list(1) = 0.1_dp ! Low Z bin
|
||||||
do iz = nzMin, nzMax
|
do iz = nzMin, nzMax
|
||||||
Z_list(iz-nzMin+1+1) = float(iz)
|
Z_list(iz-nzMin+1+1) = float(iz)
|
||||||
end do
|
end do
|
||||||
|
|
@ -255,23 +255,17 @@ program VlaPlEx
|
||||||
do t = 1, nt
|
do t = 1, nt
|
||||||
time = t * dt + t0
|
time = t * dt + t0
|
||||||
|
|
||||||
! Find new \bar{Z}_i based on T and density
|
! Get boundary conditions for specific time
|
||||||
call boundaryConditions%get(time, n_bc, u_bc, Temp_bc)
|
call boundaryConditions%get(time, n_bc, u_bc, Temp_bc)
|
||||||
! Reset previous value
|
! Find new \bar{Z}_i based on T_e = Temp_bc and n_e = n_bc
|
||||||
Zave_bc_old = 0.0_dp
|
call TtoZne%get(Temp_bc, n_bc, Zave_bc)
|
||||||
! Initial guess based on average table
|
! Assign Z(T,n) to bin
|
||||||
call TtoZ%get(Temp_bc, Zave_bc)
|
|
||||||
z_inj = minloc(abs(Z_list - Zave_bc),1)
|
z_inj = minloc(abs(Z_list - Zave_bc),1)
|
||||||
Zave_bc = Z_list(z_inj)
|
! Calculate inject (sonic) speed
|
||||||
! Start iterative process based on T, n_e table
|
u_bc = sqrt(Z_list(z_inj)* Temp_bc)
|
||||||
do while (Zave_bc - Zave_bc_old > 0.1_dp)
|
! Calculate ion density to inject
|
||||||
Zave_bc_old = Zave_bc
|
n_bc = n_bc / Z_list(z_inj)
|
||||||
call TtoZne%get(Temp_bc, Zave_bc * n_bc, Zave_bc)
|
call writeOutputBoundary(t, dt, n_bc, u_bc, Temp_bc, Zave_bc, Z_list(z_inj))
|
||||||
end do
|
|
||||||
z_inj = minloc(abs(Z_list - Zave_bc),1)
|
|
||||||
Zave_bc = Z_list(z_inj)
|
|
||||||
u_bc = sqrt(Zave_bc * Temp_bc)
|
|
||||||
call writeOutputBoundary(t, dt, n_bc, u_bc, Temp_bc, Zave_bc)
|
|
||||||
|
|
||||||
! f0(j0:nv) = v(j0:nv)**2 / sqrt(PI*Temp_bc**3) * exp(-(v(j0:nv) - u_bc)**2 / Temp_bc)
|
! f0(j0:nv) = v(j0:nv)**2 / sqrt(PI*Temp_bc**3) * exp(-(v(j0:nv) - u_bc)**2 / Temp_bc)
|
||||||
f0(j0:nv) = 1.0_dp / sqrt(PI*Temp_bc) * exp(-(v(j0:nv) - u_bc)**2 / Temp_bc)
|
f0(j0:nv) = 1.0_dp / sqrt(PI*Temp_bc) * exp(-(v(j0:nv) - u_bc)**2 / Temp_bc)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue