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
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
do while (dis.le.max_dis)
call colrad(plasma,beam_ion,vi,dt,states,dens,photons)
r0 = r0 + vi*dt
dis = dis + dstep
call get_plasma(plasma,pos=r0)
enddo
end subroutine attenuate