nrc-cnrc / EGSnrc

Toolkit for Monte Carlo simulation of ionizing radiation — Trousse d'outils logiciels pour la simulation Monte Carlo du rayonnement ionisant
http://nrc-cnrc.github.io/EGSnrc
GNU Affero General Public License v3.0
242 stars 146 forks source link

material definition order causing dosimetric difference when using xcom-mcdf photoelectric cross sections #844

Open iymadmansour opened 2 years ago

iymadmansour commented 2 years ago

Hello!

There seems to be an issue specific to the xcom-mcdf photoelectric cross-sections which can cause significant dosimetric differences when using otherwise identical media definitions which vary in the order of elements presented. The issue was initially identified when calculating key metrics related to miniature X-ray tubes. To illustrate this point, I've created a test case (attached) which has a very simple point source within a stainless steel cylinder. I've "modified" the stainless steel composition (by simply switching the order of the materials) and compared the resulting 3ddose files. For completeness, I've run the test case using both xcom-mcdf and xcom photoelectric cross-sections.

When using the mcdf-xcom cross sections, relatively large dosimetric differences are measured. The same differences are not present when using the xcom cross sections. I’ve reviewed PIRS-701 section 7 (regarding pegsless mode) and I have not seen any mention of a specific order requirement for defining material (please forgive me if this is in fact not the case!).

Questions: -Is there a specific material definition template that should be followed (I noticed there was another issue that seems to touch on this, but no elaboration is provided: https://github.com/nrc-cnrc/EGSnrc/issues/785)? If so, why? -Why is this issue I am having specific to mcdf? -Would an error message be a good idea to introduce if the defined material is not consistent with the desired material definition format?

Ancillary information: -All data are calculated using egs_brachy pulled from the EGSnrc_CLRP repository with most recent commit 134c731 -Track length scoring is used for all calculations. Muen data are provided.

I don't know if there is (are) any additional documents/information which I can provide, but if so - please let me know!

SimulationFiles.zip

ToyModelComposition1-MCDF ToyModelComposition1-XCOM

ftessier commented 2 years ago

Thanks for taking the time to report this issue @iymadmansour!

> Is there a specific material definition template that should be followed (I noticed there was another issue that seems to touch on this, but no elaboration is provided: https://github.com/nrc-cnrc/EGSnrc/issues/785)? If so, why?

I always presume(d) that the elements have to be specified in order of increasing atomic number, but I have never looked into the reason, I mean from the code's point of view.

> Why is this issue I am having specific to mcdf?

I don't know! I would have thought this requirement is across the board... Maybe @mainegra can shed light on this point.

> Would an error message be a good idea to introduce if the defined material is not consistent with the desired material definition format?

Yes, that is the least we could do to help, if it turns out that it is not practical to change the code to accept an arbitrary order of elements.

mainegra commented 2 years ago

@iymadmansour thanks for letting us know! I will take a look and see what might be the issue! In principle mcdf-xcom triggers a sorting of the elements to start sampling the interacting shell from the heaviest element in a material. Order, from the user point of view should not matter. So, clearly something is afoot!

mainegra commented 2 years ago

@iymadmansour could you check PR #845 and check that it fixes this issue? Go to the tab Files changed to see the on line that needs changing in egsnrc.mortran!

iymadmansour commented 2 years ago

@mainegra No problem! Working on it now :)