Store BES 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) | :: | neut_type | Neutral type (full,half,third,halo) |
subroutine store_bes_photons(pos, vi, photons, neut_type)
!+ Store BES 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) :: neut_type
!+ Neutral type (full,half,third,halo)
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,nchan
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(bes_spectrum)
spec%bes(bin,ichan,neut_type)= &
spec%bes(bin,ichan,neut_type) + intensity(i)
!$OMP END CRITICAL(bes_spectrum)
enddo loop_over_stark
enddo loop_over_channels
end subroutine store_bes_photons