Problems with source.f and shape of the source

Dear fluka Experts,
I have three problem in solving a problem:
1.I want to define an energy spectrum as a source for this purpose, in line 68 of the file source_spectrum (uploaded it below), I entered the name of my spectrum file, but when i enter its name in the code on the SOURCE card, it is not define for the code and does not consider it at all, how to solve this problem?
2.if i want to define two sources at the same time, for example muon- and muon+ with different spectrum, how is this possible?
3.i want the shape of the plane source to be prependicular to the body of the cylinder that i defined in the code, but its shape is not correct.
Please help me, thank you
muspectrum.dat (4.3 KB)
source_spectrum.f (10.5 KB)
detect.flair (11.2 KB)
detect.inp (2.3 KB)

Dear @hajar.bagheri,

Thanks for your questions.

  1. First of all…Are you compiling the source routine? If no, here you will find how to compile from Flair (pag 27), and even more important, you can see a new user routine that probably could help you to solve the problems that you have.
    Here you can see the timetable of the course, where you can find all the lectures, and in particular some examples using this new source routine.

After this comment, let’s try to solve your problems just using the old source.f routine .

After compiling the input will run, but it will crash due to the following error:

Abort called from DEDX reason Exceeded upper dp/dx abscissa. Run stopped!
STOP Exceeded upper dp/dx abscissa.

This is because you are getting from your routine a particle whose energy which exceeds the value specified in the BEAM card:
From your spectrum → The Max is ~187 GeV
From BEAM card → ~0.83 GeV

Then, the energy from the Beam card has to be always larger that the maximum from your spectrum.

After these changes, your simulation should run.

  1. Sure, If you only need to sample from two different particles (same spectrum) you can do something similar to what is explained in this post
    For two spectra, It’s a bit more tricky, but possible. If you see the routine, you will find the variables
    ENEPOI, ENEPRO and ENECUM which are used to store your spectrum. What you can do is simply define new variables to store the second spectrum, and modify the code in order to call this variables in case you are using one particle or the other.

  2. I understand that you want particles perpendicular to one of the plane sides of the cylinder. To do that, you can just define the Cosines in the user routine (~ line 260).

I hope this can be useful. Let me know if you need more help

Cheers!
André

1 Like

Dear @adonadon ,
Thank you for the reply,
I study how to compile from flair (page 27), now i do not know how to creat a file with .exe extension from my spectrum (mspectrum.exe ???) and also i do not have the source_newgen.f option to choose when compiling and i only have source.f, can you help me more?

Could you please send us a screenshot of your flair window showing the compile tab?

hi @amario ,
yes of course, i uploaded it along with the files.
spectrum.txt (4.3 KB)
detect.inp (2.0 KB)
source_spectrum.f (10.5 KB)
source.f (9.3 KB)

Dear @hajar.bagheri,

It seems, that you are using a version of FLUKA not supported on this forum.

Please make sure you install FLUKA and Flair from the following locations to receive support here:
https://fluka.cern/
http://flair.web.cern.ch/flair/download.html