# CAD geometry running problem

**URL:** <https://openmc.discourse.group/t/cad-geometry-running-problem/3455>\
**Category:** User Support\
**Created:** [September 23, 2023, 2:27pm UTC](https://openmc.discourse.group/t/cad-geometry-running-problem/3455 "2023-09-23T14:27:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sabyasachi](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@Sabyasachi](https://openmc.discourse.group/u/Sabyasachi)\
**Post date:** [September 23, 2023, 2:27pm UTC](https://openmc.discourse.group/t/cad-geometry-running-problem/3455/1 "2023-09-23T14:27:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pshriwise](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pshriwise/32/3863_2.png) [@pshriwise](https://openmc.discourse.group/u/pshriwise)\
**Post date:** [September 25, 2023, 2:25pm UTC](https://openmc.discourse.group/t/cad-geometry-running-problem/3455/2 "2023-09-25T14:25:48Z")

</div>

> [@Sabyasachi](#):
>
> bounding\_box = openmc.rectangular\_prism(20,20,boundary\_type=‘reflective’)

It’s hard to say for sure what’s going on here without seeing the DAGMC geometry, but that geometry representation is inherently 3D yet the `rectangular_prism` function returns a region that is 2D. I’d give the `RectangularParallelpiped` object a try instead.

[class RectangularParallelepiped(CompositeSurface):](https://github.com/openmc-dev/openmc/blob/98fe64dd5ac75c423ff37772479d192ee653ac45/openmc/model/surface_composite.py#L559-L560)

---

<div class="post-metadata">

**Author:** ![Sabyasachi](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@Sabyasachi](https://openmc.discourse.group/u/Sabyasachi)\
**Post date:** [September 25, 2023, 7:33pm UTC](https://openmc.discourse.group/t/cad-geometry-running-problem/3455/3 "2023-09-25T19:33:56Z")

</div>

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.model.RectangularParallelepiped(-20,20,-20,20,-20,20,boundary\_type=‘vacuum’)

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)

Sorry I don’t know how should I apply RectangularParallelepiped function. When I applied, it shows some error like:

TypeError: Unable to set “cell region” to “\<RectangularParallelepiped at 0x7f292cdcc160\>” which is not of type “Region”

Can you suggest me something to solve it?

---

<div class="post-metadata">

**Author:** ![pshriwise](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pshriwise/32/3863_2.png) [@pshriwise](https://openmc.discourse.group/u/pshriwise)\
**Post date:** [September 25, 2023, 7:47pm UTC](https://openmc.discourse.group/t/cad-geometry-running-problem/3455/4 "2023-09-25T19:47:54Z")

</div>

The `RectangulaParallelPiped` object is a little different in application than the region returned from `rectangular_prism`. In this case, a region is generated from the `RectangulaParallelPiped` using the `-` operator.

So `cell = openmc.Cell(region=bounding_box, fill=dagmc_univ)` should become `cell = openmc.Cell(region=-bounding_box, fill=dagmc_univ)`

---

<div class="post-metadata">

**Author:** ![Sabyasachi](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@Sabyasachi](https://openmc.discourse.group/u/Sabyasachi)\
**Post date:** [September 25, 2023, 7:58pm UTC](https://openmc.discourse.group/t/cad-geometry-running-problem/3455/5 "2023-09-25T19:58:20Z")

</div>

Thank you Patrick, again you have taught me something new
