How to calculate the neutron flux of each lattiece universe (corresponding cell)

Hello! I’m a new openmc scholar.
I use lattiece to build 3D models, but I need to calculate the neutron flux of each lattiece universe (corresponding cell)
Like mcnp’s input card:
99999 0 -52 51 -62 61 -72 71 u=99999 lat=1 fill=0:35 0:35 0:35

100000 0 -53 51 -63 61 -73 71 fill=99999

F14:n (99999 < 99999[0:35 0:35 0:35] < 100000)

Such as:
I use lattiece to build 3D models:

# 
cell1001 = openmc.Cell(cell_id=1001,fill =m6,region= -sphere100) 
cell2001 = openmc.Cell(cell_id=2001,fill =m4,region= -sphere100) 
cell3001 = openmc.Cell(cell_id=3001,fill =m5,region= -sphere100) 

# universe 
u1001 = openmc.Universe()
u1001.add_cell(cell1001)
u2001 = openmc.Universe()
u2001.add_cell(cell2001)
u3001 = openmc.Universe()
u3001.add_cell(cell3001)

# 36*36*36
target_shape=(36,36,36)
array_water = np.zeros(target_shape, dtype=object)
array_water  = np.transpose(array_water , (2, 1, 0))
array_water[:] = u2001
array_water[0,:,:] = u1001
array_water[:,0,:] = u2001
array_water[...,0] = u3001

lat3d = openmc.RectLattice(name='Head univ') #
lat3d.pitch = (space_x, space_y, space_z) 
lat3d.lower_left = (-5, -5, 3.5)
lat3d.universes=array_water

thanks very much !

I use CellInstanceFilter to do that:

cell_instances = ([lat3d])
cell_instances = [(lat3d, i) for i in range(0, 36*36*36, 1)]
cellinst_filter = openmc.CellInstanceFilter(cell_instances,filter_id =1)

particle_filter = openmc.ParticleFilter(['neutron']) 
energy_filter = openmc.EnergyFilter([ 0, 0.5,10E+03,10E+06])

# Instantiate flux tally Filter
flux_cell_tally = openmc.Tally(name="neutron_flux_on_mesh")
multiplier = openmc.EnergyFunctionFilter([0.0, 2e7], [1/C100, 1/C100])
flux_cell_tally.filters = [cellinst_filter, particle_filter,energy_filter,multiplier]
f
![image|690x278](upload://buTecpFhH9jvaTlEiDHoM9fAOIx.png)
lux_cell_tally.scores = ['flux']

But


What am I supposed to do?

For CellInstanceFilter, you need to give it tuples of (cell, index). So for example, you could use cell1001 or cell2001, but not lat3d which is a RectLattice object. If you are not looking for a specific cell within each lattice element but rather a score for the entirety of each lattice element, you could use a MeshFilter with a mesh that lines up with the rectangular lattice.

@ paulromano thank you very much! Because the cell needs to be rotated at a certain Angle, if the MeshFilter is used, part of the cell is not tally。May I ask, is there a good way to tally each Universe of lattiece(cell of lattiece)?Can the mesh be rotated?

I recommend using the distribcell filter to score each individual lattice element

https://docs.openmc.org/en/stable/pythonapi/generated/openmc.DistribcellFilter.html

https://docs.openmc.org/en/latest/io_formats/tallies.html#filter-element

Unfortunately the answer to both of these at present is no.

thank you very much! I’ll try it your way。

:sweat_smile: thank you very much!Can I ask you something about the rotation,About lattiece rotation?