Skip to content
Snippets Groups Projects
Commit 950e49c7 authored by Alexis GAMELIN's avatar Alexis GAMELIN
Browse files

[Fix] Quadrupolar wake potential sign

The Q wake potential should be of the same sign as the Q wake function. A positive Q wake function/potential is defocusing i.e. a positive angular kick is felt by the test particle (for positive test particule position).
Also fix WakePotential.plot_last_wake for negative wake function.
parent 5ef174f2
No related branches found
No related tags found
2 merge requests!280.8.0,!22[Fix] Quadrupolar wake potential sign
......@@ -271,7 +271,7 @@ class WakePotential(Element):
profile0 = np.interp(tau0, self.tau, self.rho, 0, 0)
if wake_type == "Wlong" or wake_type == "Wxquad" or wake_type == "Wyquad" or wake_type == "Wxcst" or wake_type == "Wycst":
if wake_type == "Wlong" or wake_type == "Wxcst" or wake_type == "Wycst":
Wp = signal.convolve(profile0, W0 * -1, mode='same') * dtau0
elif wake_type == "Wxdip":
dipole0 = self.dipole_moment(bunch, "x", tau0)
......@@ -279,6 +279,8 @@ class WakePotential(Element):
elif wake_type == "Wydip":
dipole0 = self.dipole_moment(bunch, "y", tau0)
Wp = signal.convolve(profile0 * dipole0, W0, mode='same') * dtau0
elif wake_type == "Wxquad" or wake_type == "Wyquad":
Wp = signal.convolve(profile0, W0, mode='same') * dtau0
else:
raise ValueError("This type of wake is not taken into account.")
......@@ -386,7 +388,7 @@ class WakePotential(Element):
if plot_wake_function is True:
W0 = getattr(self, "W0_" + wake_type)
W0_rescaled = W0 / max(W0) * max(np.abs(Wp))
W0_rescaled = W0 / max(np.abs(W0)) * max(np.abs(Wp))
ax.plot(tau0 * 1e12,
W0_rescaled * 1e-12,
label=r"$W_{function}$ (a.u.)")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment