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

Fix Resonator

Fix resonator wake function for negative time and update docstrings.
parent 71de9837
Branches
Tags
No related merge requests found
...@@ -14,6 +14,9 @@ class Resonator(WakeField): ...@@ -14,6 +14,9 @@ class Resonator(WakeField):
""" """
Resonator model WakeField element which computes the impedance and the Resonator model WakeField element which computes the impedance and the
wake function in both longitudinal and transverse case. wake function in both longitudinal and transverse case.
! For transverse case, if Q < 2, there is a kick factor mismatch
between time and frequency domain.
Parameters Parameters
---------- ----------
...@@ -22,7 +25,7 @@ class Resonator(WakeField): ...@@ -22,7 +25,7 @@ class Resonator(WakeField):
frequency : array of float frequency : array of float
Frequency points where the impedance will be evaluated in [Hz]. Frequency points where the impedance will be evaluated in [Hz].
Rs : float Rs : float
Shunt impedance in [ohm]. Shunt impedance in [ohm] in longitudinal or [ohm/m] in transverse.
fr : float fr : float
Resonance frequency in [Hz]. Resonance frequency in [Hz].
Q : float Q : float
...@@ -94,6 +97,8 @@ class Resonator(WakeField): ...@@ -94,6 +97,8 @@ class Resonator(WakeField):
(2 * self.Q_p))) (2 * self.Q_p)))
if np.any(np.abs(t) < atol): if np.any(np.abs(t) < atol):
wl[np.abs(t) < atol] = wl[np.abs(t) < atol] / 2 wl[np.abs(t) < atol] = wl[np.abs(t) < atol] / 2
elif np.any(t < -atol):
wl[t < -atol] = 0
return wl return wl
def long_impedance(self, f): def long_impedance(self, f):
...@@ -105,13 +110,16 @@ class Resonator(WakeField): ...@@ -105,13 +110,16 @@ class Resonator(WakeField):
def transverse_wake_function(self, t): def transverse_wake_function(self, t):
if self.Q >= 0.5: if self.Q >= 0.5:
return (self.wr * self.Rs / self.Q_p * wt = (self.wr * self.Rs / self.Q_p *
np.exp(-1 * t * self.wr / 2 / self.Q_p) * np.exp(-1 * t * self.wr / 2 / self.Q_p) *
np.sin(self.wr_p * t)) np.sin(self.wr_p * t))
else: else:
return (self.wr * self.Rs / self.Q_p * wt = (self.wr * self.Rs / self.Q_p *
np.exp(-1 * t * self.wr / 2 / self.Q_p) * np.exp(-1 * t * self.wr / 2 / self.Q_p) *
np.sinh(self.wr_p * t)) np.sinh(self.wr_p * t))
if np.any(t < 0):
wt[t<0] = 0
return wt
class PureInductive(WakeField): class PureInductive(WakeField):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment