-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update beamloading #906
base: master
Are you sure you want to change the base?
Update beamloading #906
Changes from all commits
77e7d0e
c2be1bc
52c517d
286b5ff
52a526d
06e8587
62a655a
94af515
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,7 +149,7 @@ function atmexall(varargin) | |
compile(compargs, pmeth); | ||
catch errcomp | ||
if fail | ||
rethrow(err); | ||
rethrow(errcomp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this to be fixed in another PR then? Maybe you should start with this? |
||
else | ||
fprintf(2, 'Could not compile %s:\n%s\n', pmeth, errcomp.message); | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,6 +154,8 @@ def __init__(self, family_name: str, length: float, voltage: float, | |
cavitymode (CavityMode): Is cavity ACTIVE (default) or PASSIVE | ||
buffersize (int): Size of the history buffer for vbeam, vgen, vbunch | ||
(default 0) | ||
detune_angle: Fixed detuning from optimal tuning angle. [rad] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should you describe the sign convention here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may want to add this in the docstring of add_beamloading function as well no? |
||
|
||
Returns: | ||
bl_elem (Element): beam loading element | ||
""" | ||
|
@@ -165,9 +167,9 @@ def __init__(self, family_name: str, length: float, voltage: float, | |
raise TypeError('cavitymode has to be an ' + | ||
'instance of CavityMode') | ||
zcuts = kwargs.pop('ZCuts', None) | ||
phil = kwargs.pop('phil', 0) | ||
energy = ring.energy | ||
harmonic_number = numpy.round(frequency*ring.circumference/clight) | ||
self.detune_angle = kwargs.pop('detune_angle', 0) | ||
self.Rshunt = rshunt | ||
self.Qfactor = qfactor | ||
self.NormFact = kwargs.pop('NormFact', 1.0) | ||
|
@@ -199,7 +201,7 @@ def __init__(self, family_name: str, length: float, voltage: float, | |
self._vbeam = numpy.zeros(2) | ||
self._vgen = numpy.zeros(2) | ||
self._vcav = numpy.array([self.Voltage, | ||
numpy.pi/2-self._phis-phil]) | ||
numpy.pi/2-self._phis]) | ||
self.clear_history(ring=ring) | ||
|
||
def is_compatible(self, other): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you want detune_angle to have the same sign as psi?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The Vgen[1] is psi, and for a main cavity in electron machines the optimum is at -ve psi, which is -ve detuning in frequency due to the -ve gradient. It is the opposite for harmonic cavities.
I prefer to keep it as an absolute delta, which is the most logical.