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
a65bb149
Commit
a65bb149
authored
4 years ago
by
Gamelin Alexis
Browse files
Options
Downloads
Patches
Plain Diff
Add inductive and resistive elements
parent
f980290c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
collective_effects/__init__.py
+1
-1
1 addition, 1 deletion
collective_effects/__init__.py
collective_effects/resonator.py
+77
-5
77 additions, 5 deletions
collective_effects/resonator.py
collective_effects/wakefield.py
+5
-2
5 additions, 2 deletions
collective_effects/wakefield.py
with
83 additions
and
8 deletions
collective_effects/__init__.py
+
1
−
1
View file @
a65bb149
...
...
@@ -7,7 +7,7 @@ Created on Tue Jan 14 12:25:30 2020
from
mbtrack2.collective_effects.instabilities
import
mbi_threshold
,
cbi_threshold
from
mbtrack2.collective_effects.resistive_wall
import
skin_depth
,
CircularResistiveWall
from
mbtrack2.collective_effects.resonator
import
Resonator
from
mbtrack2.collective_effects.resonator
import
Resonator
,
PureInductive
,
PureResistive
from
mbtrack2.collective_effects.tapers
import
StupakovRectangularTaper
,
StupakovCircularTaper
from
mbtrack2.collective_effects.wakefield
import
ComplexData
,
Impedance
,
WakeFunction
,
WakeField
from
mbtrack2.collective_effects.utilities
import
read_CST
,
read_IW2D
,
spectral_density
...
...
This diff is collapsed.
Click to expand it.
collective_effects/resonator.py
+
77
−
5
View file @
a65bb149
...
...
@@ -12,7 +12,7 @@ from mbtrack2.collective_effects.wakefield import (WakeField, Impedance,
WakeFunction
)
class
Resonator
(
WakeField
):
def
__init__
(
self
,
Rs
,
fr
,
Q
,
plane
,
n_wake
=
1e
4
,
n_imp
=
1e
4
,
imp_freq_lim
=
5
0e9
):
def
__init__
(
self
,
Rs
,
fr
,
Q
,
plane
,
n_wake
=
1e
6
,
n_imp
=
1e
6
,
imp_freq_lim
=
10
0e9
):
"""
Resonator model WakeField element which computes the impedance and the
wake function in both longitudinal and transverse case.
...
...
@@ -28,11 +28,11 @@ class Resonator(WakeField):
plane : str
Plane on which the resonator is used:
"
long
"
,
"
x
"
or
"
y
"
.
n_wake : int or float, optional
Number of points used in the wake function.
The default is 1e4.
Number of points used in the wake function.
n_imp : int or float, optional
Number of points used in the impedance.
The default is 1e4.
Number of points used in the impedance.
imp_freq_lim : float, optional
Maximum frequency used in the impedance.
The default is 50e9.
Maximum frequency used in the impedance.
References
----------
...
...
@@ -117,4 +117,76 @@ class Resonator(WakeField):
else
:
return
(
self
.
wr
*
self
.
Rs
/
self
.
Q_p
*
np
.
exp
(
-
1
*
t
*
self
.
wr
/
2
/
self
.
Q_p
)
*
np
.
sinh
(
self
.
wr_p
*
t
)
)
\ No newline at end of file
np
.
sinh
(
self
.
wr_p
*
t
)
)
class
PureInductive
(
WakeField
):
"""
Pure inductive Wakefield element which computes associated longitudinal
impedance and wake function.
Parameters
----------
L : float
Inductance value in [Ohm/Hz].
n_wake : int or float, optional
Number of points used in the wake function.
n_imp : int or float, optional
Number of points used in the impedance.
imp_freq_lim : float, optional
Maximum frequency used in the impedance.
nout, trim : see Impedance.to_wakefunction
"""
def
__init__
(
self
,
L
,
n_wake
=
1e6
,
n_imp
=
1e6
,
imp_freq_lim
=
1e11
,
nout
=
None
,
trim
=
False
):
self
.
L
=
L
self
.
n_wake
=
int
(
n_wake
)
self
.
n_imp
=
int
(
n_imp
)
self
.
imp_freq_lim
=
imp_freq_lim
freq
=
np
.
linspace
(
start
=
1
,
stop
=
self
.
imp_freq_lim
,
num
=
self
.
n_imp
)
imp
=
Impedance
(
variable
=
freq
,
function
=
self
.
long_impedance
(
freq
),
impedance_type
=
"
long
"
)
super
().
append_to_model
(
imp
)
wf
=
imp
.
to_wakefunction
(
nout
=
nout
,
trim
=
trim
)
super
().
append_to_model
(
wf
)
def
long_impedance
(
self
,
f
):
return
1j
*
self
.
L
*
f
class
PureResistive
(
WakeField
):
"""
Pure resistive Wakefield element which computes associated longitudinal
impedance and wake function.
Parameters
----------
R : float
Resistance value in [Ohm].
n_wake : int or float, optional
Number of points used in the wake function.
n_imp : int or float, optional
Number of points used in the impedance.
imp_freq_lim : float, optional
Maximum frequency used in the impedance.
nout, trim : see Impedance.to_wakefunction
"""
def
__init__
(
self
,
R
,
n_wake
=
1e6
,
n_imp
=
1e6
,
imp_freq_lim
=
1e11
,
nout
=
None
,
trim
=
False
):
self
.
R
=
R
self
.
n_wake
=
int
(
n_wake
)
self
.
n_imp
=
int
(
n_imp
)
self
.
imp_freq_lim
=
imp_freq_lim
freq
=
np
.
linspace
(
start
=
1
,
stop
=
self
.
imp_freq_lim
,
num
=
self
.
n_imp
)
imp
=
Impedance
(
variable
=
freq
,
function
=
self
.
long_impedance
(
freq
),
impedance_type
=
"
long
"
)
super
().
append_to_model
(
imp
)
wf
=
imp
.
to_wakefunction
(
nout
=
nout
,
trim
=
trim
)
super
().
append_to_model
(
wf
)
def
long_impedance
(
self
,
f
):
return
self
.
R
\ No newline at end of file
This diff is collapsed.
Click to expand it.
collective_effects/wakefield.py
+
5
−
2
View file @
a65bb149
...
...
@@ -569,13 +569,14 @@ class Impedance(ComplexData):
def
to_wakefunction
(
self
,
nout
=
None
,
trim
=
False
):
"""
Return a WakeFunction object from the impedance data.
The impedance data is assumed to be sampled equally.
Parameters
----------
nout : int, optional
nout : int
or float
, optional
Length of the transformed axis of the output. If None, it is taken
to be 2*(n-1) where n is the length of the input. If nout > n, the
input is padded with zeros. If nout < n, the inpu it cropped.
input is padded with zeros. If nout < n, the inpu
t
it cropped.
Note that, for any nout value, nout//2+1 input points are required.
trim : bool or float, optional
If True, the pseudo wake function is trimmed at time=0 and is forced
...
...
@@ -597,6 +598,8 @@ class Impedance(ComplexData):
if
nout
is
None
:
nout
=
len
(
Z
)
else
:
nout
=
int
(
nout
)
time_array
=
sc
.
fft
.
fftfreq
(
nout
,
sampling
)
Wlong_raw
=
sc
.
fft
.
irfft
(
np
.
array
(
Z
),
n
=
nout
,
axis
=
0
)
*
nout
*
fs
...
...
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