Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!
I am currently exploring ways to reduce computer memory usage during the geometry installation of a ICRP145 tetrahedral mesh phantom (MRCP). As far as I know, G4PVParameterised allows installation for a single mother logical volume. In this regard, the ‘ICRP145phantoms’ example suggests creating a G4PVParameterised with the mother volume being a logical volume representing the bounding box enclosing the phantom.
However, I noticed a significant reduction in memory usage when I set the mother volume of G4PVParameterised to be the logical volume of the world instead of the bounding box (Memory decreased from approximately 16 GB to 5 GB, and initialization time also significantly reduced). It is noted that both cases did not apply the smart voxel-related functions ‘SetOptimisation’ and ‘SetSmartless’ during initialization.
Could you please help me understand why such a difference occurs?
Thank you.
The two cases are different, using the world volume as mother (wrong approach, which you should avoid!) you’re parameterising on a much bigger volume, therefore the voxelisation (which is applied by default) will be inherently different. You may want indeed play with the smartless parameter to eventually reduce the memory taken by the generated voxels on the container volume.
Thank you for your prompt response. However, I would like to provide further explanation regarding why we chose to use world logical volume in this manner.
In our project, we plan to install multiple phantoms in a parallel geometry, and the geometry of these phantoms changes with each Run. During each Run, we aim to minimize the initialization time as much as possible, relative to the particle transport time.
Based on my understanding, it is generally advisable not to consider functions like setsmartless for dynamic geometry. In our case, since the geometry of the phantoms changes with each Run, the size of the phantom box also changes accordingly. Additionally, in order to minimize overlap between multiple phantoms, we created a phantom box that encloses all the phantoms. The initialization time during this setup differed by approximately 2.5 times compared to when using world logical volume (with 6 phantoms installed).
Therefore, I am curious if it would be acceptable to use the setsmartless function on the world logical volume. Furthermore, I would like to inquire about any other methods to reduce the initialization time for each Run.
Thank you for taking the time to read this lengthy explanation.
By specification, it is not advisable to use the world logical volume as mother for your parameterisation, unless you make sure that none of your parameterised volumes come to share a surface with the world boundary, as that will lead to unpredictable behaviour.
If you have geometries dynamically changing across runs you should either -disable- completely the optimisation for the portion of your setup subject to change, i.e. SetOptimisation(false) on its logical volume (you will pay the price during the simulation run, depending on the geometry complexity), or try to manually reduce the footprint induced by the voxelisation, tuning the smartless.
I understand that world logical volume should be avoided, but is it necessarily unusable? When you mention “unpredictable behavior,” are you referring to potential interruptions in particle transport calculations or inaccuracies in calculated values such as energy deposition? Thank you.
No, it has its own restrictions and your detector should be fully contained in it with some margin. See the documentation.
As I said, if you guarantee that no volumes of your parameterisation has any surface shared with the world boundaries, you can use it as mother logical for your parameterisation. Otherwise, you may experience crashes in transportation when particles reach a shared boundary.