Greetings,
I’ve encountered an issue while trying to assign universes to an array using np. functions.
the issue is as following:
I’ve defined universes and i want to create a lattice, therefore i used the following according to the openmc website manual;
lattice_arr.universes = np.empty ((m,1,1), dtype = openmc.Universe)
however, i got the error:
"Error setting lattice universes: items must be of type “UniverseBase”, but item at [0,0,0] is of type “NoneType”
could someone please guide me through this issue and how to solve it?
Hi Bushnag,
I think this example notebook about BWR fuel assembly modeling could help you understand how to assign universes
Here other examples
I am not a fan of using numpy to create a universe, but if you really want to use numpy to make your configuration, let’s say you have an openmc.Universe consists of a fuel rod and its surrounding water named FuelPinUniverse and you want it to form a 17×17 in the rectangular lattice, then I think .universes = np. tile(FuelPinUniverse, (17, 17))
should work.
Also if you want to recreate the example for 3D lattice from this section
https://docs.openmc.org/en/latest/usersguide/geometry.html?highlight=lat3D#rectangular-lattices
I think you can create a separate parameter with np.empty + dtype, and then use that parameter as input to your 3D lattice universes 3Dlat.ipynb (90.4 KB)
universe3D = np.empty((3, 3, 3), dtype=openmc.Universe)
universe3D[0, ...] = u
universe3D[1, ...] = q
universe3D[2, ...] = z
lat3d.universes = universe3D
1 Like
I’ll try them. Thank you!
unfortunately didn’t find what i’m looking for.
I need to define np.empty() with a data type that is accepted as the example shown in the OpenMC documents
lat3d.universes = np.empty((3, 3, 3), dtype=openmc.Universe)
lat3d.universes[0, …] = u
lat3d.universes[1, …] = q
lat3d.universes[2, …] = z
however i got the error mentioned above
@paulromano I would really appreciate the help in this matter