fusion-energy / neutronics-workshop

A workshop covering a range of fusion relevant analysis and simulations with OpenMC, DAGMC, Paramak and other open source fusion neutronics tools
MIT License
109 stars 49 forks source link

nuclear data threshold reaction energy plot #232

Open shimwell opened 11 months ago

shimwell commented 11 months ago

to help explain activation from DT neutrons at 14MeV vs activation from DD neutrons at 2.5MeV I could add a plotting script like this


import matplotlib.pyplot as plt
import openmc
from matplotlib.lines import Line2D

def plot_thresholds(nuclide="Fe56"):
    plt.clf()
    threshold_below_14 = 0
    threshold_below_2 = 0
    x = {}
    fe = openmc.data.IncidentNeutron.from_hdf5(
        # this dir would need changing to read the local nuclear data
        f"/home/jshimwell/ENDF-B-VIII.0-NNDC/h5_files/neutron/{nuclide}.h5"
    )
    for key, value in fe.reactions.items():
        reaction = fe[key]
        xs = reaction.xs["294K"]
        threshold = xs.x[0]
        name = reaction.__str__().split()[-1][:-1]
        if name not in ["heating", "damage-energy", "heating-local"]:
            # print(threshold/1e6, name)
            x[name] = threshold
            if threshold < 14.1e6:
                threshold_below_14 = threshold_below_14 + 1
                color = "blue"
                plt.plot(xs.x / 1e6, xs.y, label=name, color=color, linewidth=0.5)
            if threshold < 2.5e6:
                threshold_below_2 = threshold_below_2 + 1
                color = "red"
                plt.plot(xs.x / 1e6, xs.y, label=name, color=color, linewidth=0.5)
            print(key, name, threshold / 1e6)

    custom_lines = [
        Line2D([0], [0], color="red", lw=4),
        Line2D([0], [0], color="blue", lw=4),
    ]
    plt.legend(
        custom_lines,
        ["Reaction threshold < 2.5MeV", "Reaction threshold > 2.5 MeV and < 14 MeV"],
    )
    plt.title(
        f"Neutron reaction cross sections for {nuclide} colored by threshold energy.\n {threshold_below_2} reactions below 2.5MeV {threshold_below_14} reactions below 14.1MeV"
    )
    plt.yscale("log")
    plt.xlabel("Energy [MeV]")
    plt.ylabel("Cross sections [barns]")

    plt.xlim((0, 15))
    plt.ylim((1e-16, 1e10))
    plt.savefig(f"threshold_{nuclide}.png", dpi=200)

    # all the reactiosn sorted by energy
    all = dict(sorted(x.items(), key=lambda item: item[1]))

plot_thresholds(nuclide="Al27")
plot_thresholds(nuclide="Fe56")

threshold_Al27 threshold_Fe56

py1sl commented 10 months ago

I don't think you are plotting different reactions, i think you are plotting a few reactions (therefore a few activation products) and then lots of excitation levels. Not sure this helps the explanation.

shimwell commented 10 months ago

Thanks py1sl

I guess we could group the reactions that result in the same end activation product if that is more useful

We have a list of reactions that transmutation openmc source code that might come in handy.

https://github.com/openmc-dev/openmc/blob/eea52238dac0162a8b7924b81800af4a3c78798e/openmc/deplete/chain.py#L34-L119

py1sl commented 10 months ago

You might be able to filter on a keyword like the heating filter or use the Mt numbers. All the excited product levels are high Mt numbers think 300 + but check the endf docs

On Fri, 25 Aug 2023, 22:29 Jonathan Shimwell, @.***> wrote:

Thanks py1sl

I guess we could group the reactions that result in the same end activation product if that is more useful

We have a list of reactions that transmutation openmc source code that might come in handy.

https://github.com/openmc-dev/openmc/blob/eea52238dac0162a8b7924b81800af4a3c78798e/openmc/deplete/chain.py#L34-L119

— Reply to this email directly, view it on GitHub https://github.com/fusion-energy/neutronics-workshop/issues/232#issuecomment-1693955844, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOW2PYY2WRBE6YRVAYNBWLXXEKLNANCNFSM6AAAAAA3BFFPA4 . You are receiving this because you commented.Message ID: @.***>