FLUKA 4.0 parentheses expansion new feature question

I noticed in the release highlights for FLUKA 4.0:

Parenthesis expansion in region definitions is evaluated runtime, if it results in too many terms at initialization.

It’s not clear to me what precisely this means. Does this mean it will not try to expand the parentheses to DNF and will simply walk the CSG tree with parentheses at run-time for the tracking algorithms if the expansion is too massive? How much slower is the tracking compared to the canonical parentheses-free case?

Hi @stwalker
your interpretation is correct. If the expansion of the parenthesis diverges with more than a certain amount of terms (user configurable up to 100k) then it will evaluate the expression during runtime on every step, which is costly depending on the expression.

There is an additional mechanism in the geometry called (dnear in fluka) that calculates a safe distance from all boundaries in the current zone in any possible direction and compensates for the cost of the CSG calculation. The safe distance on every step it is consumed and recalculated when needed.

Some tests on complex parenthesis regions for the most time consuming particles (e,g, and neutrons), I’ve got a slow down factor from 2-4.