Convert sightline position and velocity from cylindrical coordinate rpz
to beam coordinate xyz
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | ie3 | CFPD energy index |
||
integer, | intent(in) | :: | ist | Step index |
||
integer, | intent(in) | :: | iray | "Ray" index |
||
integer, | intent(in) | :: | ich | Detector channel |
||
real(kind=Float64), | intent(out), | dimension(3) | :: | xyz | Sightline position in beam coordinates |
|
real(kind=Float64), | intent(out), | dimension(3) | :: | v3_xyz | Sightline velocity in beam coordinates |
subroutine convert_sightline_to_xyz(ie3, ist, iray, ich, xyz, v3_xyz)
!+ Convert sightline position and velocity from cylindrical coordinate `rpz` to beam coordinate `xyz`
integer, intent(in) :: ie3
!+ CFPD energy index
integer, intent(in) :: ist
!+ Step index
integer, intent(in) :: iray
!+ "Ray" index
integer, intent(in) :: ich
!+ Detector channel
real(Float64), dimension(3), intent(out) :: xyz
!+ Sightline position in beam coordinates
real(Float64), dimension(3), intent(out) :: v3_xyz
!+ Sightline velocity in beam coordinates
real(Float64), dimension(3) :: rpz, uvw, v3_rpz, v3_uvw
real(Float64) :: phi
!! Position
rpz(1) = ctable%sightline(ie3,4,ist,iray,ich)
rpz(2) = ctable%sightline(ie3,5,ist,iray,ich)
rpz(3) = ctable%sightline(ie3,6,ist,iray,ich)
phi = rpz(2)
uvw(1) = rpz(1)*cos(phi)
uvw(2) = rpz(1)*sin(phi)
uvw(3) = rpz(3)
call uvw_to_xyz(uvw, xyz)
!! Velocity
v3_rpz(1) = ctable%sightline(ie3,1,ist,iray,ich)
v3_rpz(2) = ctable%sightline(ie3,2,ist,iray,ich)
v3_rpz(3) = ctable%sightline(ie3,3,ist,iray,ich)
v3_uvw(1) = v3_rpz(1)*cos(phi) - v3_rpz(2)*sin(phi)
v3_uvw(2) = v3_rpz(1)*sin(phi) + v3_rpz(2)*cos(phi)
v3_uvw(3) = v3_rpz(3)
v3_xyz = matmul(beam_grid%inv_basis, v3_uvw)
end subroutine convert_sightline_to_xyz