Gets Guiding Center distribution at position pos
or beam_grid indices ind
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(out), | dimension(:,:) | :: | fbeam | Guiding Center Fast-ion distribution at |
|
real(kind=Float64), | intent(out) | :: | denf | Guiding Center Fast-ion density at |
||
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_distribution(fbeam, denf, pos, ind, coeffs)
!+ Gets Guiding Center distribution at position `pos` or [[libfida:beam_grid]] indices `ind`
real(Float64), dimension(:,:), intent(out) :: fbeam
!+ Guiding Center Fast-ion distribution at `pos`/`ind`: F(E,p)
real(Float64), intent(out) :: denf
!+ Guiding Center Fast-ion density at `pos`/`ind` [fast-ions/cm^3]
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) :: R, Z
integer :: err
if(present(coeffs)) then
call interpol(fbm%r, fbm%z, fbm%f, R, Z, fbeam, err, coeffs)
call interpol(fbm%r, fbm%z, fbm%denf, R, Z, denf, 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(fbm%r, fbm%z, fbm%f, R, Z, fbeam, err)
call interpol(fbm%r, fbm%z, fbm%denf, R, Z, denf, err)
endif
end subroutine get_distribution