Store fida photons in Spectra
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
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