示例#1
0
sc_path_length_min = 0.00000001
sizeX = 9  #number of grid points in horizontal direction
sizeY = 9  #number of grid points in vertical direction
sizeZ = 1  #number of longitudinal slices in the 2.5D space charge solver
calc2p5d = SpaceChargeForceCalc2p5D(sizeX, sizeY, sizeZ)
#calc2p5d.trackBunch(b, lattice_length)
directforceLatticeModifications.setDirectForce2p5DAccNodes(
    lattice, sc_path_length_min, calc2p5d)

#
#------------------------------------

paramsDict = {}
paramsDict["bunch"] = b

lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch1.dat")
lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch2.dat")
lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch3.dat")
lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch4.dat")
lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch5.dat")
for i in range(95):
    lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch100.dat")

print "Stop."
示例#2
0
tailfrac = 0
tailfac = 1
zlim = 120. * 248. / 360.
zmin = -zlim
zmax = zlim
emean = 1.0
esigma = 0.001
etrunc = 1
emin = 0.997
emax = 1.003

sp = b.getSyncParticle()
xFunc = JohoTransverse(order, alphax, betax, emitlim, xcenterpos, xcentermom,
                       tailfrac, tailfac)
yFunc = JohoTransverse(order, alphay, betay, emitlim, ycenterpos, ycentermom,
                       tailfrac, tailfac)
lFunc = GULongDist(zmin, zmax, sp, emean, esigma, etrunc, emin, emax)

#------------------------------
# Inject some particles
#------------------------------

nparts = 10000
inject = InjectParts(nparts, b, lostfoilbunch, foilparams, xFunc, yFunc, lFunc)
inject.addParticles()

bunch_pyorbit_to_orbit(248.0, b, "pybunch.dat")
lostfoilbunch.dumpBunch("pylostbunch.dat")
print "Stop."
quit()
b = Bunch()

#
ORBIT_file_name = "Bm_Parts_1_0"
ORBIT_NEW_file_name = "new_orbit_file.dat"
pyORBIT_DUMP_file_name = "pyorbit_bunch_dump_test.dat"

kineticEnergy = 1.0
ringLength = 248.0

time_start = time.clock()

bunch_orbit_to_pyorbit(ringLength, kineticEnergy, ORBIT_file_name,b)
print "rank=",rank," n_parts=",b.getSize()
bunch_pyorbit_to_orbit(ringLength, b, ORBIT_NEW_file_name)
time_exec = time.clock() - time_start
if(rank == 0): print "time[sec]=",time_exec

b.dumpBunch(pyORBIT_DUMP_file_name)

x_sum = 0.
xp_sum = 0.
y_sum = 0.
yp_sum = 0.
phi_sum = 0.
dE_sum = 0.	

for i in range(b.getSize()):
	x = b.x(i)
	xp = b.xp(i)
示例#4
0
#------------------------------
#Make a Teapot Lattice
#------------------------------

print "Generate Lattice."
lattice = TEAPOT_Lattice("no_sc_lattice")
lattice.readMAD("./LATTICES/Q_0p125.LAT", "FODO")

# set the number of sections in quads to the same as for ORBIT_MPI
for acc_elem in lattice.getNodes():
    if (acc_elem.getType() == "quad teapot"):
        acc_elem.setnParts(5)

print "lattice length=", lattice.getLength()

# dump initial bunch for ORBIT_MPI input
bunch_pyorbit_to_orbit(lattice.getLength(), b, "orbit_mpi_bunch_input.dat")

#=====track bunch ============
ACC_TURNS = 1
print("Tracking.")
for i in range(ACC_TURNS):
    lattice.trackBunch(b)
    print "Turn ", i

# dump ORBIT_MPI bunch to compare results
bunch_pyorbit_to_orbit(lattice.getLength(), b,
                       "orbit_mpi_bunch_from_pyorbit_output.dat")

print("STOP.")
示例#5
0
ESet = AddErrorSet(lattice, positioni, positionf, setDict, paramsDict)

z = 0.0
print "Start lattice, z = ", z

