Add BC plotting routine
This commit is contained in:
parent
a26af0d121
commit
13fa6c7efd
3 changed files with 41 additions and 7 deletions
|
|
@ -146,9 +146,9 @@ module output
|
||||||
write(dataPhi_id, '('//formatFloat//')') t*dt*t_ref
|
write(dataPhi_id, '('//formatFloat//')') t*dt*t_ref
|
||||||
write(dataPhi_id, '(A)') "Z"
|
write(dataPhi_id, '(A)') "Z"
|
||||||
write(dataPhi_id, '('//formatFloat//')') Z_list(j)
|
write(dataPhi_id, '('//formatFloat//')') Z_list(j)
|
||||||
write(dataPhi_id, '(A,4('//formatSep//',A))') "r (m)","n_i (m^-3)","u_i (m s^-1)", "T_i (eV)"
|
write(dataPhi_id, '(A,3('//formatSep//',A))') "r (m)","n_i (m^-3)","u_i (m s^-1)", "T_i (eV)"
|
||||||
do i = 1, nr
|
do i = 1, nr
|
||||||
write(dataPhi_id, '('//formatFloat//',4('//formatSep //','//formatFloat//'))') &
|
write(dataPhi_id, '('//formatFloat//',3('//formatSep //','//formatFloat//'))') &
|
||||||
r(i)*L_ref, &
|
r(i)*L_ref, &
|
||||||
n_i(j,i)*n_ref, &
|
n_i(j,i)*n_ref, &
|
||||||
u_i(j,i)*u_ref, &
|
u_i(j,i)*u_ref, &
|
||||||
|
|
@ -160,13 +160,13 @@ module output
|
||||||
end do
|
end do
|
||||||
end subroutine writeOutputMom
|
end subroutine writeOutputMom
|
||||||
|
|
||||||
subroutine writeOutputBoundary(t, dt, n, u, Temp, Z)
|
subroutine writeOutputBoundary(t, dt, n, u, Temp, TtoZ, 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, Z
|
real(dp), intent(in):: n, u, Temp, TtoZ, Zinj
|
||||||
character(len=6), parameter:: filename = 'bc.csv'
|
character(len=6), parameter:: filename = 'bc.csv'
|
||||||
logical:: res
|
logical:: res
|
||||||
|
|
||||||
|
|
@ -174,14 +174,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)', 'Z'
|
write(dataBC_id, '(A,5(' // formatSep // ',A))') 't (s)', 'n (m^-3)', 'u (m s^-1)', 'T (eV)', 'TtoZ','Zinj'
|
||||||
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, Z
|
t*dt*t_ref, n*n_ref, u*u_ref, Temp*Temp_ref/eV_to_K, TtoZ, Zinj
|
||||||
|
|
||||||
close(dataBC_id)
|
close(dataBC_id)
|
||||||
|
|
||||||
|
|
|
||||||
19
scripts_python/plotBC.py
Normal file
19
scripts_python/plotBC.py
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import glob
|
||||||
|
import numpy as np
|
||||||
|
import readBC
|
||||||
|
|
||||||
|
|
||||||
|
fileBC = glob.glob('../2025-02-10_11.14.59/bc.csv')
|
||||||
|
time, n, u, T, TtoZ, Zinj = readBC.read(fileBC[0])
|
||||||
|
|
||||||
|
fig, ax = plt.subplots()
|
||||||
|
|
||||||
|
|
||||||
|
plt.plot(time, n / n[0] , label = f"$n_i$ ($\\times {n[0] * 1e-6} \\; cm^{{-3}})$")
|
||||||
|
plt.plot(time, T / T[0], label = f"$T \\; (\\times{T[0]} \\; eV)$")
|
||||||
|
plt.plot(time, TtoZ, label = "$Z$")
|
||||||
|
plt.plot(time, Zinj, label = "Injection species")
|
||||||
|
plt.semilogy()
|
||||||
|
plt.legend()
|
||||||
|
plt.show()
|
||||||
15
scripts_python/readBC.py
Normal file
15
scripts_python/readBC.py
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import pandas
|
||||||
|
|
||||||
|
def read(filename):
|
||||||
|
# Get time
|
||||||
|
df = pandas.read_csv(filename)
|
||||||
|
time = df['t (s)'].to_numpy()
|
||||||
|
n = df['n (m^-3)'].to_numpy()
|
||||||
|
u = df['u (m s^-1)'].to_numpy()
|
||||||
|
T = df['T (eV)'].to_numpy()
|
||||||
|
TtoZ = df['TtoZ'].to_numpy()
|
||||||
|
Zinj = df['Zinj'].to_numpy()
|
||||||
|
|
||||||
|
return time, n, u, T, TtoZ, Zinj
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue