Calculates mean gyro-radius
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
Mean gyro-radius
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