elem0.setLength(4.0) lattice.initialize() #/////////////////////////////////////////////////////////// ZtoPhi = 2.0 * math.pi / lattice.getLength() dESync = 0.0 RFHNum = 1.0 RFVoltage = 0.1 RFPhase = 0.0 length = 0.0 name = "harmonic_rfnode" rf_node = RFNode.Harmonic_RFNode(ZtoPhi, dESync, RFHNum, RFVoltage, RFPhase, length, name) position = 1.0 RFLatticeModifications.addRFNode(lattice, position, rf_node) print "Lattice length = ", lattice.getLength() print "ZtoPhi = ", ZtoPhi print "dESync = ", dESync print "RFHNum = ", RFHNum print "RFVoltage = ", RFVoltage print "RFPhase = ", RFPhase #/////////////////////////////////////////////////////////// print "==============BEFORE============================" b.dumpBunch() print "==========================================" #=====track action ============ def bodyAction(paramsDict):
lattice = readLattice("iota_oct4.seq", "iota") addAperture2(lattice) """------------------------------- add RF Cavity -----------------------------""" ZtoPhi = 2.0 * pi / lattice.getLength() dESync = 0.0 RFHNum = 4 RFVoltage = 400 * pow(10, -9) RFPhase = 0.0 length = 0.05 name = "rfnode" rf_node = RFNode.Harmonic_RFNode(ZtoPhi, dESync, RFHNum, RFVoltage, RFPhase, length, name) position = 25.79485606 RFLatticeModifications.addRFNode(lattice, position, rf_node) sizeX = 64 #number of grid points in horizontal direction sizeY = 64 #number of grid points in vertical direction sizeZ = 3 #number of longitudinal slices in the 2.5D space charge solver calc2p5d = SpaceChargeCalc2p5D(sizeX, sizeY, sizeZ) for node in lattice.getNodes(): if node.getType() == "drift teapot": if node.getLength() > 0.01 and node.getLength() < 0.1: node.setnParts(2) elif node.getLength() >= 0.1 and node.getLength() < 0.5: node.setnParts(3) elif node.getLength() > 0.5: node.setnParts(8) if node.getType() == "quad teapot":
teapot_latt.initialize() ZtoPhi = 2.0 * math.pi / lattlength; dESync = 0.0 RF1HNum = 1.0 RF1Voltage = 0.000016 RF1Phase = 0.0 RF2HNum = 2.0 RF2Voltage = -0.000003 RF2Phase = 0.0 length = 0.0 rf1_node = RFNode.Harmonic_RFNode(ZtoPhi, dESync, RF1HNum, RF1Voltage, RF1Phase, length, "RF1") rf2_node = RFNode.Harmonic_RFNode(ZtoPhi, dESync, RF2HNum, RF2Voltage, RF2Phase, length, "RF2") position1 = 196.0 position2 = 196.5 RFLatticeModifications.addRFNode(teapot_latt, position1, rf1_node) RFLatticeModifications.addRFNode(teapot_latt, position2, rf2_node) #---------------------------------------------- #make 2.5D space charge calculator #---------------------------------------------- #set boundary nboundarypoints = 128 n_freespacemodes = 32 r_boundary = 0.220 boundary = Boundary2D(nboundarypoints,n_freespacemodes,"Circle",r_boundary,r_boundary) sizeX = 64 #number of grid points in horizontal direction sizeY = 64 #number of grid points in vertical direction sizeZ = 1 #number of longitudinal slices in the 2.5D space charge solver calc2p5d = SpaceChargeCalc2p5D(sizeX,sizeY,sizeZ)
dESync = 0.0 RF1HNum = 1.0 RF1Voltage = 0.000016 RF1Phase = 0.0 RF2HNum = 2.0 RF2Voltage = -0.000003 RF2Phase = 0.0 length = 0.0 rf1_node = RFNode.Harmonic_RFNode(ZtoPhi, dESync, RF1HNum, RF1Voltage, RF1Phase, length, "RF1") rf2_node = RFNode.Harmonic_RFNode(ZtoPhi, dESync, RF2HNum, RF2Voltage, RF2Phase, length, "RF2") position1 = 196.0 position2 = 196.5 RFLatticeModifications.addRFNode(teapot_latt, position1, rf1_node) RFLatticeModifications.addRFNode(teapot_latt, position2, rf2_node) #---------------------------------------------- #make 2.5D space charge calculator #---------------------------------------------- #set boundary nboundarypoints = 128 n_freespacemodes = 32 r_boundary = 0.110 boundary = Boundary2D(nboundarypoints, n_freespacemodes, "Circle", r_boundary, r_boundary) sizeX = 64 #number of grid points in horizontal direction sizeY = 64 #number of grid points in vertical direction sizeZ = 1 #number of longitudinal slices in the 2.5D space charge solver
lattice.readMADX(file_name, lattice_name) lattice.setUseRealCharge(1) # change to + 1 for proton in li ring #lattice.setUseRealCharge(1) return lattice # electron bunch for iota lattice = readLattice("iota_oct4.seq", "iota") addAperture2(lattice) """------------------------------- add RF Cavity -----------------------------""" """ ZtoPhi = 2.0 * pi / lattice.getLength() dESync = 0.0 RFHNum = 4 RFVoltage = 400*pow(10, -9) RFPhase = 0.0 length = 0.05 name = "rfnode" rf_node = RFNode.Harmonic_RFNode(ZtoPhi, dESync, RFHNum, RFVoltage, RFPhase, length, name) position = 5.3 RFLatticeModifications.addRFNode(lattice, position, rf_node) """ sizeX = 64 #number of grid points in horizontal direction sizeY = 64 #number of grid points in vertical direction sizeZ = 3 #number of longitudinal slices in the 2.5D space charge solver