1 //! \file reaction.h
2 //! Data for an incident neutron reaction
3 
4 #ifndef OPENMC_REACTION_H
5 #define OPENMC_REACTION_H
6 
7 #include <string>
8 
9 #include <gsl/gsl>
10 #include "hdf5.h"
11 
12 #include "openmc/reaction_product.h"
13 #include "openmc/vector.h"
14 
15 namespace openmc {
16 
17 //==============================================================================
18 //! Data for a single reaction including cross sections (possibly at multiple
19 //! temperatures) and reaction products (with secondary angle-energy
20 //! distributions)
21 //==============================================================================
22 
23 class Reaction {
24 public:
25   //! Construct reaction from HDF5 data
26   //! \param[in] group HDF5 group containing reaction data
27   //! \param[in] temperatures Desired temperatures for cross sections
28   explicit Reaction(hid_t group, const vector<int>& temperatures);
29 
30   //! \brief Calculate reaction rate based on group-wise flux distribution
31   //
32   //! \param[in] i_temp Temperature index
33   //! \param[in] energy Energy group boundaries in [eV]
34   //! \param[in] flux Flux in each energy group (not normalized per eV)
35   //! \param[in] grid Nuclide energy grid
36   //! \return Reaction rate
37   double collapse_rate(gsl::index i_temp, gsl::span<const double> energy,
38     gsl::span<const double> flux, const vector<double>& grid) const;
39 
40   //! Cross section at a single temperature
41   struct TemperatureXS {
42     int threshold;
43     vector<double> value;
44   };
45 
46   int mt_;             //!< ENDF MT value
47   double q_value_;     //!< Reaction Q value in [eV]
48   bool scatter_in_cm_; //!< scattering system in center-of-mass?
49   bool redundant_;     //!< redundant reaction?
50   vector<TemperatureXS> xs_;         //!< Cross section at each temperature
51   vector<ReactionProduct> products_; //!< Reaction products
52 };
53 
54 //==============================================================================
55 // Non-member functions
56 //==============================================================================
57 
58 //! Return reaction name given an ENDF MT value
59 //
60 //! \param[in] mt  ENDF MT value
61 //! \return Name of the corresponding reaction
62 std::string reaction_name(int mt);
63 
64 //! Return reaction type (MT value) given a reaction name
65 //
66 //! \param[in] name  Reaction name
67 //! \return Corresponding reaction type (MT value)
68 int reaction_type(std::string name);
69 
70 } // namespace openmc
71 
72 #endif // OPENMC_REACTION_H
73