# Pincell model error while attempting to calulate keff

**URL:** <https://openmc.discourse.group/t/pincell-model-error-while-attempting-to-calulate-keff/4682>\
**Category:** User Support\
**Created:** [August 13, 2024, 11:11pm UTC](https://openmc.discourse.group/t/pincell-model-error-while-attempting-to-calulate-keff/4682 "2024-08-13T23:11:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AsukuA](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@AsukuA](https://openmc.discourse.group/u/AsukuA)\
**Post date:** [August 13, 2024, 11:11pm UTC](https://openmc.discourse.group/t/pincell-model-error-while-attempting-to-calulate-keff/4682/1 "2024-08-13T23:11:37Z")

</div>

Hello,

I am relatively new to openmc. I have created a test pincell model. But i tried to account for the height of the pincell and this led to termination of the process with the following error message.  
#error message  
WARNING: After particle 251 crossed surface 511 it could not be located in any  
cell and it did not leak.  
WARNING: After particle 126 crossed surface 511 it could not be located in any  
cell and it did not leak.  
WARNING: After particle 626 crossed surface 511 it could not be located in any  
WARNING: After particle 501 crossed surface 510 it could not be located in any…

import openmc  
import numpy as np  
import matplotlib.pyplot as plt  
import matplotlib.image as mpimg  
openmc.config.cross\_sections = ‘/openmc/cross-sections/cross\_sections.xml’

# Define Materials

materials = openmc.Materials()

# Active Fuel Material

uo2 = openmc.Material(name=‘uo2’)  
uo2.set\_density(‘g/cm3’, 10.66)  
uo2.add\_nuclide(‘U235’, 0.114313381)  
uo2.add\_nuclide(‘U238’, 0.761063318)  
uo2.add\_nuclide(‘U234’, 0.001758667)  
uo2.add\_nuclide(‘U236’, 0.002198334)  
uo2.add\_nuclide(‘O16’, 0.11839)  
uo2.add\_element(‘Al’, 0.000250000000)  
uo2.add\_element(‘C’, 0.000100000000)  
uo2.add\_element(‘Ca’, 0.000100000000)  
uo2.add\_element(‘Mg’, 0.000100000000)  
uo2.add\_element(‘Cl’, 0.000025000000)  
uo2.add\_element(‘Cr’, 0.000250000000)  
uo2.add\_element(‘Co’, 0.000100000000)  
uo2.add\_element(‘F’, 0.000015000000)  
uo2.add\_element(‘H’, 0.000001300000)  
uo2.add\_element(‘Fe’, 0.000500000000)  
uo2.add\_element(‘Ni’, 0.000250000000)  
uo2.add\_element(‘N’, 0.000075000000)  
uo2.add\_element(‘Si’, 0.000500000000)  
uo2.add\_element(‘Th’, 0.000010000000)  
materials.append(uo2)

# Fuel Clad/Zircaloy-4 Material

zr4 = openmc.Material(name=‘Zr4’)  
zr4.set\_density(‘g/cm3’, 6.5)  
zr4.add\_element(‘Zr’, 0.9792948)  
zr4.add\_element(‘Fe’, 0.0024000)  
zr4.add\_element(‘Cr’, 0.0013000)  
zr4.add\_element(‘Sn’, 0.0169999)  
zr4.add\_element(‘B’, 0.000002971)  
zr4.add\_element(‘B’, 0.0000006713)  
zr4.add\_element(‘He’, 0.000001652)  
materials.append(zr4)

# Moderator Material

h2o = openmc.Material(name=‘h20’)  
h2o.set\_density(‘g/cm3’, 0.99825)  
h2o.add\_nuclide(‘H1’, 0.111898)  
h2o.add\_nuclide(‘O16’, 0.888102)  
h2o.add\_s\_alpha\_beta(‘c\_H\_in\_H2O’)  
materials.append(h2o)

# Export materials to XML

materials.export\_to\_xml()

# Define Cylindrical Surfaces

fuel\_outer\_radius = openmc.ZCylinder(r=0.215)  
clad\_inner\_radius = openmc.ZCylinder(r=0.215)  
clad\_outer\_radius = openmc.ZCylinder(r=0.275)  
water\_inner\_radius = openmc.ZCylinder(r=0.6192)

# Define Z-Planes for height

z\_min = -11.5 # cm  
z\_max = 11.5 # cm  
z\_top = openmc.ZPlane(z\_max)  
z\_bottom = openmc.ZPlane(z\_min)

# Define Regions

fuel\_region = -fuel\_outer\_radius & +z\_bottom & -z\_top  
clad\_region = +clad\_inner\_radius & -clad\_outer\_radius & +z\_bottom & -z\_top

# Create Cells

fuel = openmc.Cell(name=‘fuel’)  
fuel.fill = uo2  
fuel.region = fuel\_region

clad = openmc.Cell(name=‘clad’)  
clad.fill = zr4  
clad.region = clad\_region

pitch = 0.6192 \*2  
left = openmc.XPlane(-pitch/2, boundary\_type=‘reflective’)  
right = openmc.XPlane(pitch/2, boundary\_type=‘reflective’)  
bottom = openmc.YPlane(-pitch/2, boundary\_type=‘reflective’)  
top = openmc.YPlane(pitch/2, boundary\_type=‘reflective’)

# Update water\_region to use boundary conditions

water\_region = +left & -right & +bottom & -top & +clad\_outer\_radius & +z\_bottom & -z\_top  
moderator = openmc.Cell(name=‘moderator’)  
moderator.fill = h2o  
moderator.region = water\_region

# Define Root Universe

root\_universe = openmc.Universe(cells=[fuel, clad, moderator])

# Define Geometry

geometry = openmc.Geometry()  
geometry.root\_universe = root\_universe

# Export geometry to XML

geometry.export\_to\_xml()

# Define Source

source = openmc.Source()  
source.space = openmc.stats.Box(  
lower\_left=[-11.5, -11.5, -11.5],  
upper\_right=[11.5, 11.5, 11.5]  
)

source.strength = 1.0 # Normalized value or based on empirical data

# Define Settings

settings = openmc.Settings()  
settings.batches = 100  
settings.inactive = 10  
settings.particles = 1000  
settings.run\_mode = ‘eigenvalue’

# Define Tally

tally = openmc.Tally()  
tally.filters = [openmc.CellFilter([fuel.id, clad.id, moderator.id])]  
energy\_filter = openmc.EnergyFilter([1e-5, 0.625, 0.825, 20.0])  
tally.filters.append(energy\_filter)  
tally.scores = [‘flux’]

# Add Tally to Tallies Collection

tallies = openmc.Tallies([tally])  
tallies.export\_to\_xml()

settings.export\_to\_xml()

# Run the simulation

openmc.run()

please note that the code runs without any error when i remove the height variable that defines the height of the cylinder.

please suggestions on how to resolve this will be appreciated.

Thank you.

---

<div class="post-metadata">

**Author:** ![wahidluthfi](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/wahidluthfi/32/3375_2.png) [@wahidluthfi](https://openmc.discourse.group/u/wahidluthfi)\
**Post date:** [August 14, 2024, 12:32am UTC](https://openmc.discourse.group/t/pincell-model-error-while-attempting-to-calulate-keff/4682/2 "2024-08-14T00:32:47Z")

</div>

Hi Asukua, welcome back to the community.  
As you said before, the problem might come from the reality that you forgot to add boundary conditions to your z plane so openmc thinks that this surface has transmission BC. Try to use reflective BC since 2×11.5 is quite short for a PWR fuel pin height, but if you use the full height of your reactor fuel pin, you can use vacuum BC.

```auto
z_top = openmc.ZPlane(z_max, boundary_type=‘reflective’)
z_bottom = openmc.ZPlane(z_min, boundary_type=‘reflective’)

```

Also, you can check your geometry by using openmc geometry debug, it will check the cell overlaps and more

```auto
openmc.run(geometry_debug=True)

```

---

<div class="post-metadata">

**Author:** ![AsukuA](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@AsukuA](https://openmc.discourse.group/u/AsukuA)\
**Post date:** [August 14, 2024, 1:28am UTC](https://openmc.discourse.group/t/pincell-model-error-while-attempting-to-calulate-keff/4682/3 "2024-08-14T01:28:53Z")

</div>

Thanks so much.

It worked perfectly.

The pincell wasnt intended to be that of a PWR. Its for actually small. Its for an MNSR, a tank-in-pool type reactor similar to SLOWPOKE reactors.

---

<div class="post-metadata">

**Author:** ![wahidluthfi](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/wahidluthfi/32/3375_2.png) [@wahidluthfi](https://openmc.discourse.group/u/wahidluthfi)\
**Post date:** [August 14, 2024, 1:42am UTC](https://openmc.discourse.group/t/pincell-model-error-while-attempting-to-calulate-keff/4682/4 "2024-08-14T01:42:02Z")

</div>

okay, then the vacuum boundary condition might fit your requirements.  
glad to hear that.
