Skip to content
Snippets Groups Projects

Faster CircularResistiveWall

Merged Keon Hee KIM requested to merge faster_circular_resistive_wall into develop
1 unresolved thread
3 files
+ 149
139
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -171,11 +171,17 @@ class CircularResistiveWall(WakeField):
if exact == True:
idx2 = time == 0
idx3 = np.logical_not(np.logical_or(idx1, idx2))
idx4 = np.isclose(0, time, atol=atol)
# idx4 = np.isclose(time, 0, atol=atol) & (time >= 0)
factor = self.Z0 * c / (3 * np.pi * self.radius**2) * self.length
wl[idx2] = 3 * factor
if np.any(idx2):
# fundamental theorem of beam loading
wl[idx2] = 3 * factor / 2
wl[idx3] = self.__LongWakeExact(time[idx3], factor)
wl[idx4] *= 0.5
# if np.any(idx4):
# closest_to_zero_idx = np.argmin(time[idx4])
# # Get the actual index in the original array
# closest_to_zero_idx = np.where(idx4)[0][closest_to_zero_idx]
# wl[closest_to_zero_idx] *= 0.5
else:
idx2 = np.logical_not(idx1)
wl[idx2] = self.__LongWakeApprox(time[idx2])
@@ -249,13 +255,13 @@ class CircularResistiveWall(WakeField):
def __LongWakeApprox(self, t):
wl = -1 * (1 / (4 * np.pi * self.radius) *
np.sqrt(self.Z0 * self.rho / (c * np.pi)) /
t**(3 / 2)) * self.length
np.sqrt(self.Z0 * self.rho / (c * np.pi * t**3))
* self.length)
return wl
def __TransWakeApprox(self, t):
wt = (1 / (np.pi * self.radius**3) *
np.sqrt(self.Z0 * c * self.rho / np.pi) / t**(1 / 2) *
np.sqrt(self.Z0 * c * self.rho / (np.pi * t)) *
self.length)
return wt
Loading