In = np.array([0.0, 1600.0, 3120, 4450.0]) Bn = np.array([0.0, 0.05818182, 0.11345455, 0.16181818]) # =============================================================================== # Perform Trajectory calculation for Trajectory Sweep # =============================================================================== AngleComponents = [] Coordinates = [] Parameters = [] TrajectoryList = [] OutputPath = './tmp/' Color = ['b', 'g', 'r', 'c'] B = BfieldTF(B0=0.0) Bv = BfieldVF(B0=0.0) T = Trajectory(Vessel, B, Bv, v0=Vinjection[0], Method=None) for i, B0 in enumerate(Bn): for j, alph in enumerate(alpha): B = BfieldTF(B0=B0) Bv = BfieldVF(B0=0.00000) V0 = Vinjection[j] T.init_condition(Vessel, B, Bv, v0=V0, Method='LeapFrog') T.LineColor = Color[j] T.PlotParticle() T.PlotBV() TrajectoryList.append(T) np.savetxt("./tmp/Traject_{:d}_{:d}.dat".format(j, i), np.array(T.r)) AngleComponents.append([T.target.VAngle, T.target.HAngle])
Coordinates = [] Parameters = [] trajectory = [] beam = [] targetellipse = [] OutputPath = '../output/' # Color=['k','g','r','c','b','m','g','r','c','b','m','g'] plt.figure(11) Vessel.PlotCorners2D(Xlim=[-2.0, 2.0], scale=100.0) Count = 0.0 MaxCount = len(Bv0) * len(Bn) * 1.0 for j in range(len(Bv0)): for i in range(len(Bn)): B = BfieldTF(B0=Bn[i]) Bv = BfieldVF(B0=Bv0[j]) # Calcuate Trajectory T = Trajectory(Vessel, B, Bv, v0=Vinjection, T0=Energy) T.LineColor = CMAP(1.0 * i / len(Bn)) T.target.LineColor = CMAP(1.0 * i / len(Bn)) T.LineWidth = 2.0 T.target.LineWidth = 2.0 trajectory.append(T) # Calcuate Sigma and Beamspot IonBeam = Beam(T, SInput) IonBeam.Trace() beam.append(IonBeam) targetellipse.append(Ellipse(IonBeam.sigma[-1])) plt.figure(10) IonBeam.target.PlotProjection() plt.figure(11)
import numpy as np import pylab as pl import scipy.special as sp from numpy.linalg import norm import matplotlib as mpl R = np.array([1, 0, 0]) RInj = [1.798, -0.052, 0.243] # ------------------------------------------------------------------------------ # Define Toroidal Field TF = BfieldTF() # ------------------------------------------------------------------------------ # Define Vertical Field VF = BfieldVF(B0=1.0) # =============================================================================== # B Field Plotting Functions # =============================================================================== # ------------------------------------------------------------------------------ # Plot Elliptic Integrals of the 1st and 2nd kind, used for vertical field def PlotEllipticInt(): Ni = 1000 Ek = [] Ee = [] for i in range(Ni): K1 = sp.ellipk(1.0 * i / Ni)
'mycolors', ['green', 'blue', 'black', 'red', 'orange']) # =============================================================================== # Perform Trajectory calculation for B-Field Sweep # =============================================================================== AngleComponents = [] Coordinates = [] Parameters = [] TrajectoryList = [] OutputPath = '../output/' # Color=['k','g','r','c','b','m','g','r','c','b','m','g'] for i in range(len(Bn)): B = BfieldTF(B0=0.0) Bv = BfieldVF(B0=Bn[i]) T = Trajectory(Vessel, B, Bv, v0=Vinjection, T0=Energy) T.LineColor = CMAP(1.0 * i / len(Bn)) T.LineWidth = 2.0 TrajectoryList.append(T) # ------------------------------------------------------------------------------ # Save Target parameters # T.Target.SaveTargetParameters(TFCurrent=In[i],Path=OutputPath+'geometry/') # append lists of Target Quantities # AngleComponents.append([T.Target.VAngle,T.Target.HAngle]) # Coordinates.append([T.Target.R,T.Target.Z,T.Target.Phi]) # Parameters.append(T.Target.GetDetectionParameters()) # ------------------------------------------------------------------------------