Hexagonal assembly

Hello Team,

I’m working on the final core assembly for CEFR and need to rotate a hexagonal sub-assembly by 90 degrees. I’ve written the following OpenMC code to create the sub-assembly, but need assistance with the rotation aspect:
import openmc

angle_deg = 30.0
angle_rad = np.radians(angle_deg)

Reflector_B_radius = openmc.ZCylinder(r=1.0)
Reflector_S_radius = openmc.ZCylinder(r=1.0)

Reflector_B_region = -Reflector_B_radius
Reflector_S_region = -Reflector_S_radius
sodium_region1 = +Reflector_B_radius
sodium_region2 = +Reflector_S_radius
Reflector_B = openmc.Cell(region=Reflector_B_region, fill=b4c_natural)
Reflector_S = openmc.Cell(region=Reflector_S_region, fill=b4c_natural)
sodium_cell1 = openmc.Cell(region=sodium_region1, fill=sodium)
sodium_cell2 = openmc.Cell(region=sodium_region2, fill=sodium)

pin_Reflector_B_universe = openmc.Universe()
pin_Reflector_B_universe.add_cells([Reflector_B, sodium_cell1])

pin_Reflector_S_universe = openmc.Universe()
pin_Reflector_S_universe.add_cells([Reflector_S, sodium_cell2])

pin_Reflector_B_universe.plot(width=(3.0, 3.0))
pin_Reflector_S_universe.plot(width=(3.0, 3.0))

hexlattice_Reflector = openmc.HexLattice()
hexlattice_Reflector.center = (0.0, 0.0)
#hexlatticeB4.pitch = [0.775]
hexlattice_Reflector.pitch = [2.07]

inf_sodium_cell = openmc.Cell(fill=sodium)
inf_sodium = openmc.Universe(cells=[inf_sodium_cell])
hexlattice_Reflector.outer = inf_sodium
print(hexlattice_Reflector.show_indices(num_rings=2))

lat_universes_Reflector = [
[pin_Reflector_B_universe] * 6, # Ring 1 : 6 pins autour
[pin_Reflector_S_universe] # Ring 0 : 1 pin central
]
hexlattice_Reflector.universes = lat_universes_Reflector

inner_ductB4 = openmc.model.hexagonal_prism(edge_length=5.66/np.sqrt(3), orientation=‘y’)
outer_ductB4 = openmc.model.hexagonal_prism(edge_length=5.9/np.sqrt(3), orientation=‘y’)
#inner_ductB4 = openmc.model.hexagonal_prism(edge_length=2.83, orientation=‘y’)
#outer_ductB4 = openmc.model.hexagonal_prism(edge_length=2.95, orientation=‘y’)
assembly_boundaryB4 = openmc.model.hexagonal_prism(edge_length=3.5, orientation=‘y’, boundary_type=‘reflective’)

lattice_cellB4 = openmc.Cell(region=inner_ductB4, fill=hexlattice_Reflector)
duct_cellB4 = openmc.Cell(region= ~inner_ductB4 & outer_ductB4, fill=stainless_steel)
outer_cellB4 = openmc.Cell(region= ~outer_ductB4 & assembly_boundaryB4, fill=sodium)
shielding = openmc.Universe(cells=[lattice_cellB4, duct_cellB4, outer_cellB4])

2eme print

shielding.plot(width=(8.0, 8.0), pixels=(300, 300), color_by=‘material’, colors=mat_colors, legend=True)

Create an assembly universe as normally you would do, Then declare another cell → fill that cell with universe → then use the rotation attribute for that cell.

assembly_cell = openmc.Cell ( fill = assembly_universe)
assembly_cell.rotation = (0, 0, 90)

1 Like

FYI I had the same strugle here. Try to check previous posts for duplicate issues Hexagonal prism aligned to z-axis

1 Like