torus Subroutine

private subroutine torus(params, spp)

Arguments

Type IntentOptional AttributesName
type(KORC_PARAMS), intent(in) :: params
type(SPECIES), intent(inout) :: spp

Calls

proc~~torus~~CallsGraph proc~torus torus proc~get_randoms get_randoms proc~torus->proc~get_randoms proc~set_random_dist set_random_dist proc~torus->proc~set_random_dist proc~init_random_seed init_random_seed proc~torus->proc~init_random_seed proc~get_random get_random proc~get_randoms->proc~get_random omp_get_thread_num omp_get_thread_num proc~set_random_dist->omp_get_thread_num proc~get_random->omp_get_thread_num interface~random_get_number random_get_number proc~get_random->interface~random_get_number

Contents

Source Code


Source Code

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