GEOUNED-org / GEOUNED

A tool to convert CAD to CSG & CSG to CAD for Monte Carlo transport codes
European Union Public License 1.2
57 stars 31 forks source link

[BUG] - Lost particles when dealing with rather simple torii due to the solid decomposition logic #131

Open dodu94 opened 6 months ago

dodu94 commented 6 months ago

Describe the bug

When trying to convert a typical toroidal field coil segment, even "simple" cells that are enclosed by only 6 surfaces (in this case 2 torii, two planes a cone and a cylinder), due to the way they are split during the conversion, they can generate lost particles as in the case discussed here. All useful files to reproduce this bug can be found here issue.zip

Some pictures of the original solids:

image image

And of the decomposition (obtained with the geouned "debug" option): image

with the insulator layer removed: image

and, at last, the lost particle locations: image

To Reproduce

All relevant files and settings can be found in attachment.

Expected behavior

No lost particles.

Possible solutions

I would like to suggest here two possible solutions for this kind of situations: 1) provide an option in the config.ini file that allows to bypass the solid decomposition. This means that cells should be converted one to one, relying on the fact that the analyst performed sufficient splitting on the original geometry. 2) programmatically check before the decomposition if the solid has less than or exactly 6 bounding surfaces. If that is the case, decomposing should not be applied, as the cell is already simple enough. Indeed, splitting a solid bounded by 6 surfaces with a plane will just create two other solids with 6 bounding surfaces each (in most cases).

Please complete the following information):

AlvaroCubi commented 6 months ago

This is a very relevant issue for the conversion of the JT60-SA reactor model. Please find here the picture of a simple solid with tori surfaces at the top and bottom that during division generates two very thin layers. image image