# Segmentation fault in volume calculation

**URL:** <https://openmc.discourse.group/t/segmentation-fault-in-volume-calculation/816>\
**Category:** User Support\
**Created:** [October 15, 2020, 5:05am UTC](https://openmc.discourse.group/t/segmentation-fault-in-volume-calculation/816 "2020-10-15T05:05:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kingyue](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/kingyue/32/507_2.png) [@kingyue](https://openmc.discourse.group/u/kingyue)\
**Post date:** [October 15, 2020, 5:05am UTC](https://openmc.discourse.group/t/segmentation-fault-in-volume-calculation/816/1 "2020-10-15T05:05:16Z")

</div>

```
                           %%%%%%%%%%%%%%%
                       %%%%%%%%%%%%%%%%%%%%%%%%
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
               %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                                %%%%%%%%%%%%%%%%%%%%%%%%
                                 %%%%%%%%%%%%%%%%%%%%%%%%
             ############### %%%%%%%%%%%%%%%%%%%%%%%%
            ################## %%%%%%%%%%%%%%%%%%%%%%%
            ################### %%%%%%%%%%%%%%%%%%%%%%%
            #################### %%%%%%%%%%%%%%%%%%%%%%
            ##################### %%%%%%%%%%%%%%%%%%%%%
            ###################### %%%%%%%%%%%%%%%%%%%%
            ####################### %%%%%%%%%%%%%%%%%%
             ####################### %%%%%%%%%%%%%%%%%
             ###################### %%%%%%%%%%%%%%%%%
              #################### %%%%%%%%%%%%%%%%%
                ################# %%%%%%%%%%%%%%%%%
                 ############### %%%%%%%%%%%%%%%%
                   ############ %%%%%%%%%%%%%%%
                      ######## %%%%%%%%%%%%%%
                                  %%%%%%%%%%%

               | The OpenMC Monte Carlo Code
     Copyright | 2011-2020 MIT and OpenMC contributors
       License | https://docs.openmc.org/en/latest/license.html
       Version | 0.12.1-dev
      Git SHA1 | c5f66a3af5c1a57087e330f7b870e89a82267e4b
     Date/Time | 2020-10-15 11:25:39
OpenMP Threads | 24
 Reading settings XML file...
 Reading cross sections HDF5 file...
 Reading materials XML file...
 Reading geometry XML file...
 Loading cross section data...
 Loading UO2 data...
 WARNING: Cross sections for are only available at one temperature. Reverting
          to the nearest temperature method.
 Loading MOX43 data...
 Loading MOX70 data...
 Loading MOX87 data...
 Loading FC data...
 Loading GT data...
 Loading CRD data...
 Loading MOD data...
 Preparing distributed cell instances...
[New Thread 0x7ffff7374700 (LWP 325919)]
[New Thread 0x7ffff6b73700 (LWP 325920)]
[New Thread 0x7ffff6372700 (LWP 325921)]
[New Thread 0x7ffff5b71700 (LWP 325922)]
[New Thread 0x7ffff5370700 (LWP 325923)]
[New Thread 0x7ffff4b6f700 (LWP 325924)]
[New Thread 0x7ffff436e700 (LWP 325925)]
[New Thread 0x7ffff3b6d700 (LWP 325926)]
[New Thread 0x7ffff336c700 (LWP 325927)]
[New Thread 0x7ffff2b6b700 (LWP 325928)]
[New Thread 0x7ffff236a700 (LWP 325929)]
[New Thread 0x7ffff1b69700 (LWP 325930)]
[New Thread 0x7ffff1368700 (LWP 325931)]
[New Thread 0x7ffff0b67700 (LWP 325932)]
[New Thread 0x7ffff0366700 (LWP 325933)]
[New Thread 0x7fffefb65700 (LWP 325934)]
[New Thread 0x7fffef364700 (LWP 325935)]
[New Thread 0x7fffeeb63700 (LWP 325936)]
[New Thread 0x7fffee362700 (LWP 325937)]
[New Thread 0x7fffedb61700 (LWP 325938)]
[New Thread 0x7fffed360700 (LWP 325939)]
[New Thread 0x7fffecb5f700 (LWP 325940)]
[New Thread 0x7fffec35e700 (LWP 325941)]

```

```auto

 =================> STOCHASTIC VOLUME CALCULATION <=================

 Running volume calculation 1

Thread 1 "openmc" received signal SIGSEGV, Segmentation fault.
0x00007ffff7eb868b in openmc::VolumeCalculation::execute (this=) at /home/yuejin/Cloud/OpenMC/src/vendor/xtensor/include/xtensor/xstorage.hpp:402
402 inline auto uvector::operator[](size_type i) -> reference
(gdb) backtrace
#0 0x00007ffff7eb868b in openmc::VolumeCalculation::execute (this=) at /home/yuejin/Cloud/OpenMC/src/vendor/xtensor/include/xtensor/xstorage.hpp:402
#1 0x00007ffff7ebb1aa in openmc_calculate_volumes () at /home/yuejin/Cloud/OpenMC/src/src/volume_calc.cpp:475
#2 0x000055555555521a in main (argc=, argv=) at /home/yuejin/Cloud/OpenMC/src/src/main.cpp:44

```

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [October 15, 2020, 11:43am UTC](https://openmc.discourse.group/t/segmentation-fault-in-volume-calculation/816/2 "2020-10-15T11:43:33Z")

</div>

@kingyue Can you share a model that results in this segmentation fault? Otherwise it’s hard for us to reproduce it and figure out what’s going on.

---

<div class="post-metadata">

**Author:** ![kingyue](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/kingyue/32/507_2.png) [@kingyue](https://openmc.discourse.group/u/kingyue)\
**Post date:** [October 16, 2020, 2:50am UTC](https://openmc.discourse.group/t/segmentation-fault-in-volume-calculation/816/3 "2020-10-16T02:50:55Z")

</div>

This is a C5G7 model converted to openmc input by a toolkit from another neutronics code, so I don’t have a single python script.  
Here are all the xml inputfiles:  
[geometry.xml](https://openmc.discourse.group/uploads/short-url/zqSrpqQm1mGHK8vJPSP9cWqNCbB.xml) (5.2 KB) [materials.xml](https://openmc.discourse.group/uploads/short-url/37Y1SaoKWfDfkwlnZMrz5HTspbM.xml) (1.0 KB) [settings.xml](https://openmc.discourse.group/uploads/short-url/jOK49EiFy2Gm3kN3vdnyVPHckSY.xml) (527 Bytes)

h5 macroscopic library:  
[mgxs.h5](https://drive.google.com/file/d/1gmE6K-4xrjcXHj-boqkFuc-EKkEX_KXX/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [October 16, 2020, 6:47pm UTC](https://openmc.discourse.group/t/segmentation-fault-in-volume-calculation/816/4 "2020-10-16T18:47:28Z")

</div>

@kingyue Volume calculations in OpenMC normally calculate both the volume of a cell/material as well as the number of atoms of specific nuclides within it. Right now, it unfortunately doesn’t work in conjunction with multigroup data (see this [issue](https://github.com/openmc-dev/openmc/issues/1698)). A workaround for now would be to change your materials to use continuous-energy data; if you’re only interested in the volumes, the composition of the materials doesn’t matter.
