single-particle-motion/tokamak.py

33 lines
710 B
Python

#!/usr/bin/python3
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
#rc('font',**{'family':'serif','serif':['Computer Modern']})
#rc('text', usetex=True)
from scipy.special import ellipe,ellipk
from boris import *
m = m_el
q = e
i = 80 # tok v ovoju
N = 1500 # stevilo ovojev
I = i*N
a = 1.5 # ovoj
b = 0.8 + 0.5*a
v0 = np.array([-0.1,-0.15,0.])*c
v0 = np.array([0.8, -0.48, 0.3595])*c
x0 = np.array([2., 0.,0.])
x0 = np.array([0.,0.0,-0.8])
E = lambda x: np.array([0.,0.,0.])
B = lambda x: tokamak(x, a, b, I, 16)
B = lambda x: B_bottle(x, 1., 5., I) + B_loop(x,4.)*100*8000
dt = 1.5e-12
tdur = 3e-7
#dt = 2e-11
#tdur = 1e-6
X,V = boris(x0, v0, E, B, dt, tdur, q, m)
plot3(X)