User routine: magfld.f

Dear FLUKA users:

I’m trying to use magfld.f routine to set two region with different magnetic field, one Bx= 0.1T, another By=0.3T. But after compiling and creating executable, I get run error and I do not know why.

Here are my subroutine and flair file. Am I doing something wrong?


myMagfld.f (2.4 KB)
protonInMagnetField.flair (7.8 KB)

Dear Qingin,

there are two typos in your user routine:

  1. When you determine the region number of MAGNET2 you store it in NDIPOLE1 instead of NDIPOLE2.
  2. When you want to compare the acutal region number with NDIPOLE1 you use the undefined NRGE variabe instead of NREG.

You may want to look at the card MGNCREATe to set up multiple magnetic filed only using FLUKA cards. See also:



Thanks, David.

it works.