2018-08-08 07:00:48 -05:00
|
|
|
//! \file reaction.h
|
|
|
|
|
//! Data for an incident neutron reaction
|
|
|
|
|
|
2018-07-11 07:01:54 -05:00
|
|
|
#ifndef OPENMC_REACTION_H
|
|
|
|
|
#define OPENMC_REACTION_H
|
|
|
|
|
|
2018-11-15 14:41:08 -06:00
|
|
|
#include <string>
|
2018-07-11 07:01:54 -05:00
|
|
|
|
|
|
|
|
#include "hdf5.h"
|
2018-08-20 14:40:32 -05:00
|
|
|
|
2022-02-10 10:05:50 -06:00
|
|
|
#include "openmc/particle_data.h"
|
2018-08-20 14:40:32 -05:00
|
|
|
#include "openmc/reaction_product.h"
|
2025-02-19 19:03:20 -06:00
|
|
|
#include "openmc/span.h"
|
2021-04-22 16:46:23 -04:00
|
|
|
#include "openmc/vector.h"
|
2018-07-11 07:01:54 -05:00
|
|
|
|
|
|
|
|
namespace openmc {
|
|
|
|
|
|
2018-08-08 07:00:48 -05:00
|
|
|
//==============================================================================
|
|
|
|
|
//! Data for a single reaction including cross sections (possibly at multiple
|
|
|
|
|
//! temperatures) and reaction products (with secondary angle-energy
|
|
|
|
|
//! distributions)
|
|
|
|
|
//==============================================================================
|
|
|
|
|
|
2018-07-11 07:01:54 -05:00
|
|
|
class Reaction {
|
|
|
|
|
public:
|
2018-08-08 07:00:48 -05:00
|
|
|
//! Construct reaction from HDF5 data
|
|
|
|
|
//! \param[in] group HDF5 group containing reaction data
|
|
|
|
|
//! \param[in] temperatures Desired temperatures for cross sections
|
2025-02-21 11:47:38 -06:00
|
|
|
//! \param[in] name Name of the nuclide
|
|
|
|
|
explicit Reaction(
|
|
|
|
|
hid_t group, const vector<int>& temperatures, std::string name);
|
2018-07-11 07:01:54 -05:00
|
|
|
|
2022-02-10 10:05:50 -06:00
|
|
|
//! Calculate cross section given temperautre/grid index, interpolation factor
|
|
|
|
|
//
|
|
|
|
|
//! \param[in] i_temp Temperature index
|
|
|
|
|
//! \param[in] i_grid Energy grid index
|
|
|
|
|
//! \param[in] interp_factor Interpolation factor between grid points
|
2025-02-19 19:03:20 -06:00
|
|
|
double xs(int64_t i_temp, int64_t i_grid, double interp_factor) const;
|
2022-02-10 10:05:50 -06:00
|
|
|
|
|
|
|
|
//! Calculate cross section
|
|
|
|
|
//
|
|
|
|
|
//! \param[in] micro Microscopic cross section cache
|
|
|
|
|
double xs(const NuclideMicroXS& micro) const;
|
|
|
|
|
|
2020-08-04 13:05:56 -05:00
|
|
|
//! \brief Calculate reaction rate based on group-wise flux distribution
|
|
|
|
|
//
|
2020-08-06 21:43:25 -05:00
|
|
|
//! \param[in] i_temp Temperature index
|
2020-08-04 13:05:56 -05:00
|
|
|
//! \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
|
2025-02-19 19:03:20 -06:00
|
|
|
double collapse_rate(int64_t i_temp, span<const double> energy,
|
|
|
|
|
span<const double> flux, const vector<double>& grid) const;
|
2020-07-27 14:55:09 -05:00
|
|
|
|
2018-08-08 07:00:48 -05:00
|
|
|
//! Cross section at a single temperature
|
2018-07-11 07:01:54 -05:00
|
|
|
struct TemperatureXS {
|
|
|
|
|
int threshold;
|
2021-04-22 16:46:23 -04:00
|
|
|
vector<double> value;
|
2018-07-11 07:01:54 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int mt_; //!< ENDF MT value
|
|
|
|
|
double q_value_; //!< Reaction Q value in [eV]
|
|
|
|
|
bool scatter_in_cm_; //!< scattering system in center-of-mass?
|
2018-09-13 07:18:47 -05:00
|
|
|
bool redundant_; //!< redundant reaction?
|
2021-04-22 16:46:23 -04:00
|
|
|
vector<TemperatureXS> xs_; //!< Cross section at each temperature
|
|
|
|
|
vector<ReactionProduct> products_; //!< Reaction products
|
2018-07-11 07:01:54 -05:00
|
|
|
};
|
|
|
|
|
|
2018-11-15 14:41:08 -06:00
|
|
|
//==============================================================================
|
|
|
|
|
// Non-member functions
|
|
|
|
|
//==============================================================================
|
|
|
|
|
|
2020-08-27 10:28:11 -05:00
|
|
|
//! Return reaction name given an ENDF MT value
|
|
|
|
|
//
|
|
|
|
|
//! \param[in] mt ENDF MT value
|
|
|
|
|
//! \return Name of the corresponding reaction
|
2018-11-15 14:41:08 -06:00
|
|
|
std::string reaction_name(int mt);
|
|
|
|
|
|
2026-02-21 10:17:12 -06:00
|
|
|
//! Return MT value for given a reaction name (including special tally MT
|
|
|
|
|
//! values)
|
2020-08-27 10:28:11 -05:00
|
|
|
//
|
|
|
|
|
//! \param[in] name Reaction name
|
2026-02-21 10:17:12 -06:00
|
|
|
//! \return Corresponding MT number or special tally score
|
|
|
|
|
int reaction_tally_mt(std::string name);
|
|
|
|
|
|
|
|
|
|
//! Return ENDF MT number given a reaction name
|
|
|
|
|
//
|
|
|
|
|
//! Unlike reaction_tally_mt(), this function always returns a positive ENDF MT
|
|
|
|
|
//! number and never a special negative tally score.
|
|
|
|
|
//!
|
|
|
|
|
//! \param[in] name Reaction name
|
|
|
|
|
//! \return Corresponding ENDF MT number
|
|
|
|
|
int reaction_mt(const std::string& name);
|
2020-08-27 10:28:11 -05:00
|
|
|
|
2018-08-08 07:00:48 -05:00
|
|
|
} // namespace openmc
|
2018-07-11 07:01:54 -05:00
|
|
|
|
|
|
|
|
#endif // OPENMC_REACTION_H
|