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

Removed atol

parent b83abb5f
No related branches found
No related tags found
1 merge request!14Faster CircularResistiveWall
......@@ -62,10 +62,6 @@ class CircularResistiveWall(WakeField):
exact : bool, optional
If False, approxmiated formulas are used for the wake function
computations.
atol : float, optional
Absolute tolerance used to enforce fundamental theorem of beam loading
for the exact expression of the longitudinal wake function.
Default is 1e-20.
References
----------
......@@ -88,8 +84,7 @@ class CircularResistiveWall(WakeField):
length,
rho,
radius,
exact=False,
atol=1e-20):
exact=False):
super().__init__()
self.length = length
......@@ -104,7 +99,7 @@ class CircularResistiveWall(WakeField):
Z2 = c / omega * length * (1 + np.sign(frequency) * 1j) * rho / (
np.pi * radius**3 * skin_depth(frequency, rho))
Wl = self.LongitudinalWakeFunction(time, exact, atol)
Wl = self.LongitudinalWakeFunction(time, exact)
Wt = self.TransverseWakeFunction(time, exact)
Zlong = Impedance(variable=frequency,
......@@ -127,7 +122,7 @@ class CircularResistiveWall(WakeField):
super().append_to_model(Wxdip)
super().append_to_model(Wydip)
def LongitudinalWakeFunction(self, time, exact=False, atol=1e-20):
def LongitudinalWakeFunction(self, time, exact=False):
"""
Compute the longitudinal wake function of a circular resistive wall
using Eq. (11), of [1], or approxmiated expression Eq. (24), of [2].
......@@ -136,8 +131,8 @@ class CircularResistiveWall(WakeField):
Eq. (11) in [1] is completely equivalent to Eq. (22) in [2].
If some time value is smaller than atol, then the fundamental theorem
of beam loading is applied: Wl(0) = Wl(0+)/2.
The fundamental theorem of beam loading is applied for the exact
expression of the longitudinal wake function: Wl(0) = Wl(0+)/2.
Parameters
----------
......@@ -145,10 +140,6 @@ class CircularResistiveWall(WakeField):
Time points where the wake function is evaluated in [s].
exact : bool, optional
If True, the exact expression is used. The default is False.
atol : float, optional
Absolute tolerance used to enforce fundamental theorem of beam loading
for the exact expression of the longitudinal wake function.
Default is 1e-20.
Returns
-------
......@@ -171,17 +162,11 @@ class CircularResistiveWall(WakeField):
if exact == True:
idx2 = time == 0
idx3 = np.logical_not(np.logical_or(idx1, idx2))
# idx4 = np.isclose(time, 0, atol=atol) & (time >= 0)
factor = self.Z0 * c / (3 * np.pi * self.radius**2) * self.length
if np.any(idx2):
# fundamental theorem of beam loading
wl[idx2] = 3 * factor / 2
wl[idx3] = self.__LongWakeExact(time[idx3], factor)
# 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])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment