Is Specsour card conflicting with Source card defining energy spectra?

Dear expert,
Since I am a new learner and not good at Source.f card, I use Specsour card to define two beam with the same energy (130 MeV) but opposite direction (one is positive and the other one is negative). The computation could be finished successfully.

image

  1. The first question is that I scored USRTRACK of the two target (the material is set to vacuum) and I check the output file while I was confused when I found that the max value of 25 is located in the energy bin of 130MeV-140MeV rather than max value of 50 located in the energy bin of 120MeV-130MeV as I expected, is there any point I made a mistake?

image
image

  1. Now I want to make a more complex simulation. The energy is not constant but follow energy spectra. I follow the guidance of the topic of [Sampling from energy spectra] (Sampling from energy spectra). The CERN-FLUKA-spectra-sampling.tgz (21.0 KB) is download and installed successfully and the example-input in the CERN-FLUKA-spectra-sampling.tgz could also be run successfully.
    I add the energy spectra file of spec01 to my simulation. The code responds error message of Abort called from SPTCRD reason BEAM SPOT NONSENSE IN THIS CONTEXT Run stopped! STOP BEAM SPOT NONSENSE IN THIS CONTEXT.

image
cdmz20.flair (10.8 KB)
cdmz20.inp (10.4 KB)
Spec01.zip (414 Bytes)

I know the function of Specsour card is something like Source.f card. Dose that mean Specsour card conflicting with Source card defining energy spectra and they could not be used at the same time?

The .Flair file and the input file is attached. And I will appreciate if any expert could answer my questions.

Thank you.

Dear Jia,

  1. In FLUKA the definition of the energy bin is: [E bin _{min} : Ebin_{max}), i.e. the lower boundary is included, while the higher is not. (Except for the highest bin, where both are included.)

    It is important to remember, what are you scoring. With USRTRACK you are getting the track length of the particle divided by the size of the scoring volume (this is assumed to be 1 cm^3 if not specified) and the width of the bin in energy normalized to one primary.

    So the unit of the value 25 is 1/cm^2/GeV/primary. To get the acual number of electrons passing through we need to multiply this with the volume and energy width (0.01 GeV)of the scoring bin and divide with the path length of one electron (0.5 cm if your case). With this we get 0.5 1/primary. Which means half of the primaries are scored, as we expect.

    It would be more straight forward to use USRBDX to score the number of particles passing through a surface than using USRTRACK in this case.

  2. It is not possible to use SPECSOUR with a user source routine, only one of the can be active at a time. If you need a custom energy spectrum for your beams, then you will have to program the beams in the user routine by yourself.

    You may want to look at the source_newgen.f user source routine in the FLUKA manual: 13.2.20} source.f: user-written source | FLUKA (Section: 13.2.20.bis} source_newgen.f: user-written source) and search the forum for help implementing it.

Cheers,
David

Thank you David, it is great helpful for me. and may i ask another question? if i want to define discrete energy distribution, should i set the min energy equal to the max energy of the bin. i found there is only energy bin defined in the readme file. thank you.

Dear Jia,

If I understand correctly, you want to use the histogram sampling routine of the source_newgen.f user routine to use with a discrete energy distribution.

In this case, I wouldn’t use this subroutine, but I would write my own designed to deal with discrete energies.

Cheers,
David

Dear David,

Thank you for your reply. I will have a try according to your guidance. Have a good day.