|
21 | 21 |
|
22 | 22 | context = xo.ContextCpu(omp_num_threads=1) |
23 | 23 |
|
24 | | -nTurn = 3000 # int(1E4) |
| 24 | +nTurn = 5000 # int(1E4) |
25 | 25 | bunch_intensity = 1.8e11 |
26 | | -n_macroparticles = int(1e5) # int(1E4) |
| 26 | +n_macroparticles = int(1e4) |
27 | 27 | energy = 7e3 # [GeV] |
28 | 28 | gamma = energy * 1e9 / protonMass |
29 | 29 | betar = np.sqrt(1 - 1 / gamma ** 2) |
|
56 | 56 | ) |
57 | 57 | wake_field = WakeField(slicer_for_wakefields, waketable) |
58 | 58 |
|
59 | | -damping_time = 100000000 # 33. |
| 59 | +damping_time = 7000 # 33. |
60 | 60 | damper = TransverseDamper(dampingrate_x=damping_time, dampingrate_y=damping_time) |
61 | | -i_oct = 0.0000001 |
| 61 | +i_oct = 15. |
62 | 62 | detx_x = 1.4e5 * i_oct / 550.0 # from PTC with ATS optics, telescopic factor 1.0 |
63 | 63 | detx_y = -1.0e5 * i_oct / 550.0 |
64 | 64 |
|
|
168 | 168 | iMax = nTurn |
169 | 169 | ampl = np.abs(hilbert(x)) |
170 | 170 | b, a, r, p, stderr = linregress(turns[iMin:iMax], np.log(ampl[iMin:iMax])) |
| 171 | +gr_pyht = b |
171 | 172 | plt.plot(turns, np.exp(a + b * turns), "--k", label=f"{1/b:.3E} turns") |
172 | 173 | print(f"Growth rate {b*1E4} [$10^{-4}$/turn]") |
173 | 174 | plt.title("PyHEADTAIL") |
|
287 | 288 | iMax = nTurn |
288 | 289 | ampl = np.abs(hilbert(x)) |
289 | 290 | b, a, r, p, stderr = linregress(turns[iMin:iMax], np.log(ampl[iMin:iMax])) |
| 291 | +gr_xtpyht = b |
290 | 292 | plt.plot(turns, np.exp(a + b * turns), "--k", label=f"{1/b:.3E} turns") |
291 | 293 | print(f"Growth rate {b*1E4} [$10^{-4}$/turn]") |
292 | 294 | plt.title("xsuite-PyHEADTAIL") |
293 | 295 | plt.legend(loc="upper left") |
294 | 296 | plt.xlabel("Turn") |
295 | 297 | plt.ylabel("x [$\sigma_x$]") |
296 | 298 |
|
| 299 | +assert np.isclose(gr_xtpyht, gr_pyht, rtol=1e-3, atol=1e-100) |
| 300 | + |
297 | 301 | plt.show() |
0 commit comments