Error running dagmc model for DPA calculation

Dear OpenMC team,
With reference to the thread Normalization of 'damage-energy' score results - #11 by abarun, i am currently trying to run a dagmc enabled model that calculates the dpa for the defect configuration. The execution stops after the call to openmc solver throwing the following error.

                 | The OpenMC Monte Carlo Code
       Copyright | 2011-2022 MIT, UChicago Argonne LLC, and contributors
         License | https://docs.openmc.org/en/latest/license.html
         Version | 0.13.2
        Git SHA1 | 030f73a8690ed19e91806e46c8caf338d252e74a
       Date/Time | 2023-03-09 22:42:15
   MPI Processes | 1
  OpenMP Threads | 1

 Reading settings XML file...
 Reading cross sections XML file...
 Reading materials XML file...
 Reading geometry XML file...
Set overlap thickness = 0
Set numerical precision = 0.001
Loading file dagmc.h5m
Initializing the GeomQueryTool...
Using faceting tolerance: 0.001
Building acceleration data structures...
Implicit Complement assumed to be Vacuum
Writing from init_geometry !!!!!
n_cells:2
icell:0, Line 199
icell:0, Line 248
c->material_[0]:1
icell:0, Line 251
Writing from line 259: icell: 0
icell:1, Line 199
 ERROR: No boundary conditions were applied to any surfaces!
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode -1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
Traceback (most recent call last):
  File "dpa.py", line 106, in <module>
    sp_filename = model.run()
  File "/home/ir-bala2/.local/lib/python3.7/site-packages/openmc/model/model.py", line 590, in run
    event_based)
  File "/home/ir-bala2/.local/lib/python3.7/site-packages/openmc/executor.py", line 280, in run
    _run(args, output, cwd)
  File "/home/ir-bala2/.local/lib/python3.7/site-packages/openmc/executor.py", line 118, in _run
    raise RuntimeError(error_msg)
RuntimeError: No boundary conditions were applied to any surfaces! -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with errorcode -1. NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes. You may or may not see output from other processes, depending on exactly when Open MPI kills them. ------------------------------------------

Not pretty clear on how to assign the boundary condition on dagmc surfaces. Eager to hear from you any advice on fixing this issue.

The python code used for this calculation is given below for your reference.

from IPython.display import HTML
HTML('<iframe width="560" height="315" src="https://youtube.com/embed/VLn59FSc4GA" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>')

"""This first stage sets up the geometry and materials for the simulation."""

import openmc
import json
import sys
import os

# MATERIALS
density_of_tungsten_in_g_per_cm3 = 19.3
my_material = openmc.Material(name='Tungsten')
my_material.set_density('g/cm3', density_of_tungsten_in_g_per_cm3)
my_material.add_element('W', 1.0, percent_type='wo')

mats = openmc.Materials([my_material])

# GEOMETRY
dag_univ = openmc.DAGMCUniverse(filename='dagmc.h5m')
geom = openmc.Geometry(root=dag_univ)

# SIMULATION SETTINGS
# Instantiate a Settings object
sett = openmc.Settings()
batches = 10
sett.batches = batches
sett.inactive = 0
sett.particles = 10000
sett.run_mode = 'fixed source'

# Create a DT point source
source = openmc.Source()
source.space = openmc.stats.Point((0, 0, 0))
source.angle = openmc.stats.Isotropic()
source.energy = openmc.stats.Discrete([14e6], [1])
sett.source = source

"""This sets up the damage energy tally using the MT number 444. A list of MT numbers including their reaction discription can be found [here](https://t2.lanl.gov/nis/endf/mts.html)."""
tallies = openmc.Tallies()

# added a cell tally for DPA to the tungsten vessel cell
material_filter = openmc.MaterialFilter(my_material)
reaction_tally = openmc.Tally(name='DPA')
reaction_tally.filters = [material_filter]
reaction_tally.scores = ['444']  # note use of 444 in string format
reaction_tally.nuclides = ['W180','W182','W183','W184','W186']
tallies.append(reaction_tally)
tallies.export_to_xml()

"""This runs the simulation."""

model = openmc.model.Model(geom, mats, sett, tallies)
os.system("rm *.h5")
#!rm *.h5

sp_filename = model.run()

Thanks and regards,
Arun

I added this convenient feature a while back to solve just this sort of problem.

You can get a openmc to automatically make surfaces that bound the dagmc geometry and assign them vacuum boundary types.

bound_dag_univ = openmc.DAGMCUniverse(filename=‘dagmc.h5m’).bounded_universe()
geom = openmc.Geometry(root=bound_dag_univ)

This assumes you have no graveyard cell in the dagmc geometry.

Thanks Shimwell. I got that to work after referring to “bounded_universe” object. However hit with further issues as given here.

Reading W180 from
 /home/ir-bala2/rds/rds-ukaea-ap001/arunpb/Aurora_dependencies/openmc-bld/openmc/
 data/endfb80_hdf5/W180.h5
 Reading W182 from
 /home/ir-bala2/rds/rds-ukaea-ap001/arunpb/Aurora_dependencies/openmc-bld/openmc/
 data/endfb80_hdf5/W182.h5
 Reading W183 from
 /home/ir-bala2/rds/rds-ukaea-ap001/arunpb/Aurora_dependencies/openmc-bld/openmc/
 data/endfb80_hdf5/W183.h5
 Reading W184 from
 /home/ir-bala2/rds/rds-ukaea-ap001/arunpb/Aurora_dependencies/openmc-bld/openmc/
 data/endfb80_hdf5/W184.h5
 Reading W186 from
 /home/ir-bala2/rds/rds-ukaea-ap001/arunpb/Aurora_dependencies/openmc-bld/openmc/
 data/endfb80_hdf5/W186.h5
 Minimum neutron data temperature: 294 K
 Maximum neutron data temperature: 294 K
 Reading tallies XML file...
 Preparing distributed cell instances...
 Reading plot XML file...
 Writing summary.h5 file...
 Maximum neutron transport energy: 150000000 eV for W180

 ===============>     FIXED SOURCE TRANSPORT SIMULATION     <===============

 Simulating batch 1
 ERROR: More than 95% of external source sites sampled were rejected. Please
        check your external source's spatial definition.

Looks like the particles are passing freely over a void region in my DAGMC model, which must be associated with an object representative of the geometry. You might probably give some directions.
Kind regards,
Arun

I’ve seen this error before when the source is located outside of the geometry. Perhaps it is worth checking the location of the source and seeing if it is inside the bounding box geometry.

Take a look at the contents of settings.xml and geometry.xml as they contain the source location and bounding surfaces

The error seems to be due to the lack of material points around a bounded geometrical region the code assumes. This arises in case of a irregular/curvilinear geometry which i am currently working with (please see figure below). I tested with a regular shaped geometry like a cuboid and it does not show this error. Enabling the code to work with in the actual material domain instead of the bounded limits might solve the problem i believe.

Thanks Shimwell. A careful selection of point source location fixed the issue. However ‘openmc.VolumeCalculation’ does not seem to output reliable values for the cell volume as it computes that based on the specification of a bounding box which often includes the additional volume resulting from the void region inside the box. This will happen for irregular goemetries (such as the one attached previously) where there is a mismatch between the bounding box and actual geometry itself. You might probably have an idea to fix this issue?
Kind regards,
Arun

@abarun As long as the bounding box specified completely covers the cells/materials that have been specified in the volume calculation, you should get a reasonable estimate of the volume.

Dear Paul,
Looks like the volume calculation yields approximate results when you encounter a curvilinear geometry shown previously. I am wondering if there is any accurate way of estimating the volume, disregarding the void region if any present within the bounding box. I guess that could be something difficult to calculate.
Kind regards,
Arun

I’m not sure I understand the void space part of the question. But perhaps these two pointers help with improving accuracy

The stochastic volume could be run with more samples/ particles to improve the accuracy and decrease the uncertainty.

The mesh size could improved by specifying a smaller faceting tolerance when exporting to DAGMC h5m geometry.

Dear Shimwell,
The void region i was mentioning refers to the the space inside the box where there is no material. The volume function essentially gives the volume of the box without any consideration to the actual geometry. In this case it outputs the volume 1750x1750x4000=12,250,000,000 as against the actual analytical value 7,068,583,471 which is appreciable. I tried running the code with more samples/particles but ended up with same volume calculation. I do not think improving the mesh size will be of any help here as the issue here is unrelated to size. The faceting tolerance although cannot be given in the version (2021.4) i am using, as this feature is no longer available after V14.1.
Kind regards,
Arun

Can we have a look at your stochastic volume calculation script, it sounds like there is something wrong with that

Yes sure

lower_left = (1750, 0, 4000.)
upper_right = (0, 1750, 0.)
cell_vol_calc = openmc.VolumeCalculation([dag_univ], 100000,lower_left,upper_right)

settings = openmc.Settings()
settings.volume_calculations = [cell_vol_calc]
settings.run_mode = ‘volume’
settings.export_to_xml()

os.system(“rm *.h5”)
openmc.run()

cell_vol_calc_results = openmc.VolumeCalculation.from_hdf5(‘volume_1.h5’)
volume_of_firstwall_cell = cell_vol_calc_results.volumes.get(2).nominal_value

I would be tempted to automated the bounding box with

lower_left, upper_right = geom.bounding_box

and pass in the material to the VolumeCalculation() instead of the dag_univ.

If you are able to upload the h5m file I can give this a go

Attached here is the h5m file for your reference

(Attachment dagmc.zip is missing)

I guess the attachement has not gone through.
Any suggestion on how the file can be transferred to you?

Not sure why the file transfer didn’t work but feel free to put a download link.

However I think the solution might be in the argument passed into the VolumeCalculation()

did this change from the message above work for you
“and pass in the material to the VolumeCalculation() instead of the dag_univ.”

The following code as suggested by you might be the right way, but the numbers are still not matching.
This computes a volume of 6,073,550,00 which is clearly wrong against the original value 2,552,544,031.

lower_left, upper_right = geom.bounding_box
material_vol_calc = openmc.VolumeCalculation([my_material], 100000, lower_left, upper_right)
settings = openmc.Settings()
settings.volume_calculations = [material_vol_calc]
settings.run_mode = ‘volume’
settings.export_to_xml()
os.system(“rm *.h5”)
openmc.run()
material_vol_calc_results = openmc.VolumeCalculation.from_hdf5(‘volume_1.h5’)
volume_of_firstwall_cell = material_vol_calc_results.volumes[1].nominal_value

Dear Shimwell,
Here is the dagmc file if you want to check the implementation.

Kind regards,
Arun