Cylindrical mesh - plot neutron flux as a function of radius

All,

Just wanted some help in figuring out how to plot the neutron flux in my simulation as a function of the radius from my cylindrical mesh tally. Essentially, I want a line plot that shows the neutron flux as the radius increases on the x axis, and the expected result is obviously that the flux will decrease as the distance r increases.

I set up a cylindrical tally around my reactor with 49 r, phi, and z bins:

mesh_all = openmc.CylindricalMesh(
    r_grid= np.linspace(0, shielding_radius, 50),
    phi_grid= np.linspace(0.0, 2*np.pi, 50), 
    z_grid=np.linspace(-(shielding_height/2), (shielding_height/2), 50)
)
all_mesh_filter = openmc.MeshFilter(mesh_all)

And that gives me a pandas dataframe that looks something like this:

But I’m having trouble taking what I want to do and putting it in terms of code. First I’m confused on the x, y, z in the dataframe. Is that meant to be r, phi, and z?

In that case, could I:

  1. Sum all values of phi and z (y and z) for each x index,
  2. Divide by the volume of all the bins in each x index, and
  3. Plot the results?

If someone could provide a simple example which shows that, it would be much appreciated. I think I know what I want to do conceptually, but I need some guidance putting that in terms of tally arithmetic. Thanks in advance!

I was able to figure this out with some perseverance!

I’m attaching a JupyterLab notebook with some example code in case anyone has a similar goal and wants some guidance.

One thing that I changed in my methodology was to only use radial subdivisions in the cylindrical mesh (didn’t know this was possible) and not specify any phi or z subdivisions. That way I didn’t have to worry about summation of the phi and z bins.

RadialFlux.ipynb (40.5 KB)