Is it possible to reproduce up to a negligible error the secondary emission using the source_newgen.f?

Dear FLUKA experts,

I first ran the simulation as attachment named “Gamma_Camera_400MeV” which includes a primary beam of carbon ions, a simple geometry and as scoring the DETECT card.

Then, I ran another simulation with same beam, avoiding collimator and detector and using just the target: I saved the secondary photons and the neutrons via mgdraw.f routine (“Ph_n_extraction_MGD” file). Using the “source_newgen.f” routine, I built different sources which aimed to reproduce the secondary emission when the carbon ions are launched at some target, without their direct use, based on the “Ph_n_extraction_MGD” data. For this, I wrote the input and FLAIR file “Gamma_Camera_C400MeV_10mm” both for photons and for neutrons, since with mgdraw.f I saved separately in two different files the photon and neutron contributions. Since Ph_n_extraction_MGD” was spawned on 10 cores, I obtained 10 “fort” files describing the neutrons and 10 “fort” files describing the photons and then I compiled 20 source files.

My idea was to get the same spectrum, using the card DETECT, both from the simulation with carbon ions and the other in which I was sampling from the phase space generated from source files. The result was not as expected since a factor close but higher than 2 separates the two described approaches (the original simulation with carbon ions is below the one in which I am sampling from phase space).
Am I missing something? Should I increase the number of carbon ions from the simulation with which I am building the phase space to improve the result? Do you have any suggestions to improve my idea and approach?

I leave in the attachment all the cited and used files. Thanks in advance.

Best regards,
Andrea

Complete carbon ion simulation:
Gamma_Camera_400MeV.flair (5.6 KB)
Gamma_Camera_400MeV.inp (6.2 KB)

mgdraw.f file:
Ph_n_extraction_MGD.f (10.0 KB)

Neutron sampling:
Gamma_Camera_C400MeV_10mm.flair (9.7 KB)
Gamma_Camera_C400MeV_10mm.inp (5.9 KB)

Photon sampling:
Gamma_Camera_C400MeV_10mm.flair (7.1 KB)
Gamma_Camera_C400MeV_10mm.inp (5.5 KB)

Dear Andrea,
here a few immediate remarks of different kinds that may not represent yet a full diagnosis of the problem:
i. in your mgdraw.f file you exceed column 72, so I’m not sure what you get in your phase space file as far as the last two variables, including the weight WTRACK, are concerned;
ii. you do not attach your source_newgen.f routine, where in principle you should not sample a single phase space file entry, rather a full event that may comprise different particles produced in the same primary ion history (i.e. sharing the same NCASE value, to be also printed in mgdraw.f);
iii. it’s not clear how you normalize your two step results, which will be given per neutron/photon and still require to be multiplied by the number of neutrons/photons per carbon ion.

Dear Francesco,
thanks a lot for your prompt and helpful reply.

Regarding your comments:
i. I checked the 100 debug lines in output files this morning and the variables (particle code, particle energy, positions, cosines and weight) were sampled correctly;
ii. I did not print the NCASE value since it is not required by the “read_phase_space_file” subroutine. I am interested in the separate sampling of neutrons and photons, so it is not clear to me why should I sample a full event. Anyway, how can I incorporate the NCASE values in “source_newgen.f” file?
iii. In the beginning, I thought that by sampling weights of photons and neutrons generated by carbon ion irradiation the results were automatically normalized per unit of carbon ions. But, it is not the case as I checked thanks to your helpful comment. So, could you please suggest me a way to obtain the results just per unit of carbon ions? Is it just a matter of multiplication by a factor?
I leave you as attachment one of the source_newgen.f files I used. It belongs to the flair file in which I was sampling just neutrons. “Neutron_file_1” is one of the outputs of mgdraw.f.

Thanks again and best regards,
Andrea

Source_n_1.f (18.6 KB)

i. good (gfortran allows one to break the 72th column limit);
ii. I see that the standard source_newgen.f does not support the NCASE grouping, which remains desirable;
iii. this is in fact the key point: you have to multiply the two step results by the sum of the particle weights contained in your phase space file and divide by the number of carbon ion histories you ran to produce the latter.

1 Like