Using betatron and LINAC x-ray spectrum as FLUKA beam input

Hi,
I have x-ray spectra of betatron and LINAC that I would like to use as BEAM parameter. I would like to use these spectrum to simulate an imaging system.

Looks like the option is as follows:

  1. Use 1, or 2 SOURCE cards
  2. Define the energy spread (converted to Δp) in BEAM card
  3. Divide the full energy spectrum into 18 (if 1 SOURCE card is used), or 36 (if 2 source cards are used)
  4. Put the corresponding normalized values from the spectrum in the source card entries (#1:, #2:, #3:, … #18, or 36)

My questions are:

  1. Is this the right approach?
  2. Can I not read the full continuous spectrum of the betatron or LINAC in FLUKA and use those?

Thanks in advance for your inputs.

Best regards,
UC

Dear @uchow,

I would suggest you to have a look at the lecture on the source routine. It seems to me that it would be the best solution for you. You can use it to read an histogram and use it as input.

Hi Amario,
Thanks a lot for your reply.
@ Admin. Please don’t close the discussion. I am still working on it.

Best,
UC

Dear @uchow,

I believe the administrators prefer to have one question per thread, so that each thread is more specific and the search within previous threads is more efficient.

1 Like

Hi Amario,
Sounds good. I seem to have a working source.f file which is based on the source_newg.f, the new subroutine. However, it is not clear to me why do we have to have the beginning and ending of the bins when using an external spectra (line 287 of source_newg.f).

I still need to verify if the spectrum FLUKA using is my one, or somehow picking default values. Will open a new ticket for that. I see @riya has a request and some solutions was suggested, but not clear to me how that should be done yet.

Best,
UC

Dear @uchow ,

There are many ways to check if the energy is correctly sampled or not, for example, the K.E. is represented by the parameter TKEFLK (NPFLKA). You can take a print out of these values for smaller number of histories (just for checking, put 1000 history and run it for 1 cycle). To get a print out, you can use a WRITE statement [write (,) TKEFLK (NPFLKA)]. If you use * (before and after the comma), these values will be printed in the .log file, you can copy them and make a histogram plot using any plotting software.

You can also print them on a separate file, for that you have to follow this command:

OPEN (UNIT = 90,FILE="…/abc.txt",STATUS=“UNKNOWN”)
WRITE (format, unit number)

where format is for the way you want to see the values and unit number is the file where you want to dump them.

Regards,
Riya

1 Like

Dear @uchow,

The lines 283-292 in source_newgen.f allow you to read an histogram and use it as an energy spectrum for your primaries. An histogram is not a function and is based on bins, therefore source_newgen.f needs to know where the bin starts and where it ends.

As per your second question, how to verify that the energy spectrum actually used corresponds to the one you want, I would suggest the following approach. If your geometry allows for it, you could enclosed your source in a small dummy region and use a USRBDX estimator to look at the spectrum of the primaries. Ideally, this would correspond to the one you wanted to implement.

1 Like

Dear @riya @amario,
Thanks to both of you! The simulation is working fine now. I was playing around with the data file, and looks like FLUKA accepts the spectrum as is (i.e. without making 3 column for the bins). There is perhaps some default setting not mentioned in the manual which takes care of the row spectrum data (?). I will try @riya’s method of checking soon.
Again, thanks a tons both of you!
Best regards,
UC

Hi @amario,
I was able to plot a spectra using USRTRACK on one of the objects and plotting only the BEAMPART. Not sure if this is the best way, but will give a try with other methods you and @riya suggested.
Best regards,
UC