Magnetic question

Dear FLUKA users and experts!
I am trying to focus 180 MeV proton beam through two magnetic fields (longitudinal magnetic field BX = 0.1t and transverse magnetic field by = 0.3T),Observe the transverse magnetic field to make the proton beam deviate from the distance in the y-axis direction, and the longitudinal magnetic field causes the proton beam to deviate from the distance in the x-axis direction.
In the attachment you can find the simulation input files (
Proton.inp (3.7 KB)
)and the custom routin magnets field()
Cmagfld.f (2.3 KB)
that I use in my simulation.But the result I calculated is incorrect. Please help me see what’s wrong with my input program
I used magnetic field in flair for the first time. Please help me modify the program

Dear Chailin,

your input file is correct (you just have a redundant MGNFIELD), but there are small issues in your routine. You are calling GEON2R giving the wrong region name. Remember that if you call the subroutine GEON2R giving the region name directly, if the region name is shorter than 8 characters, you should add extra spaces (e.g. use "Cavity2 " instead of “Cavity2”). Otherwise you can declare two CHARACTER*8 variables storing the simple region name.

You can then check the trajectory setting all the regions to vacuum and you can also plot the magnetic field. Please have a look at the corrected routine and flair project and give them a try.

Please do not hesitate to ask if something is unclear and you have further questions.

Proton.flair (4.7 KB)
Cmagfld.f (3.4 KB)

A post was split to a new topic: All data in USRBIN are zero