Source_newgen.f for a synchrotron spectrum

Dear FLUKA experts,

I would like to seek advice in using the new source_newgen.f for sampling a synchrotron radiation spectrum, whose flux spans 10^23 orders of magnitude. The synchrotron spectrum is from a dipole magnet with B=0.261 T and L=121.1 cm, which will see 200 mA of 6 GeV e-, and it was generated using the SPECTRA code. The purpose is to estimate dose to cables/electronics from the synchrotron radiation, which may penetrate our aluminum vacuum chambers. We expect that the higher-energy tail of the spectrum (>35 keV) will be the main contributor.

However when starting with a very simple input file, it appears that FLUKA is only sampling the energy up to around 100 keV, and the remaining tail of the spectrum between 100 and 300 keV is dropped, which is the most important part for our purposes.

Can anyone offer insight on how to achieve this with the source_newgen.f routine?

My relevant input files are attached below:
histogram.txt (10.0 KB)
source_newgen.f (19.2 KB)
spectrum.txt (6.9 KB)
synchrad.flair (8.8 KB)

Dear Ted,

the sampling in the source_newgen routine works correctly, but the probability of getting a primary with more than 100 keV is infinitesimally low.

It would help to use biased sampling, where the particle energy is sampled uniformly, while the particle weight is set according to the spectrum. Unfortunately, this is not available in source_newgen.

You can find a script capable of doing biased sampling here: Sampling from energy spectra
However, this script only samples the particle energy, anything else is taken from the BEAM and BEAMPOS card only.


1 Like

Thanks @horvathd for pointing me in the right direction! I now am sampling to the higher-energy tail.

I am uploading my spectrum file and the input here in case it is helpful to anyone as an example. NOTE: One should remove the extension “.dat” from Spec02.dat before running…it is only there to facilitate uploading to the forum.

Spec02.dat (17.8 KB)
spectra_sampling.flair (4.3 KB)
spectra_sampling.inp (2.7 KB)