Skip to content

Commit 656fbf5

Browse files
committed
added long sim for bologna
1 parent 9b095ec commit 656fbf5

17 files changed

+8599
-0
lines changed
Binary file not shown.
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import sys, os
2+
BIN=os.path.expanduser('../../../')
3+
sys.path.append(BIN)
4+
5+
6+
import numpy as np
7+
from scipy.constants import c, e
8+
9+
10+
jobid = 'LH0136'
11+
queue = '1nw'
12+
13+
n_segments = 79
14+
N_turns = 512
15+
16+
17+
intensity = 1.300000e+11
18+
epsn_x = 2.5e-6
19+
epsn_y = 2.5e-6
20+
21+
machine_configuration = 'HLLHC-injection'
22+
23+
init_unif_edens_flag = 1
24+
init_unif_edens = 1.000000e+12
25+
N_MP_ele_init = 100000
26+
N_mp_max = N_MP_ele_init*4.
27+
28+
x_kick_in_sigmas = 0.1
29+
y_kick_in_sigmas = 0.1
30+
31+
32+
chamb_type = 'polyg'
33+
x_aper = 2.300000e-02
34+
y_aper = 1.800000e-02
35+
filename_chm = 'LHC_chm_ver.mat'
36+
37+
38+
39+
B_multip_per_eV = [1.190000e-12]
40+
B_multip_per_eV = np.array(B_multip_per_eV)
41+
42+
43+
# define the machine
44+
from LHC_custom import LHC
45+
machine = LHC(n_segments = n_segments, machine_configuration = machine_configuration)
46+
47+
# compute sigma x and y
48+
inj_opt = machine.transverse_map.get_injection_optics()
49+
sigma_x = np.sqrt(inj_opt['beta_x']*epsn_x/machine.betagamma)
50+
sigma_y = np.sqrt(inj_opt['beta_y']*epsn_y/machine.betagamma)
51+
52+
x_kick = x_kick_in_sigmas*sigma_x
53+
y_kick = y_kick_in_sigmas*sigma_y
54+
55+
# define PIC grid size
56+
Dh_sc = .2e-3
57+
58+
# define MP size
59+
nel_mp_ref_0 = init_unif_edens*4*x_aper*y_aper/N_MP_ele_init
60+
61+
62+
63+
# define an electron cloud
64+
import PyECLOUD.PyEC4PyHT as PyEC4PyHT
65+
from PyHEADTAIL.particles.slicing import UniformBinSlicer
66+
slicer = UniformBinSlicer(n_slices = 64, n_sigma_z = 2.)
67+
ecloud = PyEC4PyHT.Ecloud(L_ecloud=machine.circumference/n_segments, slicer=slicer ,
68+
Dt_ref=10e-12, pyecl_input_folder='./pyecloud_config',
69+
chamb_type = chamb_type,
70+
x_aper=x_aper, y_aper=y_aper,
71+
filename_chm=filename_chm, Dh_sc=Dh_sc,
72+
init_unif_edens_flag=init_unif_edens_flag,
73+
init_unif_edens=init_unif_edens,
74+
N_mp_max=N_mp_max,
75+
nel_mp_ref_0=nel_mp_ref_0,
76+
B_multip=B_multip_per_eV*machine.p0/e*c)
77+
78+
# install ecloud in the machine
79+
machine.install_after_each_transverse_segment(ecloud)
80+
81+
# setup transverse losses (to "protect" the ecloud)
82+
import PyHEADTAIL.aperture.aperture as aperture
83+
apt_xy = aperture.EllipticalApertureXY(x_aper=ecloud.impact_man.chamb.x_aper, y_aper=ecloud.impact_man.chamb.y_aper)
84+
machine.one_turn_map.append(apt_xy)
85+
86+
# generate a bunch
87+
bunch = machine.generate_6D_Gaussian_bunch_matched(n_macroparticles=300000, intensity=intensity,
88+
epsn_x=epsn_x, epsn_y=epsn_y, sigma_z=1.35e-9/4*c)
89+
90+
# apply initial displacement
91+
bunch.x += x_kick
92+
bunch.y += y_kick
93+
94+
# define a bunch monitor
95+
from PyHEADTAIL.monitors.monitors import BunchMonitor
96+
bunch_monitor = BunchMonitor('bunch_evolution.h5', N_turns, {'Comment':'PyHDTL simulation'},
97+
write_buffer_every = 8)
98+
99+
# simulate
100+
import time
101+
for i_turn in xrange(N_turns):
102+
print '%s Turn %d'%(time.strftime("%d/%m/%Y %H:%M:%S", time.localtime()), i_turn)
103+
machine.track(bunch, verbose = False)
104+
bunch_monitor.dump(bunch)
105+
106+
107+
108+
109+
110+
111+
112+
113+
114+
115+
116+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys, os
2+
BIN = os.path.expanduser("../../../")
3+
sys.path.append(BIN)
4+
BIN = os.path.expanduser("../../")
5+
sys.path.append(BIN)
6+
7+
from ring_of_CPUs import RingOfCPUs
8+
from Simulation_with_eclouds import Simulation
9+
simulation_content = Simulation()
10+
11+
myCPUring = RingOfCPUs(simulation_content, N_pieces_per_transfer=1)
12+
13+
myCPUring.run()
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import numpy as np
2+
#~ import bunchh5_to_obj as bh5o
3+
import myfilemanager as mfm
4+
import mystyle as ms
5+
import pylab as pl
6+
from scipy.constants import c as ccc
7+
8+
9+
pl.close('all')
10+
ob = mfm.bunchh5_to_obj('bunch_evolution.h5')
11+
12+
pl.figure(1)
13+
pl.subplot(2,3,1)
14+
pl.plot(ob.mean_x)
15+
ms.sciy()
16+
pl.subplot(2,3,4)
17+
spectrum_x = np.abs(np.fft.rfft(ob.mean_x))
18+
pl.semilogy(np.linspace(0, .5, len(spectrum_x)), spectrum_x)
19+
20+
21+
pl.subplot(2,3,2)
22+
pl.plot(ob.mean_y)
23+
ms.sciy()
24+
pl.subplot(2,3,5)
25+
spectrum_y = np.abs(np.fft.rfft(ob.mean_y))
26+
pl.semilogy(np.linspace(0, .5, len(spectrum_y)), spectrum_y)
27+
28+
pl.subplot(2,3,3)
29+
pl.plot(ob.epsn_x)
30+
ms.sciy()
31+
pl.gca().ticklabel_format(useOffset=False)
32+
pl.subplot(2,3,6)
33+
pl.plot(ob.epsn_y)
34+
ms.sciy()
35+
pl.gca().ticklabel_format(useOffset=False)
36+
pl.show()
1.17 KB
Binary file not shown.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
from PyHEADTAIL.machines.synchrotron import BasicSynchrotron
2+
import numpy as np
3+
from scipy.constants import c, e, m_p
4+
5+
class LHC(BasicSynchrotron):
6+
7+
def __init__(self, n_segments, machine_configuration):
8+
9+
10+
circumference = 26658.8832
11+
12+
13+
14+
if machine_configuration =='HLLHC-injection':
15+
charge = e
16+
mass = m_p
17+
18+
alpha_x = 0.
19+
beta_x = 92.7
20+
D_x = 0.
21+
alpha_y = 0.
22+
beta_y = 93.2
23+
D_y = 0.
24+
25+
accQ_x = 62.28
26+
accQ_y = 60.31
27+
28+
Qp_x = 0
29+
Qp_y = 0
30+
31+
app_x = 0.0000e-9
32+
app_y = 0.0000e-9
33+
app_xy = 0
34+
35+
alpha = 3.4561e-04
36+
37+
h_RF = 35640
38+
V_RF = 8e6
39+
dphi_RF = 0.
40+
41+
42+
longitudinal_mode = 'non-linear'
43+
44+
p0 = 450.e9 * e /c
45+
46+
p_increment = 0.
47+
48+
else:
49+
raise ValueError('ERROR: unknown machine configuration', machine_configuration)
50+
51+
52+
super(LHC, self).__init__(optics_mode='smooth', circumference=circumference, n_segments=n_segments,
53+
alpha_x=alpha_x, beta_x=beta_x, D_x=D_x, alpha_y=alpha_y, beta_y=beta_y, D_y=D_y,
54+
accQ_x=accQ_x, accQ_y=accQ_y, Qp_x=Qp_x, Qp_y=Qp_y, app_x=app_x, app_y=app_y, app_xy=app_xy,
55+
alpha_mom_compaction=alpha, longitudinal_mode=longitudinal_mode,
56+
h_RF=np.atleast_1d(h_RF), V_RF=np.atleast_1d(V_RF), dphi_RF=np.atleast_1d(dphi_RF), p0=p0, p_increment=p_increment,
57+
charge=charge, mass=mass, RF_at='end_of_transverse')

0 commit comments

Comments
 (0)