Attenuate states
along a trajectory
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(3) | :: | ri | Initial position in beam grid coordinates |
|
real(kind=Float64), | intent(in), | dimension(3) | :: | rf | Final position in beam grid coordinates |
|
real(kind=Float64), | intent(in), | dimension(3) | :: | vi | Initial velocity of neutral |
|
real(kind=Float64), | intent(inout), | dimension(nlevs) | :: | states | Density of states |
|
real(kind=Float64), | intent(in), | optional | :: | dstep_in | Step length [cm] |
subroutine attenuate(ri, rf, vi, states, dstep_in)
!+ Attenuate `states` along a trajectory
real(Float64), dimension(3), intent(in) :: ri
!+ Initial position in beam grid coordinates
real(Float64), dimension(3), intent(in) :: rf
!+ Final position in beam grid coordinates
real(Float64), dimension(3), intent(in) :: vi
!+ Initial velocity of neutral
real(Float64), dimension(nlevs), intent(inout) :: states
!+ Density of states
real(Float64), intent(in), optional :: dstep_in
!+ Step length [cm]
type(LocalProfiles) :: plasma
real(Float64) :: photons, vabs, dt, dstep, dis,max_dis
real(Float64), dimension(3) :: r0
real(Float64), dimension(nlevs) :: dens
logical :: inp
integer :: ncross
if(present(dstep_in)) then
dstep=dstep_in
else
dstep = sqrt(inter_grid%da) !cm
endif
max_dis = norm2(rf-ri)
vabs = norm2(vi)
dt = dstep/vabs
call get_plasma(plasma,pos=ri)
r0 = ri
dis = 0.d0
ncross = 0
inp = plasma%in_plasma
do while (dis.le.max_dis)
call colrad(plasma,beam_mass,vi,dt,states,dens,photons)
r0 = r0 + vi*dt
dis = dis + dstep
call get_plasma(plasma,pos=r0)
if(inp.neqv.plasma%in_plasma) then
ncross = ncross + 1
inp = plasma%in_plasma
endif
enddo
if(ncross.gt.1) states = 0.0
end subroutine attenuate