Segmentation fault - invalid memory reference

Hi,

I was trying to run OpenMC with JEFF3.2 libraries downloaded from NEA-OECD in ACE format and converted into .hdf5 format using openmc-ace-to-hdf5 script. Unfortunately, when I am trying to run openmc, it crashes when I use in input several elements (Sm, for example). I am getting the following message in console output:

====================> K EIGENVALUE SIMULATION <====================

Bat./Gen. k Average k
========= ======== ====================

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0 0x7FA49A7B2E08
#1 0x7FA49A7B1F90
#2 0x7FA4999404AF
#3 0x4E4D48 in __angle_distribution_MOD_angle_sample
#4 0x4DE42E in __physics_MOD_elastic_scatter
#5 0x4DE7E9 in __physics_MOD_scatter
#6 0x4DF0CB in __physics_MOD_sample_reaction
#7 0x4DF276 in __physics_MOD_collision
#8 0x4ACB71 in __tracking_MOD_transport
#9 0x4839F6 in __simulation_MOD_run_simulation._omp_fn.0 at simulation.F90:?
#10 0x7FA499EF5CBE
#11 0x483C7A in __simulation_MOD_run_simulation

Process finished with exit code 0

I compiled the code with -Ddebug=on option and got the same error and following message in output:

“At line 47 of file /home/denis/OpenMC3/openmc/src/angle_distribution.F90
Fortran runtime error: Index ‘1’ of dimension 1 of array ‘this%energy’ above upper bound of 0”

Do you have any ideas from where this error can come? Probably, you are already familiar with this error.

Thank you in advance,

Denis.

Hi Denis,

Thanks for reporting this error. I was able to reproduce it and have a fix that will go into the next release. If you want to manually apply the fix yourself in the meantime, you can see what changes I made here.

Also, you might want to convert the JEFF 3.2 ACE files using openmc-get-jeff-data rather than openmc-ace-to-hdf5. The former script makes some changes to ensure that metastable isotopes get converted correctly.

Best regards,
Paul

Hi Paul,

Thank you for your update. Sorry for not reporting that but I came to the same lines of the code when I tried to figure out the source of the program faults. I was not sure that replacement of the uncorrelated energy distribution with uniform distribution is correct (since the problem could come also from the conversion of the files from ace to hdf5). Therefore, I have started to look into the hdf5 files. I have found that for problem isotopes (isotopes which I have identified: “Cs134”, “Sn126”, “Ce140”, “Nd142”, “Sm150”). The problem is (as I could understand it) that during conversion from .ace into hdf5 format, the field “UncorrelatedEnergy” is created, however there is no any data within this field. It leads consequently to the not allocation of the appropriate arrays in the OpenMC and, finally causes invalid memory reference error. Please, note that none of the isotopes from the list is metastable. I have used openmc-get-jeff-data script for the conversion of the libraries from ace to hdf5. Do you know about this bug/feature? Did you have the same problems with “ace” version of OpenMC?

In addition I have several questions:

  1. Is it possible to obtain previous versions of the OpenMC (for example, with possibility to use the ace libraries without conversion them into hdf5). It would help in the debugging of the new versions of the code.
  2. Do you use any IDE for the development of the code? The existence of the project for IDE would extremely reduce the time for the debugging of the code. Probably, it is not so important for your group, since you are involved into the development of the code form the beginning. However, for a newcomers who wants to introduce any modifications/fix the bugs, it would be extremely helpful.

Thank you,

Best regards,

Denis.

Hi,

Sorry, I haven’t noticed that you have made some changes in the .py files for conversion. So, I think the problem with empty “UncorrelatedEnergy” field is solved now.

Best regards,

Denis.

Hi Denis,

The problem should be solved, although the change I made was not in the .py files but rather in the the Fortran source. A little more background on the problem – UncorrelatedAngleEnergy is used for reaction products where the secondary angle and energy distributions are uncorrelated, i.e., they are sampled independently of one another. Although it is not truly “uncorrelated”, we use this distribution type for elastic scattering (and leave the energy distribution empty). Normally, the angular distribution is specified via a Legendre expansion or a tabulated distribution. However, in the ACE format, a missing angular distribution signifies that it is to be treated isotropically. When the ACE data is converted to HDF5, this causes the angular distribution to be missing in the HDF5 data, and in the case of elastic scattering, OpenMC didn’t know what to do when the angular distribution was missing. The changes that I made basically say “if there is no angular distribution, sample an isotropic distribution”.

Previous versions of the code can be obtained either through git (e.g., git checkout v0.8.0) or from the releases page on github.

As for an IDE, I personally use emacs and I believe most of our developers use either emacs or vim. You should be able to use a graphical IDE if you wish, but we don’t have any “project” files set up.

Best regards,
Paul

Hi Paul,

Thank you for your explanations and answers. They were useful for me.

Best regards,

Denis.