Add recombination and ionization to model
This commit is contained in:
parent
ff9047cee5
commit
03b0619991
1 changed files with 64 additions and 2 deletions
66
vlaplex.f90
66
vlaplex.f90
|
|
@ -20,14 +20,36 @@
|
||||||
|
|
||||||
end module eos
|
end module eos
|
||||||
|
|
||||||
|
module Temperature
|
||||||
|
use constantParameters, only: dp
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
private
|
||||||
|
public:: T_function
|
||||||
|
|
||||||
|
contains
|
||||||
|
pure function T_function(T0,n0, ne, gamma_e) result(T)
|
||||||
|
use constantParameters, only: eV_to_K
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
real(dp), intent(in):: T0, n0, ne, gamma_e
|
||||||
|
real(dp):: T
|
||||||
|
|
||||||
|
T = T0 * (ne/n0)**(gamma_e -1.0_dp)
|
||||||
|
|
||||||
|
end function T_function
|
||||||
|
|
||||||
|
end module Temperature
|
||||||
program VlaPlEx
|
program VlaPlEx
|
||||||
use constantParameters, only: dp, kb, qe, eps_0, ev_to_K, cm3_to_m3, PI
|
use constantParameters, only: dp, kb, qe, eps_0, ev_to_K, cm3_to_m3, PI
|
||||||
use output
|
use output
|
||||||
use referenceValues
|
use referenceValues
|
||||||
use eos, only: T_to_Z
|
use eos, only: T_to_Z
|
||||||
|
use Temperature, only: T_function
|
||||||
use moduleTableBC
|
use moduleTableBC
|
||||||
use moduleTableTtoZ
|
use moduleTableTtoZ
|
||||||
use moduleTableTtoZne
|
use moduleTableTtoZne
|
||||||
|
use moduleTableRateCoeff
|
||||||
use omp_lib
|
use omp_lib
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
|
|
@ -60,6 +82,10 @@ program VlaPlEx
|
||||||
character(:), allocatable:: TtoZ_file
|
character(:), allocatable:: TtoZ_file
|
||||||
type(tableTtoZne):: TtoZne
|
type(tableTtoZne):: TtoZne
|
||||||
character(:), allocatable:: TtoZne_file
|
character(:), allocatable:: TtoZne_file
|
||||||
|
type(tableRateCoeff):: recombination_rateCoeff
|
||||||
|
character(:), allocatable:: recombination_rate_file
|
||||||
|
type(tableRateCoeff):: ionization_rateCoeff
|
||||||
|
character(:), allocatable:: ionization_rate_file
|
||||||
|
|
||||||
real(dp), allocatable, dimension(:,:,:):: f_i, f_i_old
|
real(dp), allocatable, dimension(:,:,:):: f_i, f_i_old
|
||||||
real(dp), allocatable, dimension(:):: f0 ! Boundary at r = x_0
|
real(dp), allocatable, dimension(:):: f0 ! Boundary at r = x_0
|
||||||
|
|
@ -81,6 +107,8 @@ program VlaPlEx
|
||||||
real(dp):: phiConv
|
real(dp):: phiConv
|
||||||
real(dp):: phi0
|
real(dp):: phi0
|
||||||
real(dp):: T_e
|
real(dp):: T_e
|
||||||
|
real(dp):: recombination_rate
|
||||||
|
real(dp):: ionization_rate
|
||||||
! real(dp):: phiF
|
! real(dp):: phiF
|
||||||
integer:: k
|
integer:: k
|
||||||
|
|
||||||
|
|
@ -107,6 +135,10 @@ program VlaPlEx
|
||||||
call TtoZ%init(TtoZ_file)
|
call TtoZ%init(TtoZ_file)
|
||||||
TtoZne_file = 'Zave_values_per_Ne.csv'
|
TtoZne_file = 'Zave_values_per_Ne.csv'
|
||||||
call TtoZne%init(TtoZne_file)
|
call TtoZne%init(TtoZne_file)
|
||||||
|
recombination_rate_file = 'dr.csv'
|
||||||
|
call recombination_rateCoeff%init(recombination_rate_file)
|
||||||
|
ionization_rate_file = 'ci.csv'
|
||||||
|
call ionization_rateCoeff%init(ionization_rate_file)
|
||||||
|
|
||||||
! Set domain boundaries (non-dimensional units)
|
! Set domain boundaries (non-dimensional units)
|
||||||
r0 = 10.0e-6_dp / L_ref
|
r0 = 10.0e-6_dp / L_ref
|
||||||
|
|
@ -184,6 +216,8 @@ program VlaPlEx
|
||||||
T_i = 0.0_dp
|
T_i = 0.0_dp
|
||||||
n_e = 0.0_dp
|
n_e = 0.0_dp
|
||||||
T_e = 0.0_dp
|
T_e = 0.0_dp
|
||||||
|
recombination_rate = 0.0_dp
|
||||||
|
ionization_rate = 0.0_dp
|
||||||
Zave = 0.0_dp
|
Zave = 0.0_dp
|
||||||
Z_list = (/ 6.0, 12.0 /)
|
Z_list = (/ 6.0, 12.0 /)
|
||||||
Zave_bc_old = 0.0_dp
|
Zave_bc_old = 0.0_dp
|
||||||
|
|
@ -277,9 +311,37 @@ program VlaPlEx
|
||||||
f_i_old(:,:,1) = 0.0_dp
|
f_i_old(:,:,1) = 0.0_dp
|
||||||
f_i_old(:,:,nv) = 0.0_dp
|
f_i_old(:,:,nv) = 0.0_dp
|
||||||
sum_ni = 0.0_dp
|
sum_ni = 0.0_dp
|
||||||
|
|
||||||
|
! --- Recombination Step --- !
|
||||||
|
do iz = 2, nz
|
||||||
|
do i = 2, nr
|
||||||
|
call recombination_rateCoeff%get(T_function(Temp_bc, n_e(1), n_e(i), gamma_e), Z_list(iz), recombination_rate)
|
||||||
|
! Recombination of current charge state
|
||||||
|
f_i(iz,i,:) = f_i_old(iz,i,:) - f_i_old(iz,i,:) * dt * recombination_rate * n_e(i)
|
||||||
|
|
||||||
|
! Transfer recombination density to lower charge state
|
||||||
|
f_i(iz - 1,i,:) = f_i_old(iz - 1,i,:) + f_i_old(iz,i,:) * dt * recombination_rate * n_e(i)
|
||||||
|
end do
|
||||||
|
f_i_old = f_i
|
||||||
|
end do
|
||||||
|
|
||||||
|
|
||||||
|
! --- Ionization Step --- !
|
||||||
|
do iz = 1, nz - 1
|
||||||
|
do i = 2, nr
|
||||||
|
call ionization_rateCoeff%get(T_function(Temp_bc, n_e(1), n_e(i), gamma_e), Z_list(iz), ionization_rate)
|
||||||
|
! Ionization of current charge state
|
||||||
|
f_i(iz,i,:) = f_i_old(iz,i,:) - f_i_old(iz,i,:) * dt * ionization_rate * n_e(i)
|
||||||
|
|
||||||
|
! Transfer ionization density to higher charge state
|
||||||
|
f_i(iz + 1,i,:) = f_i_old(iz + 1,i,:) + f_i_old(iz,i,:) * dt * ionization_rate * n_e(i)
|
||||||
|
end do
|
||||||
|
f_i_old = f_i
|
||||||
|
end do
|
||||||
|
|
||||||
! Advect in the r direction
|
! Advect in the r direction
|
||||||
do iz = 1, nz
|
do iz = 1, nz
|
||||||
if (all(n_i(iz,:) < 1.0e-16_dp) .and. iz .NE. z_inj) then
|
if (all(f_i(iz,:,:) < 1.0e-16_dp) .and. iz .NE. z_inj) then
|
||||||
cycle
|
cycle
|
||||||
end if
|
end if
|
||||||
!$omp parallel do
|
!$omp parallel do
|
||||||
|
|
@ -386,7 +448,7 @@ program VlaPlEx
|
||||||
f_i_old = f_i
|
f_i_old = f_i
|
||||||
|
|
||||||
do iz = 1, nz
|
do iz = 1, nz
|
||||||
if (all(n_i(iz,:) < 1.0e-16_dp) .and. iz .NE. z_inj) then
|
if (all(f_i(iz,:,:) < 1.0e-16_dp) .and. iz .NE. z_inj) then
|
||||||
cycle
|
cycle
|
||||||
end if
|
end if
|
||||||
! Advect in the v direction
|
! Advect in the v direction
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue