Skip to content

Commit f654fc3

Browse files
author
dquartul
committed
v1.18.0
1 parent 508322a commit f654fc3

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ STRUCTURE
6363

6464
VERSION CONTENTS
6565
================
66-
2017-01-18
66+
2017-02-10
67+
v1.18.0 - Fixed an important bug in linear_interp_kick.cpp: before the
68+
acceleration kick was not applied if rf_kick_interp==TRUE in
69+
RingAndRFSection
70+
6771
v1.17.0 - Numerical synchrotron frequency distribution added (TC12)
6872
- Possibility to compute multi-turn wake with acceleration
6973
(in impedance.py)

cpp_routines/linear_interp_kick.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ extern "C" void linear_interp_kick(
1717
double * __restrict__ voltage_array,
1818
double * __restrict__ bin_centers,
1919
const int n_slices,
20-
const int n_macroparticles){
20+
const int n_macroparticles,
21+
const double acc_kick){
2122

2223

2324
const double inv_bin_width = (n_slices-1) / (bin_centers[n_slices-1] - bin_centers[0]);
@@ -33,7 +34,7 @@ extern "C" void linear_interp_kick(
3334
voltageKick = 0.;
3435
else
3536
voltageKick = voltage_array[ffbin] + (a - bin_centers[ffbin]) * (voltage_array[ffbin+1]-voltage_array[ffbin]) * inv_bin_width;
36-
beam_dE[i] = beam_dE[i] + voltageKick;
37+
beam_dE[i] = beam_dE[i] + voltageKick + acc_kick;
3738
}
3839

3940
}

impedances/impedance.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ def track(self):
162162
induced_energy.ctypes.data_as(ctypes.c_void_p),
163163
self.slices.bin_centers.ctypes.data_as(ctypes.c_void_p),
164164
ctypes.c_uint(self.slices.n_slices),
165-
ctypes.c_uint(self.beam.n_macroparticles))
165+
ctypes.c_uint(self.beam.n_macroparticles),
166+
ctypes.c_double(0.))
166167

167168

168169
def track_memory(self):
@@ -217,7 +218,8 @@ def track_memory(self):
217218
induced_energy.ctypes.data_as(ctypes.c_void_p),
218219
self.slices.bin_centers.ctypes.data_as(ctypes.c_void_p),
219220
ctypes.c_uint(self.slices.n_slices),
220-
ctypes.c_uint(self.beam.n_macroparticles))
221+
ctypes.c_uint(self.beam.n_macroparticles),
222+
ctypes.c_double(0.))
221223

222224
# Counter update
223225
self.counter_turn += 1
@@ -231,7 +233,8 @@ def track_ghosts_particles(self, ghostBeam):
231233
induced_energy.ctypes.data_as(ctypes.c_void_p),
232234
self.slices.bin_centers.ctypes.data_as(ctypes.c_void_p),
233235
ctypes.c_uint(self.slices.n_slices),
234-
ctypes.c_uint(ghostBeam.n_macroparticles))
236+
ctypes.c_uint(ghostBeam.n_macroparticles),
237+
ctypes.c_double(0.))
235238

236239

237240

@@ -333,7 +336,8 @@ def track(self, Beam):
333336
induced_energy.ctypes.data_as(ctypes.c_void_p),
334337
self.slices.bin_centers.ctypes.data_as(ctypes.c_void_p),
335338
ctypes.c_uint(self.slices.n_slices),
336-
ctypes.c_uint(Beam.n_macroparticles))
339+
ctypes.c_uint(Beam.n_macroparticles),
340+
ctypes.c_double(0.))
337341

338342

339343
class InducedVoltageFreq(object):
@@ -539,7 +543,8 @@ def track(self, Beam):
539543
induced_energy.ctypes.data_as(ctypes.c_void_p),
540544
self.slices.bin_centers.ctypes.data_as(ctypes.c_void_p),
541545
ctypes.c_uint(self.slices.n_slices),
542-
ctypes.c_uint(Beam.n_macroparticles))
546+
ctypes.c_uint(Beam.n_macroparticles),
547+
ctypes.c_double(0.))
543548

544549

545550
class InductiveImpedance(object):
@@ -667,7 +672,8 @@ def track(self, Beam):
667672
induced_energy.ctypes.data_as(ctypes.c_void_p),
668673
self.slices.bin_centers.ctypes.data_as(ctypes.c_void_p),
669674
ctypes.c_uint(self.slices.n_slices),
670-
ctypes.c_uint(self.beam.n_macroparticles))
675+
ctypes.c_uint(self.beam.n_macroparticles),
676+
ctypes.c_double(0.))
671677

672678

673679
class InputTable(object):

trackers/tracker.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,11 @@ def track(self):
407407
self.total_voltage = self.rf_voltage + self.TotalInducedVoltage.induced_voltage
408408
else:
409409
self.total_voltage = self.rf_voltage
410+
411+
induced_energy = self.beam.charge * self.total_voltage
410412
libblond.linear_interp_kick(self.beam.dt.ctypes.data_as(ctypes.c_void_p),
411413
self.beam.dE.ctypes.data_as(ctypes.c_void_p),
412-
(self.beam.charge * self.total_voltage).ctypes.data_as(ctypes.c_void_p),
414+
induced_energy.ctypes.data_as(ctypes.c_void_p),
413415
self.slices.bin_centers.ctypes.data_as(ctypes.c_void_p),
414416
ctypes.c_int(self.slices.n_slices),
415417
ctypes.c_int(self.beam.n_macroparticles),

0 commit comments

Comments
 (0)