get_beam_cx_rate Subroutine

public subroutine get_beam_cx_rate(ind, pos, v_ion, i_type, types, rate_tot)

Get probability of a thermal ion charge exchanging with types neutrals

Arguments

Type IntentOptional AttributesName
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):: rate_tot

Total charge exchange rate [1/s]


Calls

proc~~get_beam_cx_rate~~CallsGraph proc~get_beam_cx_rate get_beam_cx_rate proc~bb_cx_rates bb_cx_rates proc~get_beam_cx_rate->proc~bb_cx_rates proc~get_plasma get_plasma proc~get_beam_cx_rate->proc~get_plasma proc~bt_cx_rates bt_cx_rates proc~get_beam_cx_rate->proc~bt_cx_rates interface~interpol_coeff interpol_coeff proc~bb_cx_rates->interface~interpol_coeff proc~get_position get_position proc~get_plasma->proc~get_position proc~xyz_to_uvw xyz_to_uvw proc~get_plasma->proc~xyz_to_uvw proc~in_plasma in_plasma proc~get_plasma->proc~in_plasma proc~uvw_to_xyz uvw_to_xyz proc~get_plasma->proc~uvw_to_xyz proc~bt_cx_rates->interface~interpol_coeff proc~cyl_to_xyz cyl_to_xyz proc~get_position->proc~cyl_to_xyz proc~cyl_interpol3d_coeff cyl_interpol3D_coeff interface~interpol_coeff->proc~cyl_interpol3d_coeff proc~interpol1d_coeff interpol1D_coeff interface~interpol_coeff->proc~interpol1d_coeff proc~interpol2d_coeff_arr interpol2D_coeff_arr interface~interpol_coeff->proc~interpol2d_coeff_arr proc~interpol2d_coeff interpol2D_coeff interface~interpol_coeff->proc~interpol2d_coeff proc~cyl_interpol3d_coeff_arr cyl_interpol3D_coeff_arr interface~interpol_coeff->proc~cyl_interpol3d_coeff_arr proc~interpol1d_coeff_arr interpol1D_coeff_arr interface~interpol_coeff->proc~interpol1d_coeff_arr proc~in_plasma->proc~xyz_to_uvw proc~in_plasma->interface~interpol_coeff proc~cyl_to_uvw cyl_to_uvw proc~in_plasma->proc~cyl_to_uvw proc~cyl_interpol3d_coeff->proc~interpol2d_coeff proc~cyl_to_xyz->proc~uvw_to_xyz proc~cyl_to_xyz->proc~cyl_to_uvw proc~interpol2d_coeff_arr->proc~interpol2d_coeff proc~cyl_interpol3d_coeff_arr->proc~cyl_interpol3d_coeff proc~cyl_interpol3d_coeff_arr->proc~interpol2d_coeff proc~interpol1d_coeff_arr->proc~interpol1d_coeff

Called by

proc~~get_beam_cx_rate~~CalledByGraph proc~get_beam_cx_rate get_beam_cx_rate proc~npa_weights npa_weights proc~npa_weights->proc~get_beam_cx_rate proc~npa_f npa_f proc~npa_f->proc~get_beam_cx_rate proc~npa_mc npa_mc proc~npa_mc->proc~get_beam_cx_rate program~fidasim fidasim program~fidasim->proc~npa_weights program~fidasim->proc~npa_f program~fidasim->proc~npa_mc

Contents

Source Code


Source Code

subroutine get_beam_cx_rate(ind, pos, v_ion, i_type, types, rate_tot)
    !+ 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) :: rate_tot
        !+ Total charge exchange rate [1/s]

    integer :: n, i, j, k, 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)

    n = size(types)
    rate_tot = 0

    i = ind(1) ; j = ind(2) ; k = ind(3)
    do ii=1,n
        select case (types(ii))
            case (nbif_type)
                vn = vnbi
                call bb_cx_rates(neut%full(:,i,j,k),v_ion,vn,rates)
            case (nbih_type)
                vn = vnbi/sqrt(2.0)
                call bb_cx_rates(neut%half(:,i,j,k),v_ion,vn,rates)
            case (nbit_type)
                vn = vnbi/sqrt(3.0)
                call bb_cx_rates(neut%third(:,i,j,k),v_ion,vn,rates)
            case (dcx_type)
                call get_plasma(plasma, pos=pos)
                call bt_cx_rates(plasma,neut%dcx(:,i,j,k),v_ion,i_type,rates)
            case (halo_type)
                call get_plasma(plasma, pos=pos)
                call bt_cx_rates(plasma,neut%halo(:,i,j,k),v_ion,i_type,rates)
        end select
        rate_tot = rate_tot + rates
    enddo

end subroutine get_beam_cx_rate