Gets plasma parameters at position pos
or beam_grid indices ind
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(LocalProfiles), | intent(out) | :: | plasma | Plasma parameters 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 |
subroutine get_plasma(plasma, pos, ind)
!+ Gets plasma parameters at position `pos` or [[libfida:beam_grid]] indices `ind`
type(LocalProfiles), intent(out) :: plasma
!+ Plasma parameters at `pos`/`ind`
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
logical :: inp
type(InterpolCoeffs2D) :: coeffs
real(Float64), dimension(3) :: xyz, uvw, vrot_uvw
real(Float64) :: phi, s, c
integer :: i, j
plasma%in_plasma = .False.
if(present(ind)) call get_position(ind,xyz)
if(present(pos)) xyz = pos
call in_plasma(xyz,inp,.False.,coeffs,uvw)
if(inp) then
phi = atan2(uvw(2),uvw(1))
i = coeffs%i
j = coeffs%j
plasma = coeffs%b11*equil%plasma(i,j) + coeffs%b12*equil%plasma(i,j+1) + &
coeffs%b21*equil%plasma(i+1,j) + coeffs%b22*equil%plasma(i+1,j+1)
s = sin(phi) ; c = cos(phi)
vrot_uvw(1) = plasma%vr*c - plasma%vt*s
vrot_uvw(2) = plasma%vr*s + plasma%vt*c
vrot_uvw(3) = plasma%vz
plasma%vrot = matmul(beam_grid%inv_basis,vrot_uvw)
plasma%pos = xyz
plasma%uvw = uvw
plasma%in_plasma = .True.
plasma%c = coeffs
endif
end subroutine get_plasma