store_fida_photons Subroutine

public subroutine store_fida_photons(pos, vi, photons, orbit_class)

Store fida photons in Spectra

Arguments

Type IntentOptional AttributesName
real(kind=Float64), intent(in), dimension(3):: pos

Position of neutral in beam grid coordinates

real(kind=Float64), intent(in), dimension(3):: vi

Velocitiy of neutral [cm/s]

real(kind=Float64), intent(in) :: photons

Photons from colrad [Ph/(s*cm^3)]

integer, intent(in), optional :: orbit_class

Orbit class ID


Calls

proc~~store_fida_photons~~CallsGraph proc~store_fida_photons store_fida_photons proc~get_indices get_indices proc~store_fida_photons->proc~get_indices proc~get_fields get_fields proc~store_fida_photons->proc~get_fields proc~spectrum spectrum proc~store_fida_photons->proc~spectrum proc~calc_perp_vectors calc_perp_vectors proc~get_fields->proc~calc_perp_vectors proc~in_plasma in_plasma proc~get_fields->proc~in_plasma interface~interpol_coeff interpol_coeff proc~in_plasma->interface~interpol_coeff proc~xyz_to_uvw xyz_to_uvw proc~in_plasma->proc~xyz_to_uvw proc~interpol2d_coeff interpol2D_coeff interface~interpol_coeff->proc~interpol2d_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~interpol1d_coeff_arr interpol1D_coeff_arr interface~interpol_coeff->proc~interpol1d_coeff_arr proc~interpol2d_coeff_arr->proc~interpol2d_coeff proc~interpol1d_coeff_arr->proc~interpol1d_coeff

Contents

Source Code


Source Code

subroutine store_fida_photons(pos, vi, photons, orbit_class)
    !+ Store fida photons in [[libfida:spectra]]
    real(Float64), dimension(3), intent(in) :: pos
        !+ Position of neutral in beam grid coordinates
    real(Float64), dimension(3), intent(in) :: vi
        !+ Velocitiy of neutral [cm/s]
    real(Float64), intent(in)               :: photons
        !+ Photons from [[libfida:colrad]] [Ph/(s*cm^3)]
    integer, intent(in), optional           :: orbit_class
        !+ Orbit class ID

    real(Float64), dimension(n_stark) :: lambda, intensity
    real(Float64) :: dlength, sigma_pi
    type(LocalEMFields) :: fields
    integer(Int32), dimension(3) :: ind
    real(Float64), dimension(3) :: vp
    type(LOSInters) :: inter
    integer :: ichan, i, j, bin, iclass, nchan

    if(present(orbit_class)) then
        iclass = orbit_class
    else
        iclass = 1
    endif

    call get_indices(pos,ind)
    inter = spec_chords%inter(ind(1),ind(2),ind(3))
    nchan = inter%nchan
    if(nchan.eq.0) return

    call get_fields(fields,pos=pos)

    loop_over_channels: do j=1,nchan
        ichan = inter%los_elem(j)%id
        dlength = inter%los_elem(j)%length
        sigma_pi = spec_chords%los(ichan)%sigma_pi
        vp = pos - spec_chords%los(ichan)%lens
        call spectrum(vp,vi,fields,sigma_pi,photons, &
                      dlength,lambda,intensity)

        loop_over_stark: do i=1,n_stark
            bin=floor((lambda(i)-inputs%lambdamin)/inputs%dlambda) + 1
            if (bin.lt.1) cycle loop_over_stark
            if (bin.gt.inputs%nlambda) cycle loop_over_stark
            !$OMP CRITICAL(fida_spectrum)
            spec%fida(bin,ichan,iclass)= &
              spec%fida(bin,ichan,iclass) + intensity(i)
            !$OMP END CRITICAL(fida_spectrum)
        enddo loop_over_stark
    enddo loop_over_channels

end subroutine store_fida_photons