Пример #1
0
def test_add_multipole():
    fodo = sixtracklib.CBlock()
    fodo.add_Multipole(knl=[0.0])
    fodo.add_Multipole(knl=[0.1, 0.2])
    fodo.add_Multipole(knl=[0.1, 0.2, 0.3])
    assert fodo.elem[0].order == 0
    assert fodo.elem[1].order == 1
    assert fodo.elem[2].order == 2
Пример #2
0
def test_add_fodo():
    fodo = sixtracklib.CBlock()
    fodo.add_Drift(length=1.5)
    fodo.add_Multipole(knl=[0.0, 0.001])
    fodo.add_Drift(length=1.3)
    fodo.add_Multipole(name='qd', knl=[0.0, -0.001])
    fodo.add_Cavity(voltage=3., frequency=4., lag=5)
    fodo.add_Align(dx=1., dy=-2., tilt=30)
    data = np.array([1, 2, 3, 4], dtype='float')
    fodo.add_BeamBeam(name='bb', datasize=len(data), data=data)
    assert fodo.elem[0].length == 1.5
    assert fodo.elem['qd'][0].bal[2] == -0.001
    assert fodo.elem['bb'][0].data[1] == 2.0
Пример #3
0
def test_track():
    fodo = sixtracklib.CBlock()
    fodo.add_Drift(length=1.5)
    fodo.add_Multipole(knl=[0.0, 0.001])
    fodo.add_Drift(length=1.3)
    fodo.add_Multipole(name='qd', knl=[0.0, -0.001])

    bunch = sixtracklib.CParticles(npart=2)
    bunch.x[0] = 0.3
    bunch.y[1] = 0.2

    particles, ebe, tbt = fodo.track_cl(bunch,
                                        nturns=1,
                                        elembyelem=True,
                                        turnbyturn=True)
    return fodo, particles, ebe, tbt
Пример #4
0
#bunch length strong beam (assumed gaussian)
sigmaz = 0.075 * 100
# N slices
N_slices = 50
# Single particle properties
q_part = qe
# Minimum difference to fall on round
min_sigma_diff = 1e-16
threshold_singular = 1e-16

# strong beam shape at the IP (decoupled round beam)
(Sig_11_0, Sig_12_0, Sig_13_0, Sig_14_0, Sig_22_0, Sig_23_0, Sig_24_0,
 Sig_33_0, Sig_34_0, Sig_44_0) = (20e-06, 0., 0., 0., 0., 0., 0., 20e-6, 0.,
                                  0.)

machine = sixtracklib.CBlock()

machine.add_BeamBeam(name='bb',
                     q_part=q_part,
                     N_part_tot=N_part_tot,
                     sigmaz=sigmaz,
                     N_slices=N_slices,
                     min_sigma_diff=min_sigma_diff,
                     threshold_singular=threshold_singular,
                     phi=phi,
                     alpha=alpha,
                     Sig_11_0=Sig_11_0,
                     Sig_12_0=Sig_12_0,
                     Sig_13_0=Sig_13_0,
                     Sig_14_0=Sig_14_0,
                     Sig_22_0=Sig_22_0,
Пример #5
0
import sixtracklib

fodo = sixtracklib.CBlock()
fodo.add_Drift(length=1.5)
fodo.add_Multipole(knl=[0.0, 0.001])
fodo.add_Drift(length=1.5)
fodo.add_Multipole(name='qd', knl=[0.0, -0.001])

#fodo.add(stl.Drift(length=1.5))
#assert fodo.elem[3].knl == fodo.ns.qd.knl

bunch = sixtracklib.CParticles(npart=4)
bunch.x[1] = 0.3
bunch.y[2] = 0.2
bunch.z[3] = 0.1

assert bunch.x[0] == 0.3

el, tt = fodo.cl_track(bunch, nturns=1)
Пример #6
0
def test_add_drift():
    blk = sixtracklib.CBlock()
    blk.add_Drift(length=3)
    blk.add_Drift(length=2.5)
    assert blk.elem_ids == [0, 2]