Get guiding center fast-ion density at given energy and pitch
at position pos
or beam_grid indices ind
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in) | :: | energy | Energy [keV] |
||
real(kind=Float64), | intent(in) | :: | pitch | Pitch |
||
real(kind=Float64), | intent(out) | :: | denf | Fast-ion density [fast-ions/(cm^3dEdp)] |
||
real(kind=Float64), | intent(in), | optional | dimension(3) | :: | pos | Position in beam grid coordinates |
integer(kind=Int32), | intent(in), | optional | dimension(3) | :: | ind | beam_grid indices |
type(InterpolCoeffs2D), | intent(in), | optional | :: | coeffs | Precomputed Linear Interpolation Coefficients |
subroutine get_ep_denf(energy, pitch, denf, pos, ind, coeffs)
!+ Get guiding center fast-ion density at given energy and pitch
!+ at position `pos` or [[libfida:beam_grid]] indices `ind`
real(Float64), intent(in) :: energy
!+ Energy [keV]
real(Float64), intent(in) :: pitch
!+ Pitch
real(Float64), intent(out) :: denf
!+ Fast-ion density [fast-ions/(cm^3*dE*dp)]
real(Float64), dimension(3), intent(in), optional :: pos
!+ Position in beam grid coordinates
integer(Int32), dimension(3), intent(in), optional :: ind
!+ [[libfida:beam_grid]] indices
type(InterpolCoeffs2D), intent(in), optional :: coeffs
!+ Precomputed Linear Interpolation Coefficients
real(Float64), dimension(3) :: xyz, uvw
real(Float64), dimension(fbm%nenergy,fbm%npitch) :: fbeam
integer(Int32), dimension(2) :: epi
integer(Int32), dimension(1) :: dummy
real(Float64) :: R, Z
real(Float64) :: dE, dp
integer :: err
dummy = minloc(abs(fbm%energy - energy))
epi(1) = dummy(1)
dummy = minloc(abs(fbm%pitch - pitch))
epi(2) = dummy(1)
dE = abs(fbm%energy(epi(1)) - energy)
dp = abs(fbm%pitch(epi(2)) - pitch)
if((dE.le.fbm%dE).and.(dp.le.fbm%dp)) then
if(present(coeffs)) then
call interpol(inter_grid%r, inter_grid%z, fbm%f, R, Z, fbeam, err, coeffs)
else
if(present(ind)) call get_position(ind,xyz)
if(present(pos)) xyz = pos
!! Convert to machine coordinates
call xyz_to_uvw(xyz,uvw)
R = sqrt(uvw(1)*uvw(1) + uvw(2)*uvw(2))
Z = uvw(3)
call interpol(inter_grid%r, inter_grid%z, fbm%f, R, Z, fbeam, err)
endif
denf = fbeam(epi(1),epi(2))
else
denf = 0.0
endif
end subroutine get_ep_denf