from lib.BeamDynamicsTools.Boundary import Boundary from lib.BeamDynamicsTools.Bfield import Bfield, BfieldTF, BfieldVF from lib.BeamDynamicsTools.Trajectory import Trajectory from lib.BeamDynamicsTools.Beam import Beam from lib.BeamDynamicsTools.Ellipse import Ellipse import numpy as np import pylab as pl import timeit # Import poloidal boundary points Rb = np.loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[0]) Zb = np.loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[1]) # ------------------------------------------------------------------------------ # Generate vessel boundary Vessel = Boundary(Rb, Zb) # ------------------------------------------------------------------------------ plt.figure(1) Vessel.Border() plt.figure(2) Vessel.Plot2D(2) # ------------------------------------------------------------------------------ # 3D plot of vessel boundary ax = Vessel.Figure3D(3) Vessel.Plot3D(ax) # =============================================================================== # Test Case for in-out detection algorithm
import sys import os sys.path.append(os.path.join('../')) from lib.BeamDynamicsTools.Boundary import Boundary from lib.BeamDynamicsTools.Bfield import Bfield, BfieldTF, BfieldVF, Bfieldc from lib.BeamDynamicsTools.Trajectory import Trajectory from lib.BeamDynamicsTools.Beam import Beam from lib.BeamDynamicsTools.Ellipse import Ellipse import numpy as np import pylab as pl Rb = [0.1, 0.1, 100.0, 100.0] Zb = [-100.0, 100.0, 100.0, -100.0] Vessel = Boundary(Rb, Zb) # Vessel.Plot2D(0) if False: B = Bfieldc(B0=0.1) Bv = Bfieldc(B0=0.0001) d0 = 10.0 dS = np.logspace(-5, -2, 15) dr = [] T = [] for i in range(len(dS)): # T.append(Trajectory(Vessel,B,r0=[20.0,0.0,0.0],v0=[0.0,0.0,1.0],dS=dS[i],Nmax=round(d0/dS[i])) ) T.append( Trajectory(Vessel, B, Bv,
from lib.BeamDynamicsTools.Trajectory import Trajectory from lib.BeamDynamicsTools.Beam import Beam # =============================================================================== # Calculate trajectory and sigma matrix evolution for 4 values of toroidal B # =============================================================================== # Input Sigma Matrix S1 = np.matrix(np.loadtxt('../data/SigmaInjection.dat')) # Import poloidal boundary points Rb = np.loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[0]) Zb = np.loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[1]) # Generate vessel boundary Vessel = Boundary(Rb, Zb) # 3D plot of vessel boundary ax = Vessel.Figure3D(1) Vessel.Plot3D(ax) # Inputs for four B-field settings In = np.array([0.0, 1600.0, 3120, 4450.0]) Bn = np.array([0.0, 0.05818182, 0.11345455, 0.16181818]) # =============================================================================== # Perform Trajectory and sigma dynamics calculation for B-Field Sweep # =============================================================================== AngleComponents = [] Coordinates = []
from lib.BeamDynamicsTools.Bfield import Bfield, BfieldTF, BfieldVF from lib.BeamDynamicsTools.Trajectory import Trajectory from lib.BeamDynamicsTools.Beam import Beam # =============================================================================== # Calculate trajectory matrix evolution for 4 values of toroidal B # =============================================================================== # ------------------------------------------------------------------------------ # Import poloidal boundary points Rb = np.loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[0]) Zb = np.loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[1]) # ------------------------------------------------------------------------------ # Generate vessel Boundary Vessel = Boundary(Rb, Zb) # ------------------------------------------------------------------------------ # 3D plot of vessel boundary ax = Vessel.Figure3D(1) Vessel.Plot3D(ax) # ------------------------------------------------------------------------------ # Inputs for four B-field settings In = np.array([0.0, 1600.0, 3120, 4450.0]) Bn = np.array([0.0, 0.05818182, 0.11345455, 0.16181818]) # =============================================================================== # Perform Trajectory and sigma dynamics calculation for B-Field Sweep # ===============================================================================
] #Energy = [0.594e6, 0.740e6, 0.900e6] Energy = 0.9e6 # np.linspace(0.594e6,0.900e6,10) # ------------------------------------------------------------------------------ # Input Sigma Matrix SInput = np.matrix(np.loadtxt('../data/SigmaInjection.dat')) # ------------------------------------------------------------------------------ # Import poloidal Boundary points Rb = np.loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[0]) Zb = np.loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[1]) # ------------------------------------------------------------------------------ # Generate vessel Boundary Vessel = Boundary(Rb, Zb) # ------------------------------------------------------------------------------ # 3D plot of vessel Boundary ax = Vessel.Figure3D() Vessel.Plot3D(ax) # ------------------------------------------------------------------------------ # Inputs for B-field settings #In = np.array([ 0.0, 1600.0 ,3120 ,4450.0]) #Bn = np.array([ 0.0, 0.05818182, 0.11345455, 0.16181818 ]) #Bn = np.array([0.10,0.20, 0.30, 0.40]) #Bn = np.array([0.0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40,0.45]) #Bn = np.linspace(0.0,0.45,19) #Bn = np.linspace(-0.45,0.45,50) Bn = np.linspace(-0.45, 0.45, 11)
sys.path.append(os.path.join('../')) from lib.BeamDynamicsTools.Boundary import Boundary from lib.BeamDynamicsTools.Bfield import Bfield, BfieldTF, BfieldVF, Bfieldc from lib.BeamDynamicsTools.Trajectory import Trajectory from lib.BeamDynamicsTools.Beam import Beam from lib.BeamDynamicsTools.Ellipse import Ellipse import numpy as np import pylab as pl L0 = 0.1 L1 = 10.0 Rb = [L0, L0, L1, L1, L0] Zb = [0.0, L1, L1, -L1, -L1] Vessel = Boundary(Rb, Zb) Vessel.Plot2D(0) # R = m v / q B -> v = np.sqrt(2 E / m) -> np.sqrt( 2 m E) / q B #DATA = np.loadtxt('CmodCoordinatesRZ.txt') #Rb=[]; Zb=[]; # for i in range(len(DATA[:,0])): # Rb.append(DATA[i,0]) # Zb.append(DATA[i,1]) Vessel = Boundary(Rb, Zb) Vessel.Plot2D(0) # R = np.sqrt(2 M E)*(c/B) R0 = 1.0
Rinjection = [1.798, -0.052, 0.243] Vinjection = [ -np.cos(alpha) * np.cos(beta), np.cos(alpha) * np.sin(beta), -np.sin(alpha) ] #Energy = [0.594e6, 0.740e6, 0.900e6] Energy = 0.9e6 # np.linspace(0.594e6,0.900e6,10) # ------------------------------------------------------------------------------ # Import poloidal Boundary points Rb = np.loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[0]) Zb = np.loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[1]) # ------------------------------------------------------------------------------ # Generate vessel Boundary Vessel = Boundary(Rb, Zb) # ------------------------------------------------------------------------------ # 3D plot of vessel Boundary ax = Vessel.Figure3D() Vessel.Plot3D(ax) # ------------------------------------------------------------------------------ # Inputs for B-field settings #In = np.array([ 0.0, 1600.0 ,3120 ,4450.0]) #Bn = np.array([ 0.0, 0.05818182, 0.11345455, 0.16181818 ]) #Bn = np.array([0.10,0.20, 0.30, 0.40]) #Bn = np.array([0.0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40,0.45]) #Bn = np.linspace(0.0,0.45,19) Bn = np.linspace(-0.45, 0.45, 50) #Bn = np.array([0.0])