RFOF - RF Library for Orbit Following Codes
/Users/thomas/codes/rfof/trunk/testbed/dum_magnetic_field.F90
Go to the documentation of this file.
00001 
00007 
00008 module dum_magnetic_field
00009 
00010   implicit none
00011 
00013   type, public :: magnetic_field_global
00014      real(8) :: B0
00015      real(8) :: R0
00016      real(8) :: q
00017      real(8) :: aminor
00018   end type magnetic_field_global
00019 
00020   type(magnetic_field_global) :: Bglobal
00021 
00022 contains
00023 
00024   subroutine magnetic_field_constructor_simple_field(R0,B0,q,aminor,Bfield)
00025 
00026     real(8), intent(in) :: R0, B0, q, aminor
00027     type(magnetic_field_global), intent(out) :: Bfield
00028 
00029     Bfield%R0=R0
00030     Bfield%B0=B0
00031     Bfield%q =q
00032     Bfield%aminor=aminor
00033 
00034   end subroutine magnetic_field_constructor_simple_field
00035 
00036   subroutine local_field_from_dum_magnetic_field(R,phi,z, &
00037        psi,theta,Bmod,F,psi_Estatic,dBmod_dpsi,dF_dpsi,dBmod_dtheta,dF_dtheta)
00038 
00039     real(8), intent(in) :: R
00040     real(8), intent(in) :: phi
00041     real(8), intent(in) :: z
00042 
00043     real(8), intent(out) :: psi
00044     real(8), intent(out) :: theta
00045 
00046     real(8), intent(out) :: Bmod
00047     real(8), intent(out) :: F
00048     real(8), intent(out) :: psi_Estatic
00049 
00050     real(8), intent(out) :: dBmod_dpsi 
00051     real(8), intent(out) :: dF_dpsi
00052     real(8), intent(out) :: dBmod_dtheta
00053     real(8), intent(out) :: dF_dtheta
00054 
00055     real(8) :: rmin, q
00056 
00057     rmin = sqrt( (R-Bglobal%R0)**2 + z**2 )
00058     q = Bglobal%q
00059     psi = rmin**2 * Bglobal%B0/(2*q)
00060     !psia = Bglobal%aminor**2 * Bglobal%B0/(2*q)
00061     !Btheta = Bglobal%B0 * r / ( q * x1 )
00062 
00063     psi          = psi
00064     theta        = sign(1d0,z)*acos((R-Bglobal%R0)/rmin)
00065 
00066     Bmod         = Bglobal%B0 * Bglobal%R0 / R
00067     F            = Bglobal%B0 * Bglobal%R0
00068     !Btheta       = Btheta
00069     !BR           =-Btheta * z/rmin
00070     !Bz           = Btheta * (R-Bglobal%R0)/rmin
00071     psi_Estatic  = 0.0
00072 
00073     dBmod_dpsi   = 0.0
00074     dBmod_dtheta = 0.0
00075     dF_dpsi      = 0.0
00076     dF_dtheta    = 0.0
00077 
00078   end subroutine local_field_from_dum_magnetic_field
00079 
00080 end module dum_magnetic_field