Evolve density of states in time dt
via collisional radiative model
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(LocalProfiles), | intent(in) | :: | plasma | Plasma parameters |
||
integer, | intent(in) | :: | i_type | Ion/Neutral type (beam,thermal) |
||
real(kind=Float64), | intent(in), | dimension(:) | :: | vn | Neutral velocitiy [cm/s] |
|
real(kind=Float64), | intent(in) | :: | dt | Time interval [s] |
||
real(kind=Float64), | intent(inout), | dimension(:) | :: | states | Density of states |
|
real(kind=Float64), | intent(out), | dimension(nlevs) | :: | dens | Density of neutrals |
|
real(kind=Float64), | intent(out) | :: | photons | Emitted photons(3->2) |
subroutine colrad(plasma,i_type,vn,dt,states,dens,photons)
!+ Evolve density of states in time `dt` via collisional radiative model
type(LocalProfiles), intent(in) :: plasma
!+ Plasma parameters
integer, intent(in) :: i_type
!+ Ion/Neutral type (beam,thermal)
real(Float64), dimension(:), intent(in) :: vn
!+ Neutral velocitiy [cm/s]
real(Float64), intent(in) :: dt
!+ Time interval [s]
real(Float64), dimension(:), intent(inout) :: states
!+ Density of states
real(Float64), dimension(nlevs), intent(out) :: dens
!+ Density of neutrals
real(Float64), intent(out) :: photons
!+ Emitted photons(3->2)
real(Float64), dimension(nlevs,nlevs) :: matrix !! Matrix
real(Float64) :: b_amu
real(Float64) :: vnet_square !! net velocity of neutrals squared
real(Float64) :: eb !! Energy of the fast neutral
real(Float64), dimension(nlevs,nlevs) :: eigvec, eigvec_inv
real(Float64), dimension(nlevs) :: eigval, coef
real(Float64), dimension(nlevs) :: exp_eigval_dt
real(Float64) :: iflux !!Initial total flux
integer :: n
photons=0.d0
dens=0.d0
iflux=sum(states)
if(iflux.lt.colrad_threshold .and. inputs%calc_npa.eq.0)then
return
endif
if(.not.plasma%in_plasma) then
dens = states*dt
return
endif
if(i_type.eq.beam_ion) then
b_amu = inputs%ab
else
b_amu = inputs%ai
endif
vnet_square=dot_product(vn-plasma%vrot,vn-plasma%vrot) ![cm/s]
eb = v2_to_E_per_amu*b_amu*vnet_square ![kev]
call get_rate_matrix(plasma, i_type, eb, matrix)
call eigen(nlevs,matrix, eigvec, eigval)
call matinv(eigvec, eigvec_inv)
coef = matmul(eigvec_inv, states)!coeffs determined from states at t=0
exp_eigval_dt = exp(eigval*dt) ! to improve speed (used twice)
do n=1,nlevs
if(eigval(n).eq.0.0) eigval(n)=eigval(n)+1 !protect against dividing by zero
enddo
states = matmul(eigvec, coef * exp_eigval_dt) ![neutrals/cm^3/s]!
dens = matmul(eigvec,coef*(exp_eigval_dt-1.d0)/eigval)
if ((minval(states).lt.0).or.(minval(dens).lt.0)) then
do n=1,nlevs
if(states(n).lt.0) states(n)=0.d0
if(dens(n).lt.0) dens(n)=0.d0
enddo
endif
photons=dens(3)*tables%einstein(2,3) !! - [Ph/(s*cm^3)] - !!
end subroutine colrad