Get probability of a thermal ion charge exchanging with neutral population within cell
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(nlevs) | :: | denn | Neutral density |
|
type(NeutralParticleReservoir), | intent(in) | :: | res | Neutral Particle Reservoir |
||
real(kind=Float64), | intent(in), | dimension(3) | :: | v_ion | Ion velocity [cm/s] |
|
real(kind=Float64), | intent(out), | dimension(nlevs) | :: | rates | Total charge exchange rate [1/s] |
subroutine neutral_cx_rate(denn, res, v_ion, rates)
!+ Get probability of a thermal ion charge exchanging with neutral
!+ population within cell
real(Float64), dimension(nlevs), intent(in) :: denn
!+ Neutral density
type(NeutralParticleReservoir), intent(in) :: res
!+ Neutral Particle Reservoir
real(Float64), dimension(3), intent(in) :: v_ion
!+ Ion velocity [cm/s]
real(Float64), dimension(nlevs), intent(out) :: rates
!+ Total charge exchange rate [1/s]
integer :: i
real(Float64), dimension(nlevs) :: rates_i
real(Float64) :: vn(3), totw
!! Average CX rate over Reservoir
rates = 0.d0
if(res%n.eq.0) return
totw = sum(res%R%w)
if(totw.eq.0.d0) return
do i=1, min(res%n,res%k)
vn = res%R(i)%v
call bb_cx_rates(denn,vn,v_ion,rates_i)
rates = rates + res%R(i)%w*rates_i
enddo
rates = rates/totw
end subroutine neutral_cx_rate