Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
||
real(kind=rp), | intent(in), | DIMENSION(:,:), ALLOCATABLE | :: | Xcyl | Particles' position in cylindrical coordinates. Xcyl(1,:) = , Xcyl(2,:) = , Xcyl(3,:) = |
|
integer(kind=is), | intent(inout), | DIMENSION(:), ALLOCATABLE | :: | flag |
subroutine cyl_check_if_confined(F,Xcyl,flag)
implicit none
TYPE(FIELDS), INTENT(IN) :: F
!! An instance of the KORC derived type FIELDS.
REAL(rp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) :: Xcyl
!! Particles' position in cylindrical coordinates. Xcyl(1,:) = \(R\),
!! Xcyl(2,:) = \(\phi\), Xcyl(3,:) = \(Z\)
INTEGER(is), DIMENSION(:), ALLOCATABLE, INTENT(INOUT) :: flag
REAL(rp) :: a
!! Distance to plasma edge as measured from the magnetic axis.
REAL(rp) :: Ro
!! Radial position of the magnetic axis.
INTEGER :: pp
!! Iterator.
INTEGER :: ss
!! Iterator.
if (size(Xcyl,1).eq.1) then
ss = size(Xcyl,1)
else
if (Xcyl(2,1).eq.0) then
ss=1_idef
else
ss = size(Xcyl,1)
end if
endif
a = F%AB%a
Ro = F%AB%Ro
!$OMP PARALLEL DO FIRSTPRIVATE(ss,a,Ro) PRIVATE(pp) SHARED(Xcyl,flag)
do pp=1_idef,ss
if (sqrt((Xcyl(pp,1)-Ro)**2+Xcyl(pp,3)**2) .gt. a) then
flag(pp)=0_is
endif
end do
!$OMP END PARALLEL DO
end subroutine cyl_check_if_confined