Error when determining the magnetic field with the MGNCREAT card

Dear Fluka experts,
I am trying to use the MGNCREATe card to determine the quadrupole magnetic field but it gives the same error as in forum MGNCREAT; Abort called from MFDCR - Physics, Transport and Magnetic Fields - FLUKA User Forum (

Could you help me identify what I’m missing here ( testmgcreat.inp (1.3 KB)
testmgcreat.flair (1.0 KB)).

Next, I would like to create a solenoid magnetic field, so I would like to know if it is possible to do this with MGNCREATe and MGNDATA cards?

If yes, could you please explain how I can do this.

Thank you in advance for your help.

Dear @zamirkhanyan

the solution was already posted in the other topic.

The solenoidal field can be implemented with an interpolated R-Z field.

Best, Luigi

Dear Luigi,
Thanks a lot for the quick response. I updated the FLUKA version and now it works in case of dipole and quadrupole. Unfortunately there is still an error for the R-Z field you suggested for the solenoid field implementation. Error files and inputs are attached.
I would really appreciate it if you could help me solve this problem.
testsolenoid001.out (9.0 KB)
testsolenoid.flair (3.0 KB)
testsolenoid.inp (1.5 KB)
testsolenoid001.err (136 Bytes)

Thanks in advance
Best regards

Hello @zamirkhanyan ,

the message reported in the output file says that there is no grid for the requested interpolated field.
You have to define the values of the field in an interpolated grid with an MGNDATA card.
Please refer to the manual for more details.

Having said that, in case you simply need to define the field inside the solenoid, you can define it with a

  • MGNCREAT with type CONST and U=0, V=0, W=1 (assuming that the axis of the solenoid is along the Z-axis)
  • MGNFIELD to associate the previous field to the concerned region.

Let me know if this works for you.

Cheers Luigi

Dear Luigi,
Unfortunately, the problem persists, throwing an error “Abort called from MFDTST reason Missing field data”, but I added magnetic force using the MGNFIELD card, as you can see in the picture.
Could you tell me what is missing?
Besides, if I understand correctly, the radial component of the magnetic field cannot be set in this way, right?
One more thing, I would like to know if it is possible to input as a magnetic field data file for simulation. If yes, then I will be very grateful if you teach me how can I do it?

Best regards

Dear Zohrab,

I believe that you changed the type in the MGNCREAT. However, this does not automatically delete the continuation lines present, as you can see in the snapshot below (circle area in the bottom frame).

You can now edit the card with the bottom indicate by the red arrow and set the number of lines to 1 in the Edit Card window, or, even more simply, delete the MGNCREAT and create a new one.

Yes. The constant field is a crude simplification for a solenoid filed.
It depends on your application if it is suitable.

Yes, you can with an RZ interpolated field, which can be defied by the MGNDATA card. More details in the manual.
Note that card can have as many continuation lines as needed by the number of nodes set in the MGNCREAT card.

Please let me know if you need further help.

Cheers Luigi

1 Like

Dear Luigi,
Thanks a lot for the detailed explanation!
Best regards