MGNFIELD

Summary

Sets the tracking conditions for transport in magnetic fields and also may define an homogeneous magnetic field. ​

See also ASSIGNMAt, STEPSIZE ​

For SDUM = RUNGKUTT:

WHAT(1)
= largest fraction of a round angle that a particle is allowed to travel in one (sub)step
Default: 0.026, corresponding to ~10 degrees
WHAT(2)

= upper limit to the error of the boundary iteration in cm (minimum accuracy accepted in determining a boundary intersection) when Runge-Kutta-Gill tracking is used Default: 0.05 cm

WHAT(3)

= tentative step length with magnetic field for Runge-Kutta-Gill tracking (cm) in zones of zero local field (see also the description of the magfld.f routine) Default: 0.5 cm

WHAT(4..6) = Bx, By, Bz components of magnetic field on the coordinate axes (in tesla). Default (Bx = By = Bz = 0.0): user-supplied subroutine MAGFLD is assumed to provide the actual values (see Notes 2 and 3 below)

For all other SDUM values

WHAT(1) =

largest angle​ in degrees that a charged particle is allowed to travel in a single step​

Default

= 57.0  deg (but a maximum of 30.0 deg is recommended!)

WHAT(2) =

upper limit to error of the boundary iteration​ in cm (minimum accuracy​ accepted in determining a boundary intersection). It also sets the minimum radius of curvature​ for stepping according to WHAT(1)

Default

= 0.05  cm.

WHAT(3) =

minimum step length if the step is forced to be smaller because the angle is larger than WHAT(1). It is also the maximum step length in areas of zero field (see ELEFLD and MAGFLD).

Default

= 0.1  cm.

WHAT(4)

– WHAT(6): = B\(_x\), B\(_y\), B\(_z\) components of magnetic field on the coordinate axes (in tesla).

Default

(B\(_x\) = B\(_y\) = B\(_z\) = 0.0): a user-supplied subroutine MAGFLD is assumed to provide the actual values (see Notes 2 and  3 below)​

SDUM
= RUNGKUTT: the 4th order Runge-Kutta-Gill​ algorithm is used for dis-homogeneous magnetic fields in vacuum instead of the standard, arc-like, algorithm
Default = no SDUM
Default

(option MGNFIELD not given): the defaults indicated for WHAT(1–6) apply if a magnetic field exists in the current region because of an ASSIGNMAt command.

Notes

  1. If B\(_x\) = B\(_y\) = B\(_z\) = 0.0, the user-written subroutine MAGFLD is called at each step to get the direction cosines and the module (in tesla) of the magnetic field as a function of region or of coordinates. A sample subroutine is provided with the FLUKA code; instructions on how to write user-supplied routines can be found in User routines.

  2. Note that the argument list of subroutine MAGFLD is (X,Y,Z,T,BTX,BTY,BTZ,B,NREG,IDISC), where BTX, BTY, BTZ are the direction cosines of the magnetic field at point X,Y,Z and time T (not the components of the field! The field magnitude is given by B). For this reason, it is imperative that MAGFLD return normalised values of BTX, BTY and BTZ​ such that the sum of their squares be = 1.0 in double precision.
    Three zero values are not accepted: if the field is zero at the point concerned, you must return for instance 0.0, 0.0, 1.0 and B = 0.0.
    On the contrary, note that B\(_x\), B\(_y\), B\(_z\) in the MGNFIELD option, given by WHAT(4)…WHAT(6) as described above, are the field components​ and not the cosines.
  3. Magnetic field tracking is performed only in regions defined as magnetic field regions by command ASSIGNMAt​. It is strongly recommended to define as such only regions where a non-zero magnetic field effectively exists, due to the less efficient and accurate tracking algorithm used in magnetic fields.
    To define a region as having a magnetic field and to return systematically B = 0.0 in that region via subroutine MAGFLD, is not allowed.
  4. The maximum error on the boundary iteration​, WHAT(2), must be compatible with the minimum linear dimension of any region.

  5. It is recommended to activate also option STEPSIZE inside and close to regions where a magnetic field is present. That option can be used to set a minimum and a maximum step size​ ​ (in cm) for every region.

  6. In case of conflict, WHAT(3) overrides the step size requested by option STEPSIZE. Therefore, it is suggested to set it not larger than the latter. The purpose of this constraint is to avoid tracking in detail low-energy particles​ along a helix of very small radius, by forcing several turns into a single step (all the energy will be deposited at the same point).

indexASSIGNMAt@ASSIGNMAt input command​

Example (number based):

*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+...
ASSIGNMAT        2.0      15.0      30.0       5.0       1.0       0.0
* A magnetic field is present in vacuum regions 15, 20, 25 and 30.
MGNFIELD        20.0       0.2      0.10       0.0       0.0       0.0
STEPSIZE       -0.05       0.0      20.0      25.0       0.0       0.0
STEPSIZE         0.3       0.0      15.0       0.0       0.0       0.0
* The maximum deviation angle due to magnetic field in any step is set
* = 20 degrees, and boundary crossings must be identified with an error
* not larger than 2 mm. If the max. angle constraint forces the step to
* be shorter than 10 cm, the step will be set = 10 cm in region 20, 25, 30,
* but will be set = 3 mm in region 15 (WHAT(1) of STEPSIZE overrides the
* general setting due to WHAT(3) of MGNFIELD). Whatever the size of the
* step, however, the accuracy of the boundary crossing position must be
* equal or better than 0.5 mm in regions 20 and 25 (probably contiguous,
* since the same accuracy must be set for regions on either side of a
* boundary). The value of the magnetic field will be provided at each
* step by the user routine MAGFLD.

The same example, name based:

*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+...
ASSIGNMAT     VACUUM   Reg15th   Reg30th       5.0       1.0       0.0
MGNFIELD        20.0       0.2      0.10       0.0       0.0       0.0
STEPSIZE       -0.05       0.0   Reg20th   Reg25th       0.0       0.0
STEPSIZE         0.3       0.0   Reg15th       0.0       0.0       0.0