# Reflective Boundary Issues

**URL:** <https://openmc.discourse.group/t/reflective-boundary-issues/4099>\
**Category:** User Support\
**Created:** [March 28, 2024, 7:26pm UTC](https://openmc.discourse.group/t/reflective-boundary-issues/4099 "2024-03-28T19:26:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daedalus](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/daedalus/32/2928_2.png) [@Daedalus](https://openmc.discourse.group/u/Daedalus)\
**Post date:** [March 28, 2024, 7:26pm UTC](https://openmc.discourse.group/t/reflective-boundary-issues/4099/1 "2024-03-28T19:26:24Z")

</div>

I was trying to do a single pin run on my model using reflective conditions as I had done before, but I can’t seem to get it working now. I am currently using the code below, but I also tried it by defining water\_rect (pitch square unit around pin) as four planes and bounding the interior region. I get the same answer for both definitions whether boundary\_type is set to reflective or not and regardless of the albedo level. I’m not sure what I’m missing.

water\_rect = openmc.model.RectangularPrism(x[2],x[2], boundary\_type = ‘reflective’, albedo = 1.0)

---

<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:** [March 29, 2024, 1:48am UTC](https://openmc.discourse.group/t/reflective-boundary-issues/4099/2 "2024-03-29T01:48:21Z")

</div>

Hi @Daedalus,

Could you share more of your model generation code? The context might be useful in determining what’s going on.

Best,

Patrick

---

<div class="post-metadata">

**Author:** ![Daedalus](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/daedalus/32/2928_2.png) [@Daedalus](https://openmc.discourse.group/u/Daedalus)\
**Post date:** [March 29, 2024, 4:03pm UTC](https://openmc.discourse.group/t/reflective-boundary-issues/4099/3 "2024-03-29T16:03:04Z")

</div>

```auto
## Geometry

    # XY Surfaces
    fuel_rod_surf = openmc.ZCylinder(r=x[1])
    gap_surf = openmc.ZCylinder(r=x[1] + gap_thickness) 
    cladding_surf = openmc.ZCylinder(r=x[1] + gap_thickness + cladding_thickness)
    vessel_inner_wall_surf = openmc.model.RectangularPrism(110,110,corner_radius=25)
    vessel_outer_wall_surf = openmc.ZCylinder(r = 80, boundary_type = 'vacuum') 
    water_rect = openmc.model.RectangularPrism(x[2],x[2], boundary_type = 'reflective')

    fuel_cell_bottoms = openmc.ZPlane(z0 = 0) # reference 0
    fuel_cell_tops = openmc.ZPlane(z0 = fuel_length)
    individual_cell_tops = openmc.ZPlane(z0=fuel_length/(2*num_segs))
    individual_cell_bottoms = openmc.ZPlane(z0=-fuel_length/(2*num_segs))
    water_bottom = openmc.ZPlane(z0 = -20, boundary_type = 'vacuum')
    water_top = openmc.ZPlane(z0 = fuel_length + 20, boundary_type = 'vacuum')

    pin_box = -water_rect & +individual_cell_bottoms & -individual_cell_tops
    rod_region = -fuel_rod_surf 
    gap_region = -gap_surf & +fuel_rod_surf 
    clad_region = -cladding_surf & +gap_surf 
    rod_water_region = pin_box & ~clad_region & ~rod_region & ~gap_region

    ## Cells
    fuel_rod = openmc.Cell(region=rod_region, fill = UOX)
    fuel_rod.volume = (fuel_length*np.pi*x[1]**2/num_segs)
    gap = openmc.Cell(region=gap_region, fill = Helium)
    clad = openmc.Cell(region=clad_region, fill = Zircalloy_4)

    vessel = openmc.Cell(region=vessel_region, fill = steel_mat)
    water_fill = openmc.Cell(region=water_region, fill = Water)
    rod_water = openmc.Cell(region=rod_water_region, fill = Water)
    outer_void_cell = openmc.Cell(region=void_region)

    ## Universes
    f = openmc.Universe(cells=[fuel_rod,clad,gap,rod_water])
    void = openmc.Universe(cells=[outer_void_cell])

    ## Core Region
    core_cell = openmc.Cell(region=core_region)
    core_lattice = openmc.RectLattice()
    core_lattice.pitch = [x[2], x[2], fuel_length/num_segs]
    core_lattice.lower_left = [-A_side/2,-A_side/2,0] 
    core_lattice.outer = void

    core_lattice.universes = [[[f for _ in range(n)] for _ in range(n)] for _ in range(num_segs)] 

    core_cell.fill=core_lattice

    core = openmc.Universe(cells=[core_cell,vessel,water_fill])
    assembly = openmc.Geometry(core) 
    assembly.export_to_xml()

```

---

<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:** [March 29, 2024, 5:24pm UTC](https://openmc.discourse.group/t/reflective-boundary-issues/4099/4 "2024-03-29T17:24:35Z")

</div>

Hi @Daedalus! Thanks for the extra info. Very helpful!

From what I can tell, it looks like you’re applying a reflecting boundary condition at the pin cell level on the `water_rect` surface. If the lattice cells are closer than the reflective boundary of the pincell, then particles will cross into the adjacent lattice cell without seeing that boundary and it won’t have any effect.

More generally though, this isn’t how I’d recommend applying a reflecting boundary condition in a full core model. You’ll want to apply boundary conditions to the surfaces of the region for the core cell (`core_region`) instead for them to impact the model as a whole. I don’t see that variable set in the code you provided though. Is it set somewhere else?

-Patrick

---

<div class="post-metadata">

**Author:** ![Daedalus](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/daedalus/32/2928_2.png) [@Daedalus](https://openmc.discourse.group/u/Daedalus)\
**Post date:** [March 29, 2024, 7:39pm UTC](https://openmc.discourse.group/t/reflective-boundary-issues/4099/5 "2024-03-29T19:39:57Z")

</div>

My model geometry is designed to be fluid because it is being used in an optimization program. In this case n=1 so there is only 1 fuel pin in the geometry that I am trying to apply reflective conditions to. num\_segs specifies the # of axial fuel segmentations, which I have set to 1 for this test as well. x[2] is lattice pitch, so the pin cell boundaries shouldn’t be crossing over into the neighboring lattice.

 ![plot_5](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/0/0d97a3f160d4336e7ab34e018359df58b6141fa2.png)

---

<div class="post-metadata">

**Author:** ![Daedalus](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/daedalus/32/2928_2.png) [@Daedalus](https://openmc.discourse.group/u/Daedalus)\
**Post date:** [March 29, 2024, 7:42pm UTC](https://openmc.discourse.group/t/reflective-boundary-issues/4099/6 "2024-03-29T19:42:46Z")

</div>

Yes, applying the reflective conditions to the core\_north (ect) bounding box fixed the problem.
