Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mbtrack2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PA
Collective Effects
mbtrack2
Commits
c2c66db6
Commit
c2c66db6
authored
9 months ago
by
Keon Hee KIM
Browse files
Options
Downloads
Patches
Plain Diff
Removed atol
parent
b83abb5f
No related branches found
No related tags found
1 merge request
!14
Faster CircularResistiveWall
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mbtrack2/impedance/resistive_wall.py
+5
-20
5 additions, 20 deletions
mbtrack2/impedance/resistive_wall.py
with
5 additions
and
20 deletions
mbtrack2/impedance/resistive_wall.py
+
5
−
20
View file @
c2c66db6
...
...
@@ -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
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment