Evolve density of states in time dt
via collisional radiative model
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(LocalProfiles), | intent(in) | :: | plasma | Plasma parameters |
||
real(kind=Float64), | intent(in) | :: | ab | Ion/Neutral mass [amu] |
||
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 |
subroutine colrad(plasma,ab,vn,dt,states,dens,photons)
!+ Evolve density of states in time `dt` via collisional radiative model
type(LocalProfiles), intent(in) :: plasma
!+ Plasma parameters
real(Float64), intent(in) :: ab
!+ Ion/Neutral mass [amu]
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
real(Float64), dimension(nlevs,nlevs) :: matrix !! Matrix
real(Float64) :: vnet_square !! net velocity of neutrals squared
real(Float64) :: eb !! Energy of the fast neutral
real(Float64), dimension(nlevs,nlevs) :: eigvec
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(.not.plasma%in_plasma) then
dens = states*dt
return
endif
vnet_square=dot_product(vn-plasma%vrot,vn-plasma%vrot) ![cm/s]
eb = v2_to_E_per_amu*ab*vnet_square ![kev]
call get_rate_matrix(plasma, ab, eb, matrix)
call eigen(nlevs,matrix, eigvec, eigval)
call linsolve(eigvec,states,coef) !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)
where (states.lt.0)
states = 0.d0
endwhere
where (dens.lt.0)
dens = 0.d0
endwhere
photons=dens(initial_state)*tables%einstein(final_state,initial_state) !! - [Ph/(s*cm^3)] - !!
end subroutine colrad