Get probability of a thermal ion charge exchanging with types
neutrals
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=Int32), | intent(in), | dimension(3) | :: | ind | beam_grid indices |
|
real(kind=Float64), | intent(in), | dimension(3) | :: | pos | Interaction position in beam grid coordinates |
|
real(kind=Float64), | intent(in), | dimension(3) | :: | v_ion | Ion velocity [cm/s] |
|
integer, | intent(in) | :: | i_type | Ion type |
||
integer(kind=Int32), | intent(in), | dimension(:) | :: | types | Neutral types |
|
real(kind=Float64), | intent(out), | dimension(nlevs) | :: | prob | Charge exchange rate/probability [1/s] |
subroutine get_beam_cx_rate(ind, pos, v_ion, i_type, types, prob)
!+ Get probability of a thermal ion charge exchanging with `types` neutrals
integer(Int32), dimension(3), intent(in) :: ind
!+ [[libfida:beam_grid]] indices
real(Float64), dimension(3), intent(in) :: pos
!+ Interaction position in beam grid coordinates
real(Float64), dimension(3), intent(in) :: v_ion
!+ Ion velocity [cm/s]
integer, intent(in) :: i_type
!+ Ion type
integer(Int32), dimension(:), intent(in) :: types
!+ Neutral types
real(Float64), dimension(nlevs), intent(out) :: prob
!+ Charge exchange rate/probability [1/s]
integer :: ntypes, i, ii
type(LocalProfiles) :: plasma
real(Float64), dimension(nlevs) :: rates, denn
real(Float64), dimension(3) :: vhalo,vn,vnbi
vnbi = pos - nbi%src
vnbi = nbi%vinj*vnbi/norm2(vnbi)
ntypes = size(types)
prob = 0
do i=1,ntypes
if((types(i).le.3).and.(types(i).ne.0)) then
! CX with full type'th energy NBI neutrals
denn = neut%dens(:,types(i),ind(1),ind(2),ind(3))
vn = vnbi/sqrt(real(types(i)))
call bb_cx_rates(denn,v_ion,vn,rates)
prob = prob+rates
else
call get_plasma(plasma,pos=pos)
denn = neut%dens(:,types(i),ind(1),ind(2),ind(3))
call bt_cx_rates(plasma, denn, v_ion, i_type, rates)
prob = prob + rates
endif
enddo
end subroutine get_beam_cx_rate