# Modelling a hexagonal pin-cell of fast reactor

**URL:** <https://openmc.discourse.group/t/modelling-a-hexagonal-pin-cell-of-fast-reactor/3923>\
**Category:** User Support\
**Created:** [February 17, 2024, 3:27pm UTC](https://openmc.discourse.group/t/modelling-a-hexagonal-pin-cell-of-fast-reactor/3923 "2024-02-17T15:27:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramzy1990](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@Ramzy1990](https://openmc.discourse.group/u/Ramzy1990)\
**Post date:** [February 17, 2024, 3:27pm UTC](https://openmc.discourse.group/t/modelling-a-hexagonal-pin-cell-of-fast-reactor/3923/1 "2024-02-17T15:27:59Z")

</div>

Hi all,

I am modelling a pin-cell similar to the one here:

> **Pin cell plot, Serpent**
>
> ![Serpent](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/e/e81af4f95715eb51ac6c0686a48afb632b5c2a9e.png)

The problem I have is a very big discrepancy between the OpenMC model and a Serpent model.  
The Serpent model has the following geometry:

> **Geometry Built in Serpent**
>
> > pin unit  
> > gap 0.100  
> > fuel 0.450  
> > gap 0.465  
> > clad 0.525  
> > lead
> > 
> > % Pin pitch is 1.35975  
> > surf 1 hexyc 0.0 0.0 0.679875  
> > surf 2 sqc 0.0 0.0 1.5
> > 
> > ```
> > %%%%%%%%%%%%%%%%
> > % ------- Cells
> > %%%%%%%%%%%%%%%%
> > 
> > ```
> > 
> > cell 1 0 fill unit -1  
> > cell 2 0 gap 1 -2  
> > cell 3 0 outside 2 % outside world

Now I am new to OpenMC. I modelled this geometry like so in OpenMC:

> **Geometry Built in OpenMC**
>
> ```auto
> # Create cylinders for the gap, fuel, and clad
> 
> gap_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=0.100)
> fuel_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=0.450)
> gap2_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=0.465)
> clad_radius = openmc.ZCylinder(x0=0.0, y0=0.0, r=0.525)
> 
> # Create a hexagonal to surround the pin
> hexagonal = openmc.model.HexagonalPrism(0.679875, orientation='x')
> 
> # Create box to surround the geometry
> box = openmc.model.RectangularPrism(3.0, 3.0, boundary_type='reflective')
> 
> # Create a Universe to encapsulate a pin-cell
> pin_cell_universe = openmc.Universe(name='pin_cell')
> 
> # Create different Cells and add them to the universe
> #gap
> gap_cell = openmc.Cell(name='GAP')
> gap_cell.fill = gap
> gap_cell.region = -gap_radius
> pin_cell_universe.add_cell(gap_cell)
> 
> #fuel
> fuel_cell = openmc.Cell(name='FUEL')
> fuel_cell.fill = fuel
> fuel_cell.region = -fuel_radius & +gap_radius
> pin_cell_universe.add_cell(fuel_cell)
> 
> #gap2
> gap2_cell = openmc.Cell(name='GAP2')
> gap2_cell.fill = gap
> gap2_cell.region = -gap2_radius & +fuel_radius
> pin_cell_universe.add_cell(gap2_cell)
> 
> #clad
> clad_cell = openmc.Cell(name='CLAD')
> clad_cell.fill = clad
> clad_cell.region = -clad_radius & +gap2_radius
> pin_cell_universe.add_cell(clad_cell)
> 
> #lead
> lead_cell = openmc.Cell(name='LEAD')
> lead_cell.fill = lead
> lead_cell.region = -hexagonal & +clad_radius
> pin_cell_universe.add_cell(lead_cell)
> 
> #gap3
> gap3_cell = openmc.Cell(name='GAP3')
> gap3_cell.fill = gap
> gap3_cell.region = +hexagonal & -box
> pin_cell_universe.add_cell(gap3_cell)
> 
> # Create Geometry and set root Universe
> model.geometry = openmc.Geometry(pin_cell_universe)
> 
> ```

And noting that one can have better ways of doing it in OpenMC of course (or maybe even correct, I am not sure if this is correct).

Here is the geometry part of the model file. I am not sure about the hexagonal prism individual 6 planes are in the correct locations? seems like extensive use of `sqrt(3)` is being applied. This could be the problem I guess?

> **Model.xml geometry settings**
>
> ```auto
> <geometry>
> <cell id="1" material="4" name="GAP" region="-1" universe="1"/>
> <cell id="2" material="3" name="FUEL" region="-2 1" universe="1"/>
> <cell id="3" material="4" name="GAP2" region="-3 2" universe="1"/>
> <cell id="4" material="5" name="CLAD" region="-4 3" universe="1"/>
> <cell id="5" material="6" name="LEAD" region="-5 6 -7 -10 8 9 4" universe="1"/>
> <cell id="6" material="4" name="GAP3" region="~(-5 6 -7 -10 8 9) (11 -12 13 -14)" universe="1"/>
> <surface coeffs="0.0 0.0 0.1" id="1" type="z-cylinder"/>
> <surface coeffs="0.0 0.0 0.45" id="2" type="z-cylinder"/>
> <surface coeffs="0.0 0.0 0.465" id="3" type="z-cylinder"/>
> <surface coeffs="0.0 0.0 0.525" id="4" type="z-cylinder"/>
> <surface coeffs="0.5887890213979452" id="5" type="y-plane"/>
> <surface coeffs="-0.5887890213979452" id="6" type="y-plane"/>
> <surface coeffs="1.7320508075688772 1.0 0.0 1.1775780427958904" id="7" type="plane"/>
> <surface coeffs="-1.7320508075688772 1.0 0.0 -1.1775780427958904" id="8" type="plane"/>
> <surface coeffs="1.7320508075688772 1.0 0.0 -1.1775780427958904" id="9" type="plane"/>
> <surface coeffs="-1.7320508075688772 1.0 0.0 1.1775780427958904" id="10" type="plane"/>
> <surface boundary="reflective" coeffs="-1.5" id="11" name="minimum x" type="x-plane"/>
> <surface boundary="reflective" coeffs="1.5" id="12" name="maximum x" type="x-plane"/>
> <surface boundary="reflective" coeffs="-1.5" id="13" name="minimum y" type="y-plane"/>
> <surface boundary="reflective" coeffs="1.5" id="14" name="maximum y" type="y-plane"/>
> </geometry>
> 
> ```

I plotted the configuration for verification, and here is what I get using:

```auto
 plot = openmc.Plot()
 plot.color_by = 'material'
 plot.basis = 'xy'
 plot.origin = (0.0, 0.0, 0.0)
 plot.width = (3., 3.)
 plot.pixels = (400, 400)
 plot.colors = {
    gap: 'grey',
    fuel: 'red',
    clad: 'black',
    lead: 'blue'
}

```

The plot will be displayed in the next reply as discord does not allow new users to embed more than one media item in a post.

The discrepancy is very big:  
Serpent: 1.35712 +/- 0.00020  
OpenMC: 1.41382 +/- 0.00135

- I verified the materials between the two codes many times, so I think it is the geometry and how I am doing it in OpenMC.

- Inspecting the Serpent geometry, the `sqc` is 1.5 which is 1/2 the width of the square prism. I used 3 in the OpenMC geometry.

- Same for the hexagonal prism, Serpent accepts half the pitch (or the long side), while OpenMC [accepts the hexagonal side](https://docs.openmc.org/en/stable/pythonapi/generated/openmc.model.HexagonalPrism.html) (which is 1/2 the long side or the pitch for equilateral).

- Orientation is also different between Serpent and OpenMC, I think I took this into account as well (cf. Figures).

- I also tried using transmission BC on the hexagonal prism in OpenMC, but I think it is already applied by default (and does not make sense of course, but I was just trying).

Thank you,

---

<div class="post-metadata">

**Author:** ![Ramzy1990](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@Ramzy1990](https://openmc.discourse.group/u/Ramzy1990)\
**Post date:** [February 17, 2024, 3:28pm UTC](https://openmc.discourse.group/t/modelling-a-hexagonal-pin-cell-of-fast-reactor/3923/2 "2024-02-17T15:28:31Z")

</div>

> **Pin cell plot, OpenMC**
>
> ![image](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/f/f82b8d409d63a2f26a78339ab37d166e6c52cb24.png)

---

<div class="post-metadata">

**Author:** ![Ramzy1990](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@Ramzy1990](https://openmc.discourse.group/u/Ramzy1990)\
**Post date:** [February 17, 2024, 4:49pm UTC](https://openmc.discourse.group/t/modelling-a-hexagonal-pin-cell-of-fast-reactor/3923/3 "2024-02-17T16:49:03Z")

</div>

Right, it is the definition of the side length that made the problem. It should be 0.7851, which is `2/sqrt(3)` \* 0.679875. I just basically computed the side length wrong! Here in this part:

> - Same for the hexagonal prism, Serpent accepts half the pitch (or the long side), while OpenMC [accepts the hexagonal side](https://docs.openmc.org/en/stable/pythonapi/generated/openmc.model.HexagonalPrism.html) (which is 1/2 the long side or the pitch for equilateral).

the side is actually not 1/2 of the pitch but `sqrt(3)` of it.
