I’m currently working on an accelerator beamline model that includes dipole, quadrupole, and sextupole magnets, as shown in the attached .inp file. However, it seems that the magnetic fields of some dipole magnets haven’t been set up correctly. As illustrated in the figure below,
The particle track-length densities inside the dipoles upstream of these two loss points are shown in the next two attached figures, which suggests that the magnetic field appears to be zero—yet according to the .out file, the settings were applied successfully.
=== Magnetic field region assignments ===
Region # 63 tgyi15 field=mag1 strength= 12.19180 rotation= 0 apply= 0
Here is a simplified file containing 40 lattice cards, and it reproduces the aforementioned issue. Additionally, there appears to be a related new problem: the material assignment for lattice i28 also seems to be incorrect (as shown in the figure below).
The problem in your input file is not related to the magnetic fields in the lattices, which look properly defined and applied, rather to the actual definition of the different lattices.
Looking at your geometry, I see that you defined very long prototypes compared to the actual dimension of your replicas. In view of the FLUKA tracking algorithm in presence of lattices, this implies that an electron enters the first lattice, it is roto-translated to the corresponding prototype, and it is transported in the prototype until the electrons reaches a geometry boundary crossing, meaning the end of the very long prototype. At this point, the electron is moved back from its final position in the prototype to the lattice-geometry using the inverse roto-translation. In your input, this results in the electron being moved back in the lattice-geometry well downstream the end of the first lattice.
the prototype and the replica are contained in identical container bodies
Finally, to make the problem clear, I attach here a even more simplified flair project where only two prototypes are defined and all replicas of each prototype have the same length.
Doing two runs, one with the prototype associated to the first lattice long (10 000 cm) and a second with the same length of the replicas (120.8 cm), looking at the scoring in the i15 region you get respectively the following results:
You can see now that fixing the length of the prototype to the one of the replicas, the electrons are actually transported in the magnet and are bended by the magnetic field.
Thank you for your nice and helpful reply! I modified the flair file according to your suggestion, and now the particle density is as shown in the figure—it looks perfect.