Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params | |||
type(SPECIES), | intent(inout) | :: | spp |
subroutine torus(params,spp)
TYPE(KORC_PARAMS), INTENT(IN) :: params
TYPE(SPECIES), INTENT(INOUT) :: spp
REAL(rp), DIMENSION(:), ALLOCATABLE :: r
REAL(rp), DIMENSION(:), ALLOCATABLE :: theta
REAL(rp), DIMENSION(:), ALLOCATABLE :: zeta
ALLOCATE( theta(spp%ppp) )
ALLOCATE( zeta(spp%ppp) )
ALLOCATE( r(spp%ppp) )
! Initial condition of uniformly distributed particles on a disk in the xz-plane
! A unique velocity direction
! call init_u_random(10986546_8)
call init_random_seed()
! call RANDOM_NUMBER(theta)
! theta = 2.0_rp*C_PI*theta
call set_random_dist(0.0_rp, 2.0_rp*C_PI)
call get_randoms(theta)
! call init_random_seed()
! call RANDOM_NUMBER(zeta)
! zeta = 2.0_rp*C_PI*zeta
call get_randoms(zeta)
!
! Uniform distribution on a disk at a fixed azimuthal theta
! call init_random_seed()
! call RANDOM_NUMBER(r)
call set_random_dist(0.0_rp, 1.0_rp)
call get_randoms(r)
r = SQRT((spp%r_outter**2 - spp%r_inner**2)*r + spp%r_inner**2)
!$OMP PARALLEL WORKSHARE
spp%vars%X(:,1) = ( spp%Ro + r*COS(theta) )*SIN(zeta)
spp%vars%X(:,2) = ( spp%Ro + r*COS(theta) )*COS(zeta)
spp%vars%X(:,3) = spp%Zo + r*SIN(theta)
!$OMP END PARALLEL WORKSHARE
DEALLOCATE(theta)
DEALLOCATE(zeta)
DEALLOCATE(r)
end subroutine torus