Store neutral birth location of the photon source
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(3) | :: | pos | Birth location of the photon source neutral |
|
real(kind=Float64), | intent(in) | :: | photons | Number of photons |
||
type(NeutralParticleReservoir), | intent(inout), | dimension(:) | :: | res | reservoir of neutral particles |
|
logical, | intent(in), | optional | :: | passive |
subroutine store_photon_birth(pos, photons, res, passive)
!+ Store neutral birth location of the photon source
real(Float64), dimension(3), intent(in) :: pos
!+ Birth location of the photon source neutral
real(Float64), intent(in) :: photons
!+ Number of photons
type(NeutralParticleReservoir), dimension(:), intent(inout) :: res
!+ reservoir of neutral particles
logical, intent(in), optional :: passive
integer :: i = 1, ichan
logical :: pas = .False.
real(Float64) :: cyl(3), pos_xyz(3)
integer(Int32) :: ind(3), nchan
type(LOSinters) :: inter
if(present(passive)) pas = passive
if(pas) then
cyl(1) = sqrt(pos(1)*pos(1) + pos(2)*pos(2))
cyl(2) = pos(3)
cyl(3) = atan2(pos(2), pos(1))
call get_passive_grid_indices(cyl,ind)
inter = spec_chords%cyl_inter(ind(1),ind(2),ind(3))
else
call get_indices(pos,ind)
inter = spec_chords%inter(ind(1),ind(2),ind(3))
endif
nchan = inter%nchan
if(nchan.eq.0) return
loop_over_channels: do i=1,nchan
ichan = inter%los_elem(i)%id
call update_reservoir(res(ichan), pos, photons)
enddo loop_over_channels
end subroutine store_photon_birth