From b7df2d95e16c9eba756bfb1c65dae29d60a939c4 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Tue, 4 Aug 2020 13:05:56 -0500 Subject: [PATCH] Add documentation of collapse_rate functions --- include/openmc/nuclide.h | 6 ++++++ include/openmc/reaction.h | 9 ++++++++- openmc/lib/nuclide.py | 17 +++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/openmc/nuclide.h b/include/openmc/nuclide.h index ae4cdda1ef..6af04b14dc 100644 --- a/include/openmc/nuclide.h +++ b/include/openmc/nuclide.h @@ -58,6 +58,12 @@ public: //! from probability tables. void calculate_urr_xs(int i_temp, Particle& p) const; + //! \brief Calculate reaction rate based on group-wise flux distribution + // + //! \param[in] MT ENDF MT value for desired reaction + //! \param[in] energy Energy group boundaries in [eV] + //! \param[in] flux Flux in each energy group (not normalized per eV) + //! \return Reaction rate double collapse_rate(int MT, gsl::span energy, gsl::span flux) const; // Data members diff --git a/include/openmc/reaction.h b/include/openmc/reaction.h index ad1e7702cb..0975c1fd2a 100644 --- a/include/openmc/reaction.h +++ b/include/openmc/reaction.h @@ -27,7 +27,14 @@ public: //! \param[in] temperatures Desired temperatures for cross sections explicit Reaction(hid_t group, const std::vector& temperatures); - double collapse_rate(gsl::span energy, gsl::span flux, const std::vector& grid) const; + //! \brief Calculate reaction rate based on group-wise flux distribution + // + //! \param[in] energy Energy group boundaries in [eV] + //! \param[in] flux Flux in each energy group (not normalized per eV) + //! \param[in] grid Nuclide energy grid + //! \return Reaction rate + double collapse_rate(gsl::span energy, gsl::span flux, + const std::vector& grid) const; //! Cross section at a single temperature struct TemperatureXS { diff --git a/openmc/lib/nuclide.py b/openmc/lib/nuclide.py index 0e3ca66eb6..b526cb1636 100644 --- a/openmc/lib/nuclide.py +++ b/openmc/lib/nuclide.py @@ -78,6 +78,23 @@ class Nuclide(_FortranObject): return name.value.decode() def collapse_rate(self, MT, energy, flux): + """Calculate reaction rate based on group-wise flux distribution + + Parameters + ---------- + MT : int + ENDF MT value of the desired reaction + energy : iterable of float + Energy group boundaries in [eV] + flux : iterable of float + Flux in each energt group (not normalized per eV) + + Returns + ------- + float + Reaction rate + + """ energy = np.asarray(energy, dtype=float) flux = np.asarray(flux, dtype=float) xs = c_double()