gyro_radius Function

public function gyro_radius(fields, energy, pitch) result(gyro_rad)

Calculates mean gyro-radius

Arguments

Type IntentOptional AttributesName
type(LocalEMFields), intent(in) :: fields

Electromagnetic fields at guiding center

real(kind=Float64), intent(in) :: energy

Energy of particle

real(kind=Float64), intent(in) :: pitch

Particle pitch w.r.t the magnetic field

Return Value real(kind=Float64)

Mean gyro-radius


Calls

proc~~gyro_radius~~CallsGraph proc~gyro_radius gyro_radius proc~pitch_to_vec pitch_to_vec proc~gyro_radius->proc~pitch_to_vec proc~gyro_step gyro_step proc~gyro_radius->proc~gyro_step proc~cross_product cross_product proc~gyro_step->proc~cross_product

Contents

Source Code


Source Code

function gyro_radius(fields, energy, pitch) result (gyro_rad)
    !+ Calculates mean gyro-radius
    type(LocalEMFields), intent(in)          :: fields
        !+ Electromagnetic fields at guiding center
    real(Float64), intent(in)                :: energy
        !+ Energy of particle
    real(Float64), intent(in)                :: pitch
        !+ Particle pitch w.r.t the magnetic field
    real(Float64) :: gyro_rad
        !+ Mean gyro-radius

    real(Float64), dimension(3) :: vi_norm, r_step
    real(Float64) :: vabs, phi
    integer :: i,n

    vabs  = sqrt(energy/(v2_to_E_per_amu*inputs%ab))

    gyro_rad = 0.d0
    n = 6
    do i=1,n
        phi = i*2*pi/n
        call pitch_to_vec(pitch, phi, fields, vi_norm)
        call gyro_step(vabs*vi_norm, fields, r_step)
        gyro_rad = gyro_rad + norm2(r_step)/n
    enddo

end function gyro_radius