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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PA
Collective Effects
mbtrack2
Commits
d3409915
Commit
d3409915
authored
Jul 25, 2024
by
Alexis GAMELIN
Browse files
Options
Downloads
Patches
Plain Diff
Apply formatters and fix docstrings
parent
584b3d9c
No related branches found
No related tags found
1 merge request
!14
Faster CircularResistiveWall
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mbtrack2/impedance/resistive_wall.py
+69
-81
69 additions, 81 deletions
mbtrack2/impedance/resistive_wall.py
mbtrack2/tracking/wakepotential.py
+4
-5
4 additions, 5 deletions
mbtrack2/tracking/wakepotential.py
with
73 additions
and
86 deletions
mbtrack2/impedance/resistive_wall.py
+
69
−
81
View file @
d3409915
...
...
@@ -63,6 +63,7 @@ class CircularResistiveWall(WakeField):
exact : bool, optional
If False, approxmiated formulas are used for the wake function
computations.
The default is True.
References
----------
...
...
@@ -81,13 +82,7 @@ class CircularResistiveWall(WakeField):
"""
def
__init__
(
self
,
time
,
frequency
,
length
,
rho
,
radius
,
exact
=
True
):
def
__init__
(
self
,
time
,
frequency
,
length
,
rho
,
radius
,
exact
=
True
):
super
().
__init__
()
self
.
length
=
length
...
...
@@ -147,7 +142,7 @@ class CircularResistiveWall(WakeField):
time : array of float
Time points where the wake function is evaluated in [s].
exact : bool, optional
If True, the exact expression is used. The default is
Fals
e.
If True, the exact expression is used. The default is
Tru
e.
Returns
-------
...
...
@@ -172,8 +167,7 @@ class CircularResistiveWall(WakeField):
if
exact
==
True
:
idx2
=
time
==
0
idx3
=
np
.
logical_not
(
np
.
logical_or
(
idx1
,
idx2
))
factor
=
(
self
.
Z0
*
c
/
(
3
*
np
.
pi
*
self
.
radius
**
2
)
*
self
.
length
)
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
...
...
@@ -207,7 +201,7 @@ class CircularResistiveWall(WakeField):
time : array of float
Time points where the wake function is evaluated in [s].
exact : bool, optional
If True, the exact expression is used. The default is
Fals
e.
If True, the exact expression is used. The default is
Tru
e.
Returns
-------
...
...
@@ -231,8 +225,7 @@ class CircularResistiveWall(WakeField):
idx2
=
time
==
0
idx3
=
np
.
logical_not
(
np
.
logical_or
(
idx1
,
idx2
))
factor
=
((
self
.
Z0
*
c
**
2
*
self
.
t0
)
/
(
3
*
np
.
pi
*
self
.
radius
**
4
)
*
self
.
length
)
(
3
*
np
.
pi
*
self
.
radius
**
4
)
*
self
.
length
)
wt
[
idx3
]
=
self
.
__TransWakeExact
(
time
[
idx3
],
factor
)
else
:
idx2
=
np
.
logical_not
(
idx1
)
...
...
@@ -241,40 +234,35 @@ class CircularResistiveWall(WakeField):
def
__LongWakeExact
(
self
,
t
,
factor
):
w1re
,
_
=
_wofz
(
0
,
np
.
sqrt
(
2
*
t
/
self
.
t0
))
w2re
,
_
=
_wofz
(
np
.
cos
(
np
.
pi
/
6
)
*
np
.
sqrt
(
2
*
t
/
self
.
t0
),
np
.
sin
(
np
.
pi
/
6
)
*
np
.
sqrt
(
2
*
t
/
self
.
t0
)
)
w2re
,
_
=
_wofz
(
np
.
cos
(
np
.
pi
/
6
)
*
np
.
sqrt
(
2
*
t
/
self
.
t0
),
np
.
sin
(
np
.
pi
/
6
)
*
np
.
sqrt
(
2
*
t
/
self
.
t0
))
wl
=
factor
*
(
4
*
np
.
exp
(
-
1
*
t
/
self
.
t0
)
*
np
.
cos
(
np
.
sqrt
(
3
)
*
t
/
self
.
t0
)
+
w1re
-
2
*
w2re
)
np
.
cos
(
np
.
sqrt
(
3
)
*
t
/
self
.
t0
)
+
w1re
-
2
*
w2re
)
return
wl
def
__TransWakeExact
(
self
,
t
,
factor
):
w1re
,
_
=
_wofz
(
0
,
np
.
sqrt
(
2
*
t
/
self
.
t0
))
w2re
,
w2im
=
_wofz
(
np
.
cos
(
np
.
pi
/
6
)
*
np
.
sqrt
(
2
*
t
/
self
.
t0
),
np
.
sin
(
np
.
pi
/
6
)
*
np
.
sqrt
(
2
*
t
/
self
.
t0
)
)
w2re
,
w2im
=
_wofz
(
np
.
cos
(
np
.
pi
/
6
)
*
np
.
sqrt
(
2
*
t
/
self
.
t0
),
np
.
sin
(
np
.
pi
/
6
)
*
np
.
sqrt
(
2
*
t
/
self
.
t0
))
wt
=
factor
*
(
2
*
np
.
exp
(
-
1
*
t
/
self
.
t0
)
*
(
np
.
sqrt
(
3
)
*
np
.
sin
(
np
.
sqrt
(
3
)
*
t
/
self
.
t0
)
-
np
.
cos
(
np
.
sqrt
(
3
)
*
t
/
self
.
t0
)
)
+
w1re
+
2
*
(
np
.
cos
(
-
np
.
pi
/
3
)
*
w2re
-
np
.
sin
(
-
np
.
pi
/
3
)
*
w2im
)
)
(
np
.
sqrt
(
3
)
*
np
.
sin
(
np
.
sqrt
(
3
)
*
t
/
self
.
t0
)
-
np
.
cos
(
np
.
sqrt
(
3
)
*
t
/
self
.
t0
))
+
w1re
+
2
*
(
np
.
cos
(
-
np
.
pi
/
3
)
*
w2re
-
np
.
sin
(
-
np
.
pi
/
3
)
*
w2im
))
return
wt
def
__LongWakeApprox
(
self
,
t
):
wl
=
-
1
*
(
1
/
(
4
*
np
.
pi
*
self
.
radius
)
*
np
.
sqrt
(
self
.
Z0
*
self
.
rho
/
(
c
*
np
.
pi
*
t
**
3
))
*
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
))
*
self
.
length
)
np
.
sqrt
(
self
.
Z0
*
c
*
self
.
rho
/
(
np
.
pi
*
t
))
*
self
.
length
)
return
wt
...
...
This diff is collapsed.
Click to expand it.
mbtrack2/tracking/wakepotential.py
+
4
−
5
View file @
d3409915
...
...
@@ -709,9 +709,8 @@ class LongRangeResistiveWall(Element):
Wake function in [V/C].
"""
wl
=
(
1
/
(
4
*
pi
*
self
.
radius
)
*
np
.
sqrt
(
self
.
Z0
*
self
.
rho
/
(
c
*
pi
*
t
**
3
))
*
self
.
length
)
*
-
1
wl
=
(
1
/
(
4
*
pi
*
self
.
radius
)
*
np
.
sqrt
(
self
.
Z0
*
self
.
rho
/
(
c
*
pi
*
t
**
3
))
*
self
.
length
)
*
-
1
return
wl
def
Wdip
(
self
,
t
,
plane
):
...
...
@@ -739,8 +738,8 @@ class LongRangeResistiveWall(Element):
else
:
raise
ValueError
()
wdip
=
(
1
/
(
pi
*
r3
**
3
)
*
np
.
sqrt
(
self
.
Z0
*
c
*
self
.
rho
/
(
pi
*
t
))
*
self
.
length
)
wdip
=
(
1
/
(
pi
*
r3
**
3
)
*
np
.
sqrt
(
self
.
Z0
*
c
*
self
.
rho
/
(
pi
*
t
))
*
self
.
length
)
return
wdip
def
update_tables
(
self
,
beam
):
...
...
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