Skip to content
Snippets Groups Projects
Commit a1ef03ae authored by Keon Hee KIM's avatar Keon Hee KIM
Browse files

Optimized amplitude factors for wake function calculations.

parent 8e88c4e2
No related branches found
No related tags found
1 merge request!14Faster CircularResistiveWall
This commit is part of merge request !14. Comments created here will be created in the context of that merge request.
...@@ -172,8 +172,8 @@ class CircularResistiveWall(WakeField): ...@@ -172,8 +172,8 @@ class CircularResistiveWall(WakeField):
idx2 = time == 0 idx2 = time == 0
idx3 = np.logical_not(np.logical_or(idx1, idx2)) idx3 = np.logical_not(np.logical_or(idx1, idx2))
idx4 = np.isclose(0, time, atol=atol) idx4 = np.isclose(0, time, atol=atol)
factor = 4 * self.Z0 * c / (np.pi * self.radius**2) * self.length factor = self.Z0 * c / (3 * np.pi * self.radius**2) * self.length
wl[idx2] = 0.25 * factor wl[idx2] = 3 * factor
wl[idx3] = self.__LongWakeExact(time[idx3], factor) wl[idx3] = self.__LongWakeExact(time[idx3], factor)
wl[idx4] *= 0.5 wl[idx4] *= 0.5
else: else:
...@@ -220,8 +220,8 @@ class CircularResistiveWall(WakeField): ...@@ -220,8 +220,8 @@ class CircularResistiveWall(WakeField):
if exact == True: if exact == True:
idx2 = time == 0 idx2 = time == 0
idx3 = np.logical_not(np.logical_or(idx1, idx2)) idx3 = np.logical_not(np.logical_or(idx1, idx2))
factor = ((8 * self.Z0 * c**2 * self.t0) / (np.pi * self.radius**4) * factor = ( (self.Z0 * c**2 * self.t0) / (3 * np.pi * self.radius**4) *
self.length) self.length )
wt[idx3] = self.__TransWakeExact(time[idx3], factor) wt[idx3] = self.__TransWakeExact(time[idx3], factor)
else: else:
idx2 = np.logical_not(idx1) idx2 = np.logical_not(idx1)
...@@ -229,7 +229,7 @@ class CircularResistiveWall(WakeField): ...@@ -229,7 +229,7 @@ class CircularResistiveWall(WakeField):
return wt return wt
def __LongWakeExact(self, t, factor): def __LongWakeExact(self, t, factor):
wl = np.real(factor / 12 * ( 4 * np.exp(-1 * t / self.t0) wl = np.real( factor * ( 4 * np.exp(-1 * t / self.t0)
* np.cos(np.sqrt(3) * t / self.t0) * np.cos(np.sqrt(3) * t / self.t0)
+ wofz(1j * np.sqrt(2 * t / self.t0)) + wofz(1j * np.sqrt(2 * t / self.t0))
- wofz(np.exp(1j * np.pi / 6) * np.sqrt(2 * t / self.t0)) - wofz(np.exp(1j * np.pi / 6) * np.sqrt(2 * t / self.t0))
...@@ -237,7 +237,7 @@ class CircularResistiveWall(WakeField): ...@@ -237,7 +237,7 @@ class CircularResistiveWall(WakeField):
return wl return wl
def __TransWakeExact(self, t, factor): def __TransWakeExact(self, t, factor):
wt = np.real(factor / 24 * ( 2 * np.exp(-1 * t / self.t0) wt = np.real( factor * ( 2 * np.exp(-1 * t / self.t0)
* ( np.sqrt(3) * np.sin(np.sqrt(3) * t / self.t0) * ( np.sqrt(3) * np.sin(np.sqrt(3) * t / self.t0)
- np.cos(np.sqrt(3) * t / self.t0) ) - np.cos(np.sqrt(3) * t / self.t0) )
+ wofz(1j * np.sqrt(2 * t / self.t0)) + wofz(1j * np.sqrt(2 * t / self.t0))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment