Questions About Using Field Map to Construct Combined Fields

https://www.dacm-logiciels.fr/tracewin
Post Reply
ChinaHuan Lin
Novice
Novice
Posts: 3
Joined: Mon 13 Jan 2025 02:13
Country:
China (cn)
China

Questions About Using Field Map to Construct Combined Fields

Post by ChinaHuan Lin »

Dear Didier,
I am encountering some issues while using the Field Map feature to construct a combined magnetic field of dipole and quadrupole magnets. I would like to seek your advice on the following points:
1.When constructing the combined magnetic field, I noticed that the starting point of the first field is automatically set to (0, 0). To maintain the planned position of my first field, I used a placeholder field named "defa." Does this method work as intended?
2.In the synoptic output of the combined field diagram, what do the red and blue regions represent?
3.What is the meaning of the "Aperture" parameter in the Field Map? I noticed that it seems to influence the width of the field in the synoptic diagram to some extent, but I couldn’t discern a clear pattern.
4.When attempting to construct a short beamline segment, I found that overlapping fields result in a distorted beam trajectory. Additionally, the field exported via the Field Map Viewer lacks symmetry. Could this affect the beam transport calculations? How can I adjust the settings to achieve the expected results?
Figure 1.png
Figure 1.png (68.11 KiB) Viewed 250 times
Figure 1. Combined field without the "defa" placeholder field.
Figure 2.png
Figure 2.png (67.72 KiB) Viewed 250 times
Figure 2. Combined field with the "defa" placeholder field.
Figure 3.png
Figure 3.png (110.39 KiB) Viewed 250 times
Figure 3. Questions about the combined field diagram in the synoptic output.
Figure 4_1.png
Figure 4_1.png (165.07 KiB) Viewed 250 times
Figure 4_2.png
Figure 4_2.png (178.23 KiB) Viewed 250 times
Figure 4. Expected beam trajectory (2D and 3D).
Figure 5.png
Figure 5.png (79.98 KiB) Viewed 250 times
Figure 5. Beam trajectory output from TraceWin.
Figure 6.png
Figure 6.png (74.43 KiB) Viewed 250 times
Figure 6. Field distribution output from the Field Map Viewer.
test.zip
(2.89 KiB) Downloaded 15 times
field.zip
(24.64 MiB) Downloaded 20 times
These issues have been troubling me for some time. I sincerely hope to get your guidance!
Best regards,
H. Lin
User avatar
FranceDidier
Administrator
Administrator
Posts: 990
Joined: Wed 26 Aug 2020 14:40
Country:
France (fr)
France

Re: Questions About Using Field Map to Construct Combined Fields

Post by FranceDidier »

Dear H. Lin,

I'm not able to check yur project, because I have the error "'Impossible for the reference particle to leave the field map, Probably wrong parameters in the command SUPERPOSE_MAP_OUT"

1 - The starting point can be changed using the first command SUPERPOSE_MAP command.
2 - Red is for dipole and blue for quadrupole, it's very strange because your first 3 quad are red, I have to check when you send me a project wroking
3 - The particles are lost when they leave the chamber aperture defined by aperture parameter. The field plot can also be limited to this value if it is smaller than the actual size of your field map.
4 - No, and this field is not the one seen by the reference particle, it's the field following a straight line, so it doesn't really correspond to your case where the trajectory is curved.

At last point, looking at the synpotic plot, I think the position of your last dipole is not correct. It doesn't correspond to what you want to simulate and, moreover, the zig-zag of the reference trajectory shouldn't exist.

Regards,

Didier
ChinaHuan Lin
Novice
Novice
Posts: 3
Joined: Mon 13 Jan 2025 02:13
Country:
China (cn)
China

Re: Questions About Using Field Map to Construct Combined Fields

Post by ChinaHuan Lin »

Dear Didier,
Thank you so much for your guidance! Based on your suggestions, I have modified the kb parameter in the Field Map command for quadrupole magnets in the .dat file to adjust the field strength. This ensures that particles are not entirely lost during transport. Now, you can check my project.
test.ini
(43.77 KiB) Downloaded 18 times
test.dat
(1.34 KiB) Downloaded 21 times
However, I still have some questions regarding the original four issues:
1. Using the first SUPERPOSE_MAP command to create an empty field indeed changes the starting point. Can it be considered that creating an empty field specifies the particle's entry position, achieving a function similar to the SUPERPOSE_MAP_OUT command?
2. It seems I have not specified the field type anywhere. How does TraceWin determine whether the field file I provided corresponds to a quadrupole or a dipole magnet?
3. I now understand the meaning of the aperture parameter.
4. If "the straight line doesn't really correspond to the case where the trajectory is curved," does it mean that the trajectory output by the Field Map Viewer and the synoptic is that of the reference particle or the straight line? When I tried modifying the kb factor in the Field Map command for the dipole magnet, a very small kb factor caused the beam to deviate from the center, leading to particle loss. It seems the trajectory does not bend correctly and remains a straight line.
In fact, I believe the position of my last dipole is correct because I created a 2D model of the combined field externally using CAD software.
fieldmap&trajectory.zip
(26.81 KiB) Downloaded 17 times
I have verified all the field starting coordinates and the beamline start and end coordinates, which are consistent with the synoptic output. The occurrence of the "zig-zag of the reference trajectory" can be explained if the reference trajectory always connects the starting coordinates of each field and finally connects to the coordinates entered in the SUPERPOSE_MAP_OUT command.
I think the main issue now is that I don’t fully understand how the reference particle is defined in the combined field, especially when the dipole magnet bends the beam.
Looking forward to your reply! Thank you once again for your assistance!
Regards,
H. Lin
User avatar
FranceDidier
Administrator
Administrator
Posts: 990
Joined: Wed 26 Aug 2020 14:40
Country:
France (fr)
France

Re: Questions About Using Field Map to Construct Combined Fields

Post by FranceDidier »

Dear H. Lin,

I still have the same error, despite your changes.
I've updated TraceWIn to correct the colours of the elements that weren't working very well in your case (blue:quad, red:dipole).
I've also changed the way I draw element sizes in this latest version and try Bend size =0.8 and Quad size = 0.4 (this is a fraction of their respective apertures), you should get things closer to what you expect. Except for the fourth quad. In my opinion there's a problem with it because it comes after the last bend and not before as indicated in the dat file. It's going to be quite complicated, so I suggest you reduce the length of your dipole elements. It will normally be easier to understand.
1- No, I still don't see why you need this empty card. Use the first SUPRPOSED command to fix the starting point, you can also reduce the length of your first bend.
2 - If the angle of the map's entry is the same at its ouput then it's a quad.
4- In the Synoptic plot, no calculation is made on the particles, so I don't know the trajectories and I just draw a straight line between the entry and exit of the map.

I still say that the zig-zag is not normal. Please reduce the bend field map lenght, ca will simplifie everything.
Otherwise the reference particle during simulation is simply transported through the superposition of fields it finds on its path, advancing step by step.

Regards,

Didier
ChinaHuan Lin
Novice
Novice
Posts: 3
Joined: Mon 13 Jan 2025 02:13
Country:
China (cn)
China

Re: Questions About Using Field Map to Construct Combined Fields

Post by ChinaHuan Lin »

Dear Didier,

I have noted your updates to TraceWin, and they are highly effective. With the ability to distinguish between quads and dipoles, the shapes and colors are now displayed correctly. Thank you for the improvement!

As you mentioned, reducing the length of the dipoles helps mitigate potential issues. Following your advice, I have shortened the dipoles and reconstructed the superposed field.
Field_map.ini
(43.77 KiB) Downloaded 3 times
Field_map.dat
(980 Bytes) Downloaded 4 times
field.zip
(12.49 MiB) Downloaded 3 times
Regarding the use of the empty card, the reason I included it is that when the starting point of the first field is not at (0, 0), omitting a placeholder for this field results in the Synoptic plot forcing the first field’s starting point to (0, 0).
Field_map_without_emptfield.dat
(982 Bytes) Downloaded 5 times
fig1.png
fig1.png (84.44 KiB) Viewed 47 times
Using an empty field as a placeholder ensures that the field distribution matches the expected geometry.
fig2.png
fig2.png (87.26 KiB) Viewed 47 times
The issue with the project failing to run might be related to updates in the newer TraceWin versions. It seems that the newer version has added some checks for particle exit information specified by the SUPERPOSE_MAP_OUT command (which may not have been present in older versions). After updating, I encountered the same error that you described.
fig3.png
fig3.png (21.08 KiB) Viewed 47 times
To help clarify the geometry I aim to construct, I have detailed the particle trajectory and field distribution in a CAD diagram and modified the .dat file accordingly.
fig4.png
fig4.png (314.38 KiB) Viewed 47 times
fieldmap.zip
(41.22 KiB) Downloaded 4 times
I am unsure how to adjust the SUPERPOSE_MAP_OUT command in the superposed field model to resolve the error. I suspect the issue arises from a mismatch between the particle entry point and the field reference point for the dipoles, which may also explain the problem with quad recognition in this project.
fig5.png
fig5.png (418.01 KiB) Viewed 47 times
Does TraceWin require the particle entry point to exactly match the field reference point when importing field maps? If there is a mismatch, how should the .dat file be configured to ensure smooth execution?

Looking forward to your guidance.

Regards,
H. Lin
User avatar
FranceDidier
Administrator
Administrator
Posts: 990
Joined: Wed 26 Aug 2020 14:40
Country:
France (fr)
France

Re: Questions About Using Field Map to Construct Combined Fields

Post by FranceDidier »

First I fixed another problem concerning the drawing of the first element in synopic plot.
So I propose you confoguration below working, but some adjustement are needed on SUPERPOSED_MAP_OUT parameters probably

Code: Select all

SUPERPOSE_MAP_OUT 3954.293 2283.012 0.0 0 -0.0 -59.99999999999999
SUPERPOSE_MAP 431.147559019499 -74.89084461376962 0.0 0 0.0 14.999999999999998
FIELD_MAP 0070 1000.0 0 400.0 1.0 0 0 2 bend
SUPERPOSE_MAP 1451.5544456622767 301.85935394489803 0.0 0 0.0 29.999999999999996
FIELD_MAP 0070 400.0 0 100.0 0 0 0 2 quad_150
SUPERPOSE_MAP 1841.265877365274 526.859353944898 0.0 0 0.0 29.999999999999996
FIELD_MAP 0070 400.0 0 100.0 0 0 0 2 quad_150
SUPERPOSE_MAP 2230.9773090682716 751.859353944898 0.0 0 0.0 29.999999999999996
FIELD_MAP 0070 400.0 0 100.0 0 0 0 2 quad_150
SUPERPOSE_MAP 2620.688740771269 976.859353944898 0.0 0 0.0 29.999999999999996
FIELD_MAP 0070 400.0 0 100.0 0 0 0 2 quad_150
SUPERPOSE_MAP 3010.4 1201.858 0.0 0 0.0 44.99999999999999
FIELD_MAP 0070 1000.0 0 400.0 1.0 0 0 2 bend
syno.jpg
syno.jpg (60.12 KiB) Viewed 13 times
Now clearly here the particle entry point must correspond to the centre of the field map of the last dipole and that's not what you want. So the solution is, as your elements don't overlap after all, to do the following:

Code: Select all

SUPERPOSE_MAP_OUT .....
SUPERPOSE_MAP ...
FIELD_MAP ...
DRIFT 
SUPERPOSE_MAP_OUT .....
SUPERPOSE_MAP ...
FIELD_MAP ...
DRIFT 
SUPERPOSE_MAP_OUT .....
SUPERPOSE_MAP ...
FIELD_MAP ...
DRIFT 
..
.
Each element is independent and can be positioned exactly as you wish.

Regards,

Didier
Post Reply