# Hexagonal prism aligned to z-axis

**URL:** <https://openmc.discourse.group/t/hexagonal-prism-aligned-to-z-axis/4808>\
**Category:** User Support\
**Created:** [September 17, 2024, 10:18pm UTC](https://openmc.discourse.group/t/hexagonal-prism-aligned-to-z-axis/4808 "2024-09-17T22:18:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ligross](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/ligross/32/1653_2.png) [@ligross](https://openmc.discourse.group/u/ligross)\
**Post date:** [September 17, 2024, 10:18pm UTC](https://openmc.discourse.group/t/hexagonal-prism-aligned-to-z-axis/4808/1 "2024-09-17T22:18:09Z")

</div>

I’m working on a model (that will eventually be used in a Cardinal multiphysics simulation) for a reactor with coolant that flows in the y-direction. According to the documentation for `HexagonalPrism`, orientation can only be `'x'` or `'y'`

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

It seems like for my picture, by definition of `orientation` in the docs, I’d want `orientation = 'z'`, but that isn’t an option. What is the recommendation here?

 ![assembly](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/7/7a17c2ed847abacbe9ee6db3f6f8b73690f8afc8.png)

---

<div class="post-metadata">

**Author:** ![ligross](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/ligross/32/1653_2.png) [@ligross](https://openmc.discourse.group/u/ligross)\
**Post date:** [September 24, 2024, 7:05pm UTC](https://openmc.discourse.group/t/hexagonal-prism-aligned-to-z-axis/4808/2 "2024-09-24T19:05:56Z")

</div>

I will answer my own question, in case others are wondering the same in the future.

The best way is to use one of the options available and then rotate the geometry to be in the desired reference frame. The key here is that **two** rotation calls are necessary. First, the region (intersection of hex cell and bounding z-planes) must be rotated via `openmc.Region.rotate()`. Then, the cell that contains the universe must be rotated by specifying `openmc.Cell.rotation` on the cell _after_ it is created. Here’s some code to show how I do this

```auto
    zplane_min = openmc.ZPlane(z0=z_min, boundary_type="vacuum")
    zplane_max = openmc.ZPlane(z0=z_max, boundary_type="vacuum")
    hex_boundary_region = openmc.model.HexagonalPrism(
        edge_length=lattice_flat_to_flat * f / math.sqrt(3),
        orientation="y"
    )
    region = -hex_boundary_region & +zplane_min & -zplane_max
    rotated_region = region.rotate((-90.0, 0.0, 0.0))
    core_cell = openmc.Cell(
        region=rotated_region,
        fill=core_lattice
    )
    core_cell.rotation = (-90.0, 0.0, 0.0)
    geometry = openmc.Geometry([core_cell])

```

(note the definition of `core_lattice` is not shown, but I used a `HexLattice`)

Important to note that `openmc.Cell.rotation` applies to the fill of the cell and doesn’t actually rotate the cell itself, which is why `openmc.Region.rotate()` must be used.
