Error when plot reflector

I got an error when I tried coding the reflector on fully up it said the value on ring 0 should be 30 elements but I have entered the reflector value correctly on fully up. what’s the solution?

this is my program reflector

Reflector assemblies

ref_lat = openmc.HexLattice(lattice_id=103, name=‘reflector assembly’)
ref_lat.center = (0., 0.)
ref_lat.pitch = (20.9889 / 11,)
ref_lat.orientation = ‘x’
ref_lat.outer = sodium_mod_u
ref4 = [ref_u] * 96
ref5 = [ref_u] * 90
ref6 = [ref_u] * 84
ref7 = [ref_u] * 22
ref8 = [ref_u] * 6
ref9 = [ref_u] * 1
ref_lat.universes = [ref4, ref5, ref6, ref7, ref8, ref9]

outer_ref_surface = openmc.model.hexagonal_prism(edge_length=9.3803, orientation=‘x’)
main_ref_assembly = openmc.Cell(cell_id=51, fill=ref_lat, region=-top & +bottom)
out_ref_assembly = openmc.Cell(cell_id=52, fill=sodium, region=~outer_ref_surface & -top & +bottom)
main_ref_u = openmc.Universe(universe_id=11, cells=[main_ref_assembly, ])

Core lattice

core_lat = openmc.HexLattice(lattice_id=106, name=‘core’)
core_lat.center = (0., 0.)
duct_thickness = 0.4525
subassembly_duct = 20.9889
pitch = subassembly_duct - (2 * duct_thickness)
core_lat.orientation = ‘y’
core_lat.pitch = (pitch,)
core_lat.outer = sodium_mod_u

Fully up

out_zero = 2 * [sodium_mod_u] + [main_ref_u] * 50 + [3 * [sodium_mod_u]] * 5 + [main_ref_u] * 28 + [sodium_mod_u]
out_one = [main_ref_u] * 45 + [main_ref_u] * 45
out_two = [main_ref_u] * 84
out_three = [main_ref_u] * 22
out_four = [main_ref_u] * 6

in_zero = [main_ref_u] * 3 + [main_out_u] * 33 + [main_out_u] * 33 + [main_ref_u] * 3
in_one = [main_ref_u] + [main_out_u] * 65
in_two = [main_in_u] * 22 + [main_out_u] * 8 + [main_in_u] * 22 + [main_out_u] * 8
in_three = ([main_in_u] * 2 + [main_in_u] * 2) * 26
in_four = [main_in_u] * 48
in_five = [main_in_u] * 7 + [main_in_u] * 7 + [main_in_u] * 7 + [main_in_u] * 7 + [main_in_u] * 7 + [main_in_u] * 7
in_six = [main_in_u] * 6 + [main_in_u] * 12 + [main_in_u] * 18
in_seven = [main_in_u] * 30
in_eight = [main_in_u] * 8 + [main_in_u] * 8 + [main_in_u] * 8
in_nine = [main_in_u] * 18
in_ten = [main_in_u] * 4 + + [main_in_u] * 4 + [main_in_u] * 4
in_eleven = [main_in_u] * 6
in_twelve = [main_in_u] * 1
core_lat.universes = [out_zero,out_one,out_two,out_three,in_one,in_two,in_three,in_four,in_five,in_six,in_seven,in_eight,in_nine,in_ten,in_eleven,in_twelve]

Hi @Darilhana1;

according to the error message and what I saw in your hexagonal lattice, the rings should be made from a multiple of 6 (except for the central one with only 1 fuel rods):
1, 6=6x1, 12=6x2, 18=6x3, 24=6x4, 30=6x5 and so on, thus the multiplication factors you did use here are not correct and I think that you should reconsider them.

thank you salah, but my code still has an error when I input it in multiples of 6. can you help check where the error is, because I’m already stuck here.

my coding
#reflector assemblies
ref_lat = openmc.HexLattice(lattice_id=103, name=‘reflector assembly’)
ref_lat.center = (0., 0.)
ref_lat.pitch = (20.9889/17,)
ref_lat.orientation = ‘x’
ref_lat.outer = sodium_mod_u
ref1 = [ref_u]*96
ref2 = [ref_u]*90
ref3 = [ref_u]*84
ref4 = [ref_u]*78
ref5 = [ref_u]*72
ref6 = [ref_u]*66
ref7 = [ref_u]*60
ref8 = [ref_u]*54
ref9 = [ref_u]*48
ref10 = [ref_u]*42
ref11 = [ref_u]*36
ref12 = [ref_u]*30
ref13 = [ref_u]*24
ref14 = [ref_u]*18
ref15 = [ref_u]*12
ref16 = [ref_u]*6
ref17 = [ref_u]*1

ref_lat.universes = [ref1,ref2,ref3,ref4,ref5,ref6,ref7,ref8,ref9,ref10,ref11,ref12,ref13,ref14,ref15,ref16,ref17]
outer_ref_surface = openmc.model.hexagonal_prism(edge_length=9.3803, orientation=‘x’)
main_ref_assembly = openmc.Cell(cell_id=51, fill=ref_lat, region= -top & +bottom)
out_ref_assembly = openmc.Cell(cell_id=52, fill=sodium, region=~outer_ref_surface & -top & +bottom)
main_ref_u = openmc.Universe(universe_id=11, cells=[main_ref_assembly, ])

#core lattice
core_lat = openmc.HexLattice(lattice_id=106, name=‘core’)
core_lat.center = (0., 0.)
duct_thickness = 0.4525 #subassembly duct wall thickness
subassembly_duct = 20.9889
pitch = subassembly_duct - (2*duct_thickness)
core_lat.orientation = ‘y’
core_lat.pitch = (pitch,)
core_lat.outer = sodium_mod_u

