Why does my stochastic volumes calculation not actually give me a volume?

Hi everyone, so I’m having an issue with trying to run a stochastic volume calculation. The command openmc.calculate_volumes() itself runs fine but then there is no volume calculated or stated at the end. Am I missing something here?

@IRaheel The issue is that you need to explicitly specify which cells/materials you want to find the volume of. To do this, you should create one or more VolumeCalculation objects and set them on the Settings object. See the relevant section of the user’s guide for more details.

Hi Paul,

Thank you for your response. I believe I have already created a volumecalculation object and set it to the settings object but I’m still not getting a volume. Is there anything else I should be looking at?

Thank you for your guidance.

That’s strange – everything you have there looks right to me. Only other thing I can think of to check is to make sure that you see a <volume_calc> element in your settings.xml file. If you’re able to share your script and/or XML files, I can see if I’m able to reproduce this.

Hi Paul,

Thank you so much.
And yes, I think you are right actually. There is no <volume_calc> element in my settings.xml file.

For some reason I’m not able to share my script on here but these are my files. Essentially what I am trying to do is just use the cfg7 geometry to run a depletion calculation (for which I need the volume) - so the geometry is that of the cfg7 model.

materials (1).xml (979 Bytes)

settings.xml (393 Bytes)

geometry.xml (3.6 KB)

Thank you once again.

If you are assigning settings.volume_calculations = ... and then calling settings.export_to_xml(), that should be sufficient to produce <volume_calc> elements in your settings.xml file. I’m trying to think of reasons why it wouldn’t show up, but nothing really comes to mind. What version of OpenMC are you using?

Oh dear well now I have absolutely no idea what do haha. I am using OpenMC version 13.1 so the latest I believe. Could it be another matter with my script?

Many thanks for all your help.

I’m also at a loss. I tried the exact snippet of code you have above and it works fine on my end. If you’re doing this from a Jupyter notebook / Jupyterlab, maybe just try executing a normal Python script.