# Weight Windows for Neutrons and Photons

**URL:** <https://openmc.discourse.group/t/weight-windows-for-neutrons-and-photons/2583>\
**Category:** User Support\
**Created:** [December 22, 2022, 12:16pm UTC](https://openmc.discourse.group/t/weight-windows-for-neutrons-and-photons/2583 "2022-12-22T12:16:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kimberly](https://avatars.discourse-cdn.com/v4/letter/k/f4b2a3/32.png) [@Kimberly](https://openmc.discourse.group/u/Kimberly)\
**Post date:** [December 22, 2022, 12:16pm UTC](https://openmc.discourse.group/t/weight-windows-for-neutrons-and-photons/2583/1 "2022-12-22T12:16:50Z")

</div>

Hi there, I am trying to make a shielding calculation. Similar to the example shown later, I have used weight window successfully when I transport only neutrons. But when I try to make a coupled neutron-photon transport simulation, I don’t know how to use weight windows for both neutrons and photons.

[weight windows example](https://github.com/fusion-energy/neutronics-workshop/tree/main/tasks/task_13_variance_reduction):

```auto
……
ww = openmc.WeightWindows(
    mesh=my_ww_mesh,
    upper_ww_bounds=upper_ww_bounds,
    lower_ww_bounds=lower_ww_bounds,
    particle_type='neutron',
    energy_bins=(0.0, 100_000_000.),  
    survival_ratio=5
)
sett = openmc.Settings()
……
sett.weight_windows = ww

```

Any help regarding this topic would be very appreciated.

Kimberly

---

<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:** [December 22, 2022, 12:55pm UTC](https://openmc.discourse.group/t/weight-windows-for-neutrons-and-photons/2583/2 "2022-12-22T12:55:40Z")

</div>

Thanks for posting and great to see the examples in the [neutronics-workshop](https://github.com/fusion-energy/neutronics-workshop) are useful 😄

The `WeightWindows` class has a `particle` attribute which defaults to `'neutron'` which it looks like you have found.

This attribute can also be set to `photon` but it can only accept one or the other.

So I would think you want two weight windows. One for photons and one for neutrons.

`model.settings.weight_windows` attribute accepts an iterate (list) of weight windows so then you can apply both to you model. You would want different values in each weight window but here is some pseudo code

```auto
neutron_ww = openmc.WeightWindows(
    mesh=my_ww_mesh,
    upper_ww_bounds=upper_ww_bounds,
    lower_ww_bounds=lower_ww_bounds,
    particle_type='neutron',
    energy_bins=(0.0, 100_000_000.),  
    survival_ratio=5
)

photon_ww = openmc.WeightWindows(
    mesh=my_ww_mesh,
    upper_ww_bounds=upper_ww_bounds_2,
    lower_ww_bounds=lower_ww_bounds_2,
    particle_type='photon',
    energy_bins=(0.0, 100_000_000.),  
    survival_ratio=5
)

my_settings = openmc.Settings()
my_settings.weight_windows = [neutron_ww, photon_ww]

```

---

<div class="post-metadata">

**Author:** ![Kimberly](https://avatars.discourse-cdn.com/v4/letter/k/f4b2a3/32.png) [@Kimberly](https://openmc.discourse.group/u/Kimberly)\
**Post date:** [December 22, 2022, 1:32pm UTC](https://openmc.discourse.group/t/weight-windows-for-neutrons-and-photons/2583/3 "2022-12-22T13:32:48Z")

</div>

Thanks @Shimwell for your reply! I will have a look through this and seems like it should work for my simulation.
