Skip to content
Snippets Groups Projects
Commit 628a21fb authored by Watanyu Foosang's avatar Watanyu Foosang
Browse files

Add RWMBI growth rate and threshold calculation + correct typos

parent 3911a83b
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ Created on Tue Jan 14 12:25:30 2020
"""
from mbtrack2.collective_effects.instabilities import mbi_threshold, cbi_threshold, lcbi_growth_rate_mode, lcbi_growth_rate
from mbtrack2.collective_effects.instabilities import rwmbi_growth_rate, rwmbi_threshold
from mbtrack2.collective_effects.resistive_wall import (skin_depth, CircularResistiveWall, Coating)
from mbtrack2.collective_effects.resonator import Resonator, PureInductive, PureResistive
from mbtrack2.collective_effects.tapers import StupakovRectangularTaper, StupakovCircularTaper
......
......@@ -25,7 +25,7 @@ class ImpedanceModel(Element):
ring : Synchrotron object
wakefield_list : list of WakeField objects
WakeFields to add to the model.
wakefiled_postions : list
wakefiled_positions : list
Longitudinal positions corresponding to the added Wakfields.
Attributes
......@@ -45,9 +45,9 @@ class ImpedanceModel(Element):
Methods
-------
add(wakefield_list, wakefiled_postions)
add(wakefield_list, wakefiled_positions)
Add elements to the model.
add_multiple_elements(wakefield, wakefiled_postions)
add_multiple_elements(wakefield, wakefiled_positions)
Add the same element at different locations to the model.
sum_elements()
Sum all WakeFields into self.sum.
......@@ -63,14 +63,14 @@ class ImpedanceModel(Element):
Plot the contributions of different kind of WakeFields.
"""
def __init__(self, ring, wakefield_list=None, wakefiled_postions=None):
def __init__(self, ring, wakefield_list=None, wakefiled_positions=None):
self.ring = ring
self.optics = self.ring.optics
self.wakefields = []
self.positions = np.array([])
self.names = np.array([])
self.sum_names = np.array([])
self.add(wakefield_list, wakefiled_postions)
self.add(wakefield_list, wakefiled_positions)
def track(self, beam):
"""
......@@ -152,7 +152,7 @@ class ImpedanceModel(Element):
for name in self.names:
self.sum_by_name(name)
def add(self, wakefield_list, wakefiled_postions):
def add(self, wakefield_list, wakefiled_positions):
"""
Add elements to the model.
......@@ -160,19 +160,19 @@ class ImpedanceModel(Element):
----------
wakefield_list : list of WakeField objects
WakeFields to add to the model.
wakefiled_postions : list
wakefiled_positions : list
Longitudinal positions corresponding to the added Wakfields.
"""
if (wakefield_list is not None) and (wakefiled_postions is not None):
if (wakefield_list is not None) and (wakefiled_positions is not None):
for wakefield in wakefield_list:
self.wakefields.append(wakefield)
for position in wakefiled_postions:
for position in wakefiled_positions:
self.positions = np.append(self.positions, position)
self.update_name_list()
def add_multiple_elements(self, wakefield, wakefiled_postions):
def add_multiple_elements(self, wakefield, wakefiled_positions):
"""
Add the same element at different locations to the model.
......@@ -180,10 +180,10 @@ class ImpedanceModel(Element):
----------
WakeField : WakeField object
WakeField to add to the model.
wakefiled_postions : list
wakefiled_positions : list
Longitudinal positions corresponding to the added Wakfield.
"""
for position in wakefiled_postions:
for position in wakefiled_positions:
self.positions = np.append(self.positions, position)
self.wakefields.append(wakefield)
......
......@@ -8,6 +8,7 @@ General calculations about instabilities
import numpy as np
import matplotlib.pyplot as plt
from scipy.constants import c, m_e, e, pi, epsilon_0
import math
def mbi_threshold(ring, sigma, R, b):
"""
......@@ -251,6 +252,105 @@ def plot_critical_mass(ring, bunch_charge, bunch_spacing, n_points=1e4):
ax.set_xlabel("Longitudinal position [m]")
return fig
def rwmbi_growth_rate(ring, current, beff, rho_material, plane='x'):
"""
Compute the growth rate of the transverse coupled-bunch instability induced
by resistive wall impedance [1].
Parameters
----------
ring : Synchrotron object
current : float
Total beam current in [A].
beff : float
Effective radius of the vacuum chamber in [m].
rho_material : float
Resistivity of the chamber's wall material in [Ohm.m].
plane : str, optional
The plane in which the instability will be computed. Use 'x' for the
horizontal plane, and 'y' for the vertical.
Reference
---------
[1] Eq. (31) in R. Nagaoka and K. L. F. Bane, "Collective effects in a
diffraction-limited storage ring", J. Synchrotron Rad. Vol 21, 2014. pp.937-960
"""
plane_dict = {'x':0, 'y':1}
index = plane_dict[plane]
beta0 = ring.optics.local_beta[index]
omega0 = ring.omega0
E0 = ring.E0
R = ring.L/(2*np.pi)
frac_tune, int_tune = math.modf(ring.tune[index])
Z0 = 377.7 # Vacuum impedance [Ohm]
gr = (beta0*omega0*current*R) /(4*np.pi*E0*beff**3) * ((2*c*Z0*rho_material) / ((1-frac_tune)*omega0))**0.5
return gr
def rwmbi_threshold(ring, beff, rho_material, plane='x'):
"""
Compute the threshold current of the transverse coupled-bunch instability
induced by resistive wall impedance [1].
Parameters
----------
ring : Synchrotron object
beff : float
Effective radius of the vacuum chamber in [m].
rho_material : float
Resistivity of the chamber's wall material in [Ohm.m].
plane : str, optional
The plane in which the instability will be computed. Use 'x' for the
horizontal plane, and 'y' for the vertical.
Reference
---------
[1] Eq. (32) in R. Nagaoka and K. L. F. Bane, "Collective effects in a
diffraction-limited storage ring", J. Synchrotron Rad. Vol 21, 2014. pp.937-960
"""
plane_dict = {'x':0, 'y':1}
index = plane_dict[plane]
beta0 = ring.optics.local_beta[index]
omega0 = ring.omega0
E0 = ring.E0
tau_rad = ring.tau[index]
frac_tune, int_tune = math.modf(ring.tune[index])
Z0 = 377.7 # Vacuum impedance [Ohm]
Ith = (4*np.pi*E0*beff**3) / (c*beta0*tau_rad) * (((1-frac_tune)*omega0) / (2*c*Z0*rho_material))**0.5
return Ith
\ No newline at end of file
......@@ -703,7 +703,7 @@ class LongRangeResistiveWall(Element):
of mass with respect to center of the RF bucket number 0 at turn j.
Turn 0 corresponds to the tracked turn.
Postive time corresponds to past events and negative time to future
Positive time corresponds to past events and negative time to future
events.
Parameters
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment