Moderators: michael_borland, soliday
-
Skamarokha
- Posts: 32
- Joined: 14 Apr 2021, 09:42
Post
by Skamarokha » 09 Apr 2025, 23:05
Hi!
It looks like K1 parameter is ignored in SBEN and CSBEND elements if ANGLE is very small or zero. And it is by design for some reason. If I change ANGLE to very small value (like 1e-7) I get following warning:
Code: Select all
************************** Summary of warnings ****************************
1 types of warnings were recorded:
2* CSBEND has radius > 1e6 but non-zero K1.
*****************************************************************************
We are used to use elements with combined functions in MAD-X, it's convinient for accelerator design. Is there a reasoning behind why it's different in elegant? Can it be fixed or can you add a note in the manual about this?
Respectfully,
Mikhail A. Skamarokha.
-
michael_borland
- Posts: 2006
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
-
Contact:
Post
by michael_borland » 14 Apr 2025, 12:00
Mikhail,
If you look at the detailed warning message (earlier in the log file), it should say that it is treated as a KQUAD but that higher-order multipoles are ignored. (This limitation is because of differences in how KQUAD and CSBEND specify higher multipoles.)
--Michael
-
Skamarokha
- Posts: 32
- Joined: 14 Apr 2021, 09:42
Post
by Skamarokha » 15 Apr 2025, 09:17
Michael,
Both warning messages - the one that I showed you and the one that you mention, are being displayed only in the case when ANGLE is small. When ANGLE=0 there are no messages and SBEND or CSBEND is not treated as KQUAD, K1 is ignored.
I made an example illustrating the issue. Mistakes are possible.
run.ele - script with 3 examples
1 - fodo made with KQUADS only
2 - fodo starting and ending with halves of focusing KQUADS, CSBEND with negative K1 and ANGLE=0 in the center
3 - same as 2, but ANGLE of defocusing K1 in CSBEND is 1e-20
fodo.lte - fodo beamlines, first with KQUADS, second with CSBEND in the middle
run.log - log file with terminal output. You can see from this log that there are no warnings when ANGLE=0 (2nd example)
You can see from the attached figure that in cases 2 and 3 CSBEND behaves as drift.
-
Attachments
-
- CSBEND and KQUAD example.zip
- (1.3 MiB) Downloaded 73 times
-

Respectfully,
Mikhail A. Skamarokha.
-
michael_borland
- Posts: 2006
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
-
Contact:
Post
by michael_borland » 16 Apr 2025, 11:18
Mikhail,
You are correct that there is a bug when the angle is very small. If you build from source, the attached files contain the fix. Otherwise, the fix will appear in the next version.
Thanks for reporting this bug.
--Michael
-
Attachments
-
- csbend.c
- (252.77 KiB) Downloaded 69 times
-
- bend_matrix.c
- (73.92 KiB) Downloaded 68 times