# set the number of sections in quads to the same as for ORBIT_MPI
for acc_elem in lattice.getNodes():
    z += acc_elem.getLength()
    print "Node = ", acc_elem.getName()," type = ", acc_elem.getType(),\
        " L = ", acc_elem.getLength(), " N child nodes = ",\
        acc_elem.getNumberOfChildren(), " z = ", z
    if (acc_elem.getType() == "quad teapot"):
        acc_elem.setnParts(5)

print "lattice length=", lattice.getLength()

# dump initial bunch for ORBIT_MPI input
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch_input.dat")

#=====track bunch ============
ACC_TURNS = 1
print("Tracking.")
for i in range(ACC_TURNS):
    lattice.trackBunch(b)
    print "Turn ", i

# dump ORBIT_MPI bunch to compare results
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch_output.dat")

print("STOP.")
示例#6
0
zmin = -zlim
zmax = zlim
deltaEfrac = 0.001 / 2.
eoffset = 0.1
sp = b.getSyncParticle()

xFunc = JohoTransverse(order, alphax, betax, emitlim, xcenterpos, xcentermom,
                       tailfrac, tailfac)
yFunc = JohoTransverse(order, alphay, betay, emitlim, ycenterpos, ycentermom,
                       tailfrac, tailfac)
lFunc = UniformLongDist(zmin, zmax, sp, eoffset, deltaEfrac)

nparts = 10000.

injectnode = TeapotInjectionNode(nparts, b, lostbunch, injectparams, xFunc,
                                 yFunc, lFunc)

addTeapotInjectionNode(teapot_latt, 0., injectnode)

print "===========Lattice modified ======================================="
print "New Lattice=", teapot_latt.getName(
), " length [m] =", teapot_latt.getLength(), " nodes=", len(
    teapot_latt.getNodes())

injectnode.track(paramsDict)

# dump ORBIT_MPI bunch to compare results
bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "mainbunch.dat")
bunch_pyorbit_to_orbit(teapot_latt.getLength(), lostbunch, "lostbunch.dat")
print "Stop."
示例#7
0
					theta=math.atan2(y,x)
					if(r != 0.):
						forcex += -rhogrid.getValueOnGrid(k,l) * 1/(r) * math.cos(theta)
						forcey += -rhogrid.getValueOnGrid(k,l) * 1/(r) * math.sin(theta)
			file_out.write(str(i) + " " + str(j) + " " + str(forcex) + " " + str(forcey) + "\n")
file_out.close()

#Get the force grid from the space charge calculator
file_out = open("pyforce.dat","w")
forcegridx = calc2p5d.getForceGridX()
forcegridy = calc2p5d.getForceGridY()
for i in range(forcegridx.getSizeX()):
	for j in range(forcegridx.getSizeY()):
		file_out.write(str(i) + " " + str(j) + " " + str(forcegridx.getValueOnGrid(i,j)) + " " + str(forcegridy.getValueOnGrid(i,j)) + "\n")		
file_out.close()

print "===========Lattice modified ======================================="
print "New Lattice=",lattice.getName()," length [m] =",lattice.getLength()," nodes=",len(lattice.getNodes())

#------------------------------------

paramsDict = {}
paramsDict["bunch"]= b
print "tracking done"
b.dumpBunch("pybunch.dat")
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch.dat")
print "Stop."



示例#8
0
macrosperturn = 260
macrosize = intensity/turns/macrosperturn

b = Bunch()
b.mass(0.93827231)
b.macroSize(macrosize)
energy = 1.0 #Gev
b.readBunch("kv.dat")
b.getSyncParticle().kinEnergy(energy)

paramsDict = {}
lostbunch = Bunch()
paramsDict["lostbunch"]=lostbunch
paramsDict["bunch"]= b
lostbunch.addPartAttr("LostParticleAttributes") 

#=====Make a Teapot style lattice======

teapot_latt = teapot.TEAPOT_Ring()
print "Read MAD."
teapot_latt.readMAD("MAD_Lattice/SNSring_pyOrbitBenchmark.LAT","RING")
print "Lattice=",teapot_latt.getName()," length [m] =",teapot_latt.getLength()," nodes=",len(teapot_latt.getNodes())
lattlength = teapot_latt.getLength()

bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "kv_orbit.dat")

print "Stop."



示例#9
0
turns = 1000.0
macrosperturn = 260
macrosize = intensity / turns / macrosperturn

b = Bunch()
b.mass(0.93827231)
b.macroSize(macrosize)
energy = 1.0  #Gev
b.readBunch("kv.dat")
b.getSyncParticle().kinEnergy(energy)

paramsDict = {}
lostbunch = Bunch()
paramsDict["lostbunch"] = lostbunch
paramsDict["bunch"] = b
lostbunch.addPartAttr("LostParticleAttributes")

#=====Make a Teapot style lattice======

teapot_latt = teapot.TEAPOT_Ring()
print "Read MAD."
teapot_latt.readMAD("MAD_Lattice/SNSring_pyOrbitBenchmark.LAT", "RING")
print "Lattice=", teapot_latt.getName(
), " length [m] =", teapot_latt.getLength(), " nodes=", len(
    teapot_latt.getNodes())
lattlength = teapot_latt.getLength()

bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "kv_orbit.dat")

print "Stop."
b = Bunch()

#
ORBIT_file_name = "Bm_Parts_1_0"
ORBIT_NEW_file_name = "new_orbit_file.dat"
pyORBIT_DUMP_file_name = "pyorbit_bunch_dump_test.dat"

kineticEnergy = 1.0
ringLength = 248.0

time_start = time.clock()

bunch_orbit_to_pyorbit(ringLength, kineticEnergy, ORBIT_file_name, b)
print "rank=", rank, " n_parts=", b.getSize()
bunch_pyorbit_to_orbit(ringLength, b, ORBIT_NEW_file_name)
time_exec = time.clock() - time_start
if (rank == 0): print "time[sec]=", time_exec

b.dumpBunch(pyORBIT_DUMP_file_name)

x_sum = 0.
xp_sum = 0.
y_sum = 0.
yp_sum = 0.
phi_sum = 0.
dE_sum = 0.

for i in range(b.getSize()):
    x = b.x(i)
    xp = b.xp(i)
示例#11
0
                        r) * math.sin(theta)
        file_out.write(
            str(i) + " " + str(j) + " " + str(forcex) + " " + str(forcey) +
            "\n")
file_out.close()

#Get the force grid from the space charge calculator
file_out = open("pyforce.dat", "w")
forcegridx = calc2p5d.getForceGridX()
forcegridy = calc2p5d.getForceGridY()
for i in range(forcegridx.getSizeX()):
    for j in range(forcegridx.getSizeY()):
        file_out.write(
            str(i) + " " + str(j) + " " +
            str(forcegridx.getValueOnGrid(i, j)) + " " +
            str(forcegridy.getValueOnGrid(i, j)) + "\n")
file_out.close()

print "===========Lattice modified ======================================="
print "New Lattice=", lattice.getName(), " length [m] =", lattice.getLength(
), " nodes=", len(lattice.getNodes())

#------------------------------------

paramsDict = {}
paramsDict["bunch"] = b
print "tracking done"
b.dumpBunch("pybunch.dat")
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch.dat")
print "Stop."
示例#12
0
ESet  = AddErrorSet(lattice, positioni, positionf, setDict, paramsDict)

z = 0.0
print "Start lattice, z = ", z

# set the number of sections in quads to the same as for ORBIT_MPI
for acc_elem in lattice.getNodes():
	z += acc_elem.getLength()
	print "Node = ", acc_elem.getName()," type = ", acc_elem.getType(),\
	    " L = ", acc_elem.getLength(), " N child nodes = ",\
	    acc_elem.getNumberOfChildren(), " z = ", z
	if(acc_elem.getType() == "quad teapot"):
		acc_elem.setnParts(5)

print "lattice length=",lattice.getLength()

# dump initial bunch for ORBIT_MPI input
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch_input.dat")

#=====track bunch ============
ACC_TURNS = 1
print("Tracking.")
for i in range(ACC_TURNS):
	lattice.trackBunch(b)
	print "Turn ",i

# dump ORBIT_MPI bunch to compare results
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch_output.dat")

print("STOP.")
示例#13
0
#------------------------------
#Make a Teapot Lattice
#------------------------------

print "Generate Lattice."
lattice = TEAPOT_Lattice("no_sc_lattice")
lattice.readMAD("./LATTICES/Q_0p125.LAT","FODO")

# set the number of sections in quads to the same as for ORBIT_MPI
for acc_elem in lattice.getNodes():
	if(acc_elem.getType() == "quad teapot"):
		acc_elem.setnParts(5)

print "lattice length=",lattice.getLength()

# dump initial bunch for ORBIT_MPI input
bunch_pyorbit_to_orbit(lattice.getLength(), b, "orbit_mpi_bunch_input.dat")

#=====track bunch ============
ACC_TURNS = 1
print("Tracking.")
for i in range(ACC_TURNS):
	lattice.trackBunch(b)
	print "Turn ",i

# dump ORBIT_MPI bunch to compare results
bunch_pyorbit_to_orbit(lattice.getLength(), b, "orbit_mpi_bunch_from_pyorbit_output.dat")

print("STOP.")
示例#14
0
#  Lattice is ready
#-------------------------------

nodes = teapot_latt.getNodes()
i = 0
for node in nodes:
    print i, " node=", node.getName(
    ), " s start,stop = %4.3f %4.3f " % teapot_latt.getNodePositionsDict(
    )[node]
    print "There are ", node.getNumberOfBodyChildren(), " child nodes."
i = i + 1

#================Do some turns===========================================

teapot_latt.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "mainbunch_1.dat")

for i in xrange(9):
    teapot_latt.trackBunch(b, paramsDict)

bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "mainbunch_10.dat")

for i in xrange(40):
    teapot_latt.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "mainbunch_50.dat")

for i in xrange(50):
    teapot_latt.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "mainbunch_100.dat")

for i in xrange(50):
#=====Main bunch parameters============

macrosize = 1

teapot_latt = teapot.TEAPOT_Ring()
print "Read MAD."
teapot_latt.readMAD("MAD_Lattice/RealInjection/SNSring_pyOrbitBenchmark.LAT","RING")
print "Lattice=",teapot_latt.getName()," length [m] =",teapot_latt.getLength()," nodes=",len(teapot_latt.getNodes())

b = Bunch()
b.mass(0.93827231)
b.macroSize(macrosize)
energy = 1.0 #Gev
b.getSyncParticle().kinEnergy(energy)
b.readBunch("Bunches/controlbunch_600.dat", 1000)
bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "Bunches/controlbunch_600_ORBIT.dat")
#bunch_orbit_to_pyorbit(teapot_latt.getLength(), energy, "Bunches/Bm_KV_Uniform_1000",b)

tunes = TeapotTuneAnalysisNode("tune_analysis")
#tunes.assignTwiss(3.25011, 0.811013, 1.45074, -0.636723, 10.6922, -2.13656)
#addTeapotDiagnosticsNode(teapot_latt, 38.788, tunes)

tunes.assignTwiss(9.335, -1.826, -0.065, -0.03, 8.089, 0.497)
addTeapotDiagnosticsNode(teapot_latt, 51.035, tunes)


addTeapotMomentsNodeSet(teapot_latt, "moments", 3) 
addTeapotStatLatsNodeSet(teapot_latt, "statlats")

print "===========Lattice modified ======================================="
print "New Lattice=",teapot_latt.getName()," length [m] =",teapot_latt.getLength()," nodes=",len(teapot_latt.getNodes())
示例#16
0
"""
useX = 1
useY = 1
compbf_impedancenode = BetFreqDep_TImpedance_Node(length, nMacrosMin, nBins, useX, useY, b, compbf_impeDict, qX, alphaX, betaX, qY, alphaY, betaY)
addImpedanceNode(lattice, position, compbf_impedancenode)
"""

"""
useX = 1
useY = 1
bf_impedancenode = BetFreqDep_TImpedance_Node(length, nMacrosMin, nBins, useX, useY, b, bf_impeDict, qX, alphaX, betaX, qY, alphaY, betaY)
addImpedanceNode(lattice, position, bf_impedancenode)
"""

print "===========Lattice modified ======================================="
print "New Lattice = ", lattice.getName()," length [m] = ",lattice.getLength()," nodes = ",len(lattice.getNodes())

print "Ready to track"

# impedancenode.trackBunch(b)
# f_impedancenode.trackBunch(b)
# compbf_impedancenode.trackBunch(b)
# bf_impedancenode.trackBunch(b)

print "tracking done"

b.dumpBunch("bunch_final.dat")
bunch_pyorbit_to_orbit(lattice.getLength(), b, "pybunch_final.dat")
print "Stop."
示例#17
0
#make 2.5D space charge calculator
sizeX = 128
sizeY = 128
sizeZ = 32
xy_ratio = 10.0
calc2p5d = SpaceChargeCalc2p5D(sizeX, sizeY, sizeZ, xy_ratio)

# boundary
nBoundaryPoints = 128
N_FreeSpaceModes = 32
boundary_radius = 0.11
boundary = Boundary2D(nBoundaryPoints, N_FreeSpaceModes, "Circle",
                      2 * boundary_radius)

#=====track bunch through SC Node============
sc_path_length_min = 0.05
scNode_arr = scLatticeModifications.setSC2p5DAccNodes(lattice,
                                                      sc_path_length_min,
                                                      calc2p5d, boundary)

ACC_TURNS = 1
print("Tracking.")
for i in range(ACC_TURNS):
    lattice.trackBunch(b)
    print "Turn ", i

# dump ORBIT_MPI bunch to compare results
bunch_pyorbit_to_orbit(lattice.getLength(), b, runName + "_pyorbit_output.dat")

print("STOP.")
示例#18
0
	zreal = (zk.real/1.75 + zrf.real)
	zimag = (zk.imag/1.75 + zrf.imag)
	Z.append(complex(zreal, zimag))

sc1Dnode = SC1D_AccNode(b_a,length, nMacrosMin,useSpaceCharge,nBins)
#sc1Dnode.assignImpedance(Z);
#addLongitudinalSpaceChargeNode(teapot_latt, position, sc1Dnode)

#-------------------------------
#  Lattice is ready
#-------------------------------

nodes = teapot_latt.getNodes()
i = 0
for node in nodes:
	print i, " node=", node.getName()," s start,stop = %4.3f %4.3f "%teapot_latt.getNodePositionsDict()[node]
	print "There are ", node.getNumberOfBodyChildren()," child nodes."
	i=i+1

#================Do some turns===========================================

#newlatt = teapot_latt.getSubLattice(0, 693)
#newlatt.trackBunch(b, paramsDict)
teapot_latt.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "mainbunch.dat")

print "Stop."



示例#19
0
"""

f_sc1Dnode = FreqDep_SC1D_AccNode(b_a, length, nMacrosMin, useSpaceCharge,
                                  nBins, b, f_impeDict)
addLongitudinalSpaceChargeNode(lattice, position, f_sc1Dnode)
"""
compbf_sc1Dnode = BetFreqDep_SC1D_AccNode(b_a, length, nMacrosMin, useSpaceCharge, nBins, b, compbf_impeDict)
addLongitudinalSpaceChargeNode(lattice, position, compbf_sc1Dnode)
"""
"""
bf_sc1Dnode = BetFreqDep_SC1D_AccNode(b_a, length, nMacrosMin, useSpaceCharge, nBins, b, bf_impeDict)
addLongitudinalSpaceChargeNode(lattice, position, bf_sc1Dnode)
"""

print "===========Lattice modified ======================================="
print "New Lattice = ", lattice.getName(), " length [m] = ", lattice.getLength(
), " nodes = ", len(lattice.getNodes())

print "Ready to track"

#sc1Dnode.trackBunch(b)
f_sc1Dnode.trackBunch(b)
#compbf_sc1Dnode.trackBunch(b)
#bf_sc1Dnode.trackBunch(b)

print "tracking done"

b.dumpBunch("bunch_final.dat")
bunch_pyorbit_to_orbit(lattice.getLength(), b, "pybunch_final.dat")
print "Stop."
示例#20
0
sc_path_length_min = 0.00000001
sizeX = 9   #number of grid points in horizontal direction
sizeY = 9   #number of grid points in vertical direction
sizeZ = 1   #number of longitudinal slices in the 2.5D space charge solver
calc2p5d = SpaceChargeForceCalc2p5D(sizeX,sizeY,sizeZ)
#calc2p5d.trackBunch(b, lattice_length)
directforceLatticeModifications.setDirectForce2p5DAccNodes(lattice, sc_path_length_min, calc2p5d)

#
#------------------------------------

paramsDict = {}
paramsDict["bunch"]= b

lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch1.dat")
lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch2.dat")
lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch3.dat")
lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch4.dat")
lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch5.dat")
for i in range(95):
	lattice.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(lattice.getLength(), b, "bunch100.dat")


print "Stop."
示例#21
0
#-------------------------------
#  Lattice is ready
#-------------------------------

nodes = teapot_latt.getNodes()
i = 0
for node in nodes:
	print i, " node=", node.getName()," s start,stop = %4.3f %4.3f "%teapot_latt.getNodePositionsDict()[node]
	print "There are ", node.getNumberOfBodyChildren()," child nodes."
	i=i+1

#================Do some turns===========================================

teapot_latt.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "mainbunch_1.dat")

for i in xrange(99):
	teapot_latt.trackBunch(b, paramsDict)
	
bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "mainbunch_100.dat")
b.dumpBunch("pybunch_100.dat")

for i in xrange(100):
	teapot_latt.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "mainbunch_200.dat")

for i in xrange(100):
	teapot_latt.trackBunch(b, paramsDict)
bunch_pyorbit_to_orbit(teapot_latt.getLength(), b, "mainbunch_300.dat")
示例#22
0
tailfrac = 0
tailfac = 1
zlim = 120. * 248./360.
zmin = -zlim
zmax = zlim
emean = 1.0
esigma = 0.001
etrunc = 1
emin = 0.997
emax = 1.003

sp = b.getSyncParticle()
xFunc = JohoTransverse(order, alphax, betax, emitlim, xcenterpos, xcentermom, tailfrac, tailfac)
yFunc = JohoTransverse(order, alphay, betay, emitlim, ycenterpos, ycentermom, tailfrac, tailfac)
lFunc = GULongDist(zmin, zmax, sp, emean, esigma, etrunc, emin, emax)

#------------------------------
# Inject some particles
#------------------------------

nparts = 10000
inject = InjectParts(nparts, b, lostfoilbunch, foilparams, xFunc, yFunc, lFunc)
inject.addParticles()

bunch_pyorbit_to_orbit(248.0, b, "pybunch.dat")
lostfoilbunch.dumpBunch("pylostbunch.dat")
print "Stop."
quit()


示例#23
0
# get initial bunch from ORBIT_MPI input
bunch_orbit_to_pyorbit(lattice.getLength(), energy, "../DISTRIBUTIONS/Bm_KV_Ellipse",b)

#make 2.5D space charge calculator
sizeX = 128
sizeY = 128
sizeZ = 32
xy_ratio = 10.0
calc2p5d = SpaceChargeCalc2p5D(sizeX,sizeY,sizeZ,xy_ratio)

# boundary 
nBoundaryPoints = 128
N_FreeSpaceModes = 32
boundary_radius = 0.11
boundary = Boundary2D(nBoundaryPoints,N_FreeSpaceModes,"Circle",2*boundary_radius)

#=====track bunch through SC Node============
sc_path_length_min = 0.05
scNode_arr = scLatticeModifications.setSC2p5DAccNodes(lattice, sc_path_length_min, calc2p5d, boundary)

ACC_TURNS = 1
print("Tracking.")
for i in range(ACC_TURNS):
	lattice.trackBunch(b)
	print "Turn ",i	
	
# dump ORBIT_MPI bunch to compare results
bunch_pyorbit_to_orbit(lattice.getLength(), b, runName+"_pyorbit_output.dat")

print("STOP.")