DAGMC boundary condition

My openmc code is given below:

import CAD_to_OpenMC.assembly as ab
a=ab.Assembly()
a.stp_files=[“7pin.step”]
a.import_stp_files()
a.solids_to_h5m()
import openmc

from IPython.display import Image
from matplotlib import pyplot as plt

materials

u235 = openmc.Material(name=“fuel”)
u235.add_nuclide(‘U235’, 1.0, ‘ao’)
u235.set_density(‘g/cc’, 11)
u235.id = 40

water = openmc.Material(name=“water”)
water.add_nuclide(‘H1’, 2.0, ‘ao’)
water.add_nuclide(‘O16’, 1.0, ‘ao’)
water.set_density(‘g/cc’, 1.0)
water.add_s_alpha_beta(‘c_H_in_H2O’)
water.id = 41

graphite = openmc.Material(name=“graphite”)
graphite.add_nuclide(‘C12’,1.0,‘ao’)
graphite.set_density(‘g/cc’,2.26)
graphite.id = 42

materials = openmc.Materials([u235, water, graphite])
dagmc_univ = openmc.DAGMCUniverse(filename=“dagmc.h5m”)
geometry = openmc.Geometry(root=dagmc_univ)

Define a bounding box

bounding_box = openmc.rectangular_prism(20,20,boundary_type=‘reflective’)

settings = openmc.Settings()
settings.batches = 100
settings.inactive = 2
settings.particles = 100000

model = openmc.Model(geometry=geometry, materials=materials, settings=settings)
model.export_to_model_xml()

p = openmc.Plot()
p.width = (25.0, 25.0)
p.pixels = (400, 400)
p.color_by = ‘material’
p.colors = {u235: ‘yellow’, water: ‘blue’}
openmc.plot_inline(p)
openmc.run()

geometry is shown correctly. But while running the code it shows some error as:

RuntimeError: No boundary conditions were applied to any surfaces!

how can I solve it? thanks in advance

Hi @Sabyasachi,

The bounding_box object you’ve created has reflecting boundary conditions, but it isn’t being used anywhere in the geometry that I can see. To use the rectangular prism as the boundary of your DAGMC model you can use:

cell = openmc.Cell(region=bounding_box, fill=dagmc_univ)
geometry = openmc.Geometry([cell])

Though I’ll note a couple of things:

  • The next issue you may run into is that the cell ID could clash with those in the DAGMC model. In that case you can set the dagmc_univ.auto_geom_ids attribute of the DAGMC class to True.
  • I’ll also note that the rectangular_prism generated here is 2D and DAGMC models are inherently 3D. You may want to use the RectangularParallelpiped composite surface instead and set the surface boundary conditions manually (e.g. rp.xmax.boundary_type = 'reflective')

Hope this helps!

Patrick

1 Like

Thank you Patrick. Your method worked well

1 Like

Hi Patrick,

I have created a geometry in cubit, the cylinder shaped fuel is actually enclosed in a water domain. The geometry has successfully converted into h5m file. The code is given below:
import openmc

from IPython.display import Image
from matplotlib import pyplot as plt

materials

u235 = openmc.Material(name=“fuel”)
u235.add_nuclide(‘U235’, 1.0, ‘ao’)
u235.set_density(‘g/cc’, 11)

water = openmc.Material(name=“water”)
water.add_nuclide(‘H1’, 2.0, ‘ao’)
water.add_nuclide(‘O16’, 1.0, ‘ao’)
water.set_density(‘g/cc’, 1.0)
water.add_s_alpha_beta(‘c_H_in_H2O’)
materials = openmc.Materials([u235,water])

dagmc_univ = openmc.DAGMCUniverse(filename=‘bal4.h5m’, auto_geom_ids=True, auto_mat_ids=True)
bounding_box = openmc.rectangular_prism(20,20,boundary_type=‘reflective’)

cell = openmc.Cell(region=bounding_box, fill=dagmc_univ)
geometry = openmc.Geometry([cell])

settings = openmc.Settings()
settings.batches = 120
settings.inactive = 2
settings.particles = 1000

model = openmc.Model(geometry=geometry, materials=materials, settings=settings)
model.export_to_model_xml()

p = openmc.Plot()
p.width = (25.0, 25.0)
p.pixels = (400, 400)
p.color_by = ‘material’
p.colors = {u235: ‘yellow’, water:‘red’}
openmc.plot_inline(p)

It shows problem:

WARNING: Particle 144 underwent maximum number of events.
WARNING: Particle 390 underwent maximum number of events.
WARNING: Particle 279 underwent maximum number of events.
WARNING: Particle 643 underwent maximum number of events.

Even I have changed the boundary_type to vacuum but then it shows problem like:

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

Bat./Gen. k Average k
========= ======== ====================
1/1 0.03451

WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.

WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
WARNING: The shared fission bank is full. Additional fission sites created in
this generation will not be banked. Results may be non-deterministic.
2/1 0.29152
3/1 0.23496
4/1 0.28316 0.25906 +/- 0.02410
5/1 0.33071 0.28294 +/- 0.02764
6/1 0.29656 0.28635 +/- 0.01984
7/1 0.33475 0.29603 +/- 0.01816
8/1 0.33741 0.30293 +/- 0.01636
9/1 0.32817 0.30653 +/- 0.01429
10/1 0.32218 0.30849 +/- 0.01252
11/1 0.32589 0.31042 +/- 0.01121
12/1 0.30819 0.31020 +/- 0.01003
13/1 0.34391 0.31326 +/- 0.00958
14/1 0.34969 0.31630 +/- 0.00926
15/1 0.31341 0.31608 +/- 0.00852
16/1 0.31948 0.31632 +/- 0.00789
17/1 0.29073 0.31461 +/- 0.00754
18/1 0.35823 0.31734 +/- 0.00756
19/1 0.34117 0.31874 +/- 0.00724
20/1 0.33679 0.31974 +/- 0.00690
21/1 0.34219 0.32093 +/- 0.00663
22/1 0.33271 0.32152 +/- 0.00632
23/1 0.30922 0.32093 +/- 0.00604
24/1 0.31494 0.32066 +/- 0.00576
25/1 0.33787 0.32141 +/- 0.00556
26/1 0.31956 0.32133 +/- 0.00532
27/1 0.32350 0.32142 +/- 0.00511
28/1 0.31837 0.32130 +/- 0.00491
29/1 0.34149 0.32205 +/- 0.00478
30/1 0.35485 0.32322 +/- 0.00475
31/1 0.30683 0.32265 +/- 0.00462
32/1 0.34797 0.32350 +/- 0.00454
33/1 0.33865 0.32399 +/- 0.00442
34/1 0.32677 0.32407 +/- 0.00428
35/1 0.34610 0.32474 +/- 0.00420
36/1 0.27797 0.32336 +/- 0.00430
37/1 0.34029 0.32385 +/- 0.00421
38/1 0.32603 0.32391 +/- 0.00409
39/1 0.31088 0.32356 +/- 0.00399
40/1 0.33812 0.32394 +/- 0.00390
41/1 0.31335 0.32367 +/- 0.00381
42/1 0.33263 0.32389 +/- 0.00372
43/1 0.32704 0.32397 +/- 0.00363
44/1 0.33763 0.32429 +/- 0.00356
45/1 0.31275 0.32403 +/- 0.00349
46/1 0.33732 0.32433 +/- 0.00342
47/1 0.34077 0.32469 +/- 0.00336
48/1 0.31724 0.32453 +/- 0.00329
49/1 0.35245 0.32513 +/- 0.00328
50/1 0.32012 0.32502 +/- 0.00321
51/1 0.33628 0.32525 +/- 0.00315
52/1 0.34286 0.32560 +/- 0.00311
53/1 0.35109 0.32610 +/- 0.00309
54/1 0.32581 0.32610 +/- 0.00303
55/1 0.34943 0.32654 +/- 0.00300
56/1 0.32672 0.32654 +/- 0.00295
57/1 0.34009 0.32679 +/- 0.00290
58/1 0.32261 0.32671 +/- 0.00285
59/1 0.35188 0.32715 +/- 0.00283
60/1 0.31951 0.32702 +/- 0.00279
61/1 0.30169 0.32659 +/- 0.00277
62/1 0.35895 0.32713 +/- 0.00278
63/1 0.29275 0.32657 +/- 0.00279
64/1 0.33903 0.32677 +/- 0.00275
65/1 0.32215 0.32670 +/- 0.00271
66/1 0.36862 0.32735 +/- 0.00275
67/1 0.32183 0.32727 +/- 0.00271
68/1 0.33903 0.32744 +/- 0.00267
69/1 0.32474 0.32740 +/- 0.00263
70/1 0.32970 0.32744 +/- 0.00259
71/1 0.34818 0.32774 +/- 0.00257
72/1 0.30736 0.32745 +/- 0.00255
73/1 0.34759 0.32773 +/- 0.00253
74/1 0.30709 0.32744 +/- 0.00251
75/1 0.35510 0.32782 +/- 0.00251
76/1 0.31558 0.32766 +/- 0.00248
77/1 0.32717 0.32765 +/- 0.00244
78/1 0.30746 0.32739 +/- 0.00243
79/1 0.33808 0.32752 +/- 0.00240
80/1 0.31947 0.32742 +/- 0.00237
81/1 0.31504 0.32726 +/- 0.00235
82/1 0.33674 0.32738 +/- 0.00232
83/1 0.32665 0.32737 +/- 0.00229
84/1 0.32946 0.32740 +/- 0.00226
85/1 0.35688 0.32775 +/- 0.00226
86/1 0.33045 0.32779 +/- 0.00224
87/1 0.31801 0.32767 +/- 0.00221
88/1 0.35223 0.32796 +/- 0.00221
89/1 0.32088 0.32788 +/- 0.00218
90/1 0.34545 0.32808 +/- 0.00217

How can I solve this? If you suggest me something, then I will be very grateful.

Hi @Sabyasachi,

Sorry for the delayed reply. The output from the first few particle patches in the simulation indicate to me that the source may not overlap with the fissionable material very well. By default, OpenMC applies a point source at the origin of the problem if one isn’t provided. You may need to provide a source region that covers the fissionable material in this problem more completely.

You can look here for information on how to do so.

https://docs.openmc.org/en/stable/usersguide/settings.html

https://docs.openmc.org/en/stable/usersguide/settings.html#usersguide-source

Generally, this boils down to something like:

bounds = geometry.bounding_box
box = openmc.stats.Box(bounds.lower_left, bounds.upper_right, only_fissionable=True)

source = openmc.IndependentSource(space=box)

settings.source = source

# then export and run
1 Like

Thank you Patrick. The solution worked well