#fully up
out_zero = 2*[sodium_mod_u] + 3*([sodium_mod_u])*5 + [sodium_mod_u]
out_one = [main_ref_u]*48 + [main_ref_u]*48
out_two = [main_ref_u]*90
out_three = [main_ref_u]*84
out_four = [main_ref_u]*54 + [main_out_u]*24
in_zero = [main_ref_u]*6 + [main_out_u]*66
in_one = [main_out_u]*66
in_two = [main_in_u]*6 + [main_out_u]*54
in_three = [main_in_u]*36 + [main_out_u]*18
in_four = [main_in_u]*48
in_five = [main_in_u]*7 + [main_in_u]*7 + [main_in_u]*7 + [main_in_u]*7 + [main_in_u]*7 + [main_in_u]*7
in_six = [main_in_u]*6 + [main_in_u]*12 + [main_in_u]*18
in_seven = [main_in_u]*30
in_eight = [main_in_u]*8 + [main_in_u]*8 + [main_in_u]*8
in_nine = [main_in_u]*18
in_ten = [main_in_u]*4 + [main_in_u]*4 + [main_in_u]*4
in_eleven = [main_in_u]*6
in_twelve = [main_ref_u]*1
core_lat.universes = [out_zero,out_one,out_two,out_three,in_one,in_two,in_three,in_four,in_five,in_six,in_seven,in_eight,in_nine,in_ten,in_eleven,in_twelve]

my error
Traceback (most recent call last):
File “/home/acer/Documents/4 juli/4juli.py”, line 666, in
core_lat.universes = [out_zero,out_one,out_two,out_three,in_one,in_two,in_three,in_four,in_five,in_six,in_seven,in_eight,in_nine,in_ten,in_eleven,in_twelve]
^^^^^^^^^^^^^^^^^^
File “/home/acer/miniconda3/envs/openmc-env/lib/python3.11/site-packages/openmc/lattice.py”, line 1265, in universes
raise ValueError(msg)
ValueError: HexLattice ID=106 has the wrong number of elements in ring number 0 (counting from the outermost ring). This ring should have 90 elements.

I hope to resolve this error…

hi @Darilhana1
The problem is in the core hexalattice universe definition:
core_lat.universes = [out_zero,out_one,out_two,out_three,in_one,in_two,in_three,in_four,in_five,in_six,in_seven,in_eight,in_nine,in_ten,in_eleven,in_twelve]
there are two rings missing from your hexagonal lattice:
in_zero and out_four
so, it should be like this:
core_lat.universes = [out_zero,out_one,out_two,out_three, ““out_four ,in_zero””", in_one,in_two,in_three,in_four,in_five,in_six,in_seven,in_eight,in_nine,in_ten,in_eleven,in_twelve]

thankyou salah, but my code still error. is there some other error that i didn’t detect?

I’m sorry but I forgot to mention also the following line, the outermost ring (outer_zero) should be 102 element and you are using only 18 ones

thankyou salah, but my outermost ring already 102 elements but still error. I have also removed the reflector and only input 102 elements of sodium but still have an error. can you help me?

my code

#fully up
out_zero = 2 * [sodium_mod_u] + [main_ref_u] * 50 + [3 * [sodium_mod_u]] * 5 + [main_ref_u] * 34 + [sodium_mod_u]
out_one = [main_ref_u] * 45 + [main_ref_u] * 45
out_two = [main_ref_u] * 84
out_three = [main_ref_u] * 22
out_four = [main_ref_u] * 6

in_zero = [main_ref_u] * 3 + [main_out_u] * 33 + [main_out_u] * 33 + [main_ref_u] * 3
in_one = [main_ref_u] + [main_out_u] * 65
in_two = [main_in_u] * 22 + [main_out_u] * 8 + [main_in_u] * 22 + [main_out_u] * 8
in_three = ([main_in_u] * 2 + [main_in_u] * 2) * 26
in_four = [main_in_u] * 48
in_five = [main_in_u] * 7 + [main_in_u] * 7 + [main_in_u] * 7 + [main_in_u] * 7 + [main_in_u] * 7 + [main_in_u] * 7
in_six = [main_in_u] * 6 + [main_in_u] * 12 + [main_in_u] * 18
in_seven = 5*([main_in_u] * 6)
in_eight = 4*([main_in_u] * 6)
in_nine = 3*([main_in_u] * 6)
in_ten = 2*([main_in_u] * 6)
in_eleven = [main_in_u] * 6
in_twelve = [main_in_u] * 1
core_lat.universes = [out_zero,out_one,out_two,out_three,out_four,in_zero,in_one, in_two,in_three,in_four,in_five,in_six,in_seven,in_eight,in_nine,in_ten,in_eleven,in_twelve]

hi @Darilhana1 ;

I think that there is always a persisting error in the definition of the hexagonal lattice…mainly since out_four, out_three, …they should follow the numbering 6 x n

Blockquote
out_zero = 2 * [sodium_mod_u] + [main_ref_u] * 50 + [3 * [sodium_mod_u]] * 5 + [main_ref_u] * 34 + [sodium_mod_u]
out_one = [main_ref_u] * 45 + [main_ref_u] * 45 <<<<< here
out_two = [main_ref_u] * 84 <<<<<< here
out_three = [main_ref_u] * 22 <<<<<<< here
out_four = [main_ref_u] * 6 <<<<<< here
in_zero = [main_ref_u] * 3 + [main_out_u] * 33 + [main_out_u] * 33 + [main_ref_u] * 3