# Neutron flux in a graphite stack

**URL:** <https://openmc.discourse.group/t/neutron-flux-in-a-graphite-stack/3916>\
**Category:** User Support\
**Created:** [February 15, 2024, 4:12pm UTC](https://openmc.discourse.group/t/neutron-flux-in-a-graphite-stack/3916 "2024-02-15T16:12:48Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![NHale](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@NHale](https://openmc.discourse.group/u/NHale)\
**Post date:** [February 29, 2024, 11:37pm UTC](https://openmc.discourse.group/t/neutron-flux-in-a-graphite-stack/3916/21 "2024-02-29T23:37:41Z")

</div>

Seems to be working now, thank you for helping

---

<div class="post-metadata">

**Author:** ![NHale](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@NHale](https://openmc.discourse.group/u/NHale)\
**Post date:** [March 1, 2024, 12:05am UTC](https://openmc.discourse.group/t/neutron-flux-in-a-graphite-stack/3916/22 "2024-03-01T00:05:00Z")

</div>

Wanted to ask about the differences between uses matplotlib vs your openmc-mesh-plotter

![graphite flux mesh_plotter Thermal Neutrons](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/3/32a96b2bd7e658e1987a323d5b0b1e7f6a6e98f8.png)  
 ![graphite flux log mesh_plotter Thermal Neutrons](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/c/cbb8d41cd751299813129e9a05aec07444fb13db.png)  
Above is using mesh\_plotter

![graphite flux log Thermal Neutrons matplotlib](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/7/76bda94d95f47c4b6e9f784f879df7b213b66417.png)  
 ![graphite flux Thermal Neutrons matplotlib](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/d/dc50ac4023fd0384cbcc5e9002ffacc684a37572.png)  
Above is matplotlib

Not sure how to interpret the differences between these two, maybe to do with my having resize my slice array for the pyplot?

---

<div class="post-metadata">

**Author:** ![Shimwell](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shimwell/32/3876_2.png) [@Shimwell](https://openmc.discourse.group/u/Shimwell)\
**Post date:** [March 1, 2024, 7:46am UTC](https://openmc.discourse.group/t/neutron-flux-in-a-graphite-stack/3916/23 "2024-03-01T07:46:09Z")

</div>

The plotter does use matplotlib behind the scenes so you should be able to look at the source code and slice, reshape etc in the same way with matplotlib. I plan to add plotly functionality at some point

---

<div class="post-metadata">

**Author:** ![NHale](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@NHale](https://openmc.discourse.group/u/NHale)\
**Post date:** [March 2, 2024, 11:01pm UTC](https://openmc.discourse.group/t/neutron-flux-in-a-graphite-stack/3916/24 "2024-03-02T23:01:10Z")

</div>

I figured out why my matplotlib direct plots looks weird was that I was resizing the data to a mesh dimension that it already was.

What I don’t understand is why my plots seem completely incorrect when using matplotlib directly. Your regular mesh plotter package gives accurately that the thermal neutron flux for my geometry but through how I plot it manually through matplotlib it seems to be upside down? I know that your mesh plotting package takes into account the geometry of the model so I wonder if it’s something to do with that.  
 ![image](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/5/570adfdbbfd4c8779363173bc1f87dd254298bb0.png)

Thank you again for all the help so far

matplotlib code snippet

```auto
    my_slice = my_tally.get_slice(scores=['flux']) # don't need to resize, resolution is the same
    plt.figure(1)
    plt.imshow(my_slice.mean, extent=mesh.bounding_box.extent['xz'], norm=colors.LogNorm())
    plt.xlabel('x [cm]')
    plt.ylabel('z [cm]')
    plt.title(f'Flux in {material_choice} (log scale) - {energy}')
    plt.savefig(f'{material_choice} flux log {energy} matplotlib.png')
    plt.figure(2)
    plt.imshow(my_slice.mean, extent=mesh.bounding_box.extent['xz'])
    plt.xlabel('x [cm]')
    plt.ylabel('z [cm]')
    plt.title(f'Flux in {material_choice} - {energy}')
    plt.savefig(f'{material_choice} flux {energy} matplotlib.png')

```

[Previous page](https://openmc.discourse.group/t/neutron-flux-in-a-graphite-stack/3916.md?page=1)
