Thanks for reporting this issue! I took a look at this using the BEAVRS benchmark (found here) and could reproduce the negative volume values. This was caused by overflow in the int
type used to track the total number of hits for a given cell/material/universe during the volume calculation process. I’ve created this pr to address that.
The other side of this is that the number of samples, N, required to reach the value specified on the trigger may be very, very large. Like any value computed in a Monte Carlo process the std. dev. will decrease as 1/\sqrt{N}. As an example, one of the cells in the BEAVRS model had a result of
Cell 76: 37701.4920406969 +/- 11.265745477911146
after 3.18 \times 10^{10} samples, so a std. dev. of 1e-2 would take an estimated 4 \times 10^{16} samples . While using relative error as the trigger type is probably more tractable, even that can result in some really large sample sizes – as we see in @kingyue’s case.
The updates I’ve made allow for a much higher number of samples and I’ve added a warning if the number of samples exceeds the max value of the C++ type we’re using now (uint64_t
) to count samples and hits in cells/materials/universes, but this can still happen. Just something to keep in mind when using the triggers in the volume calculations.
-Patrick