Nuclear Data Interface¶
STNeutron¶
-
class STNeutron¶
Holds all continuous energy data for single nuclide, at a single temperature.
Public Functions
-
STNeutron(const ACE &ace, const STNeutron &nuclide)¶
- Parameters
ace – ACE file from which to take the new cross sections.
nuclide – CENeutron containing another instance of the desired nuclide. Secondary distributions and fission data will be shared between the two data sets.
-
inline double awr() const¶
Returns the nuclide Atomic Weight Ratio.
-
inline bool fissile() const¶
Returns true if the nuclide is fissile, and false otherwise.
-
inline double temperature() const¶
Returns the temperature at which the data has been prepared.
-
inline const EnergyGrid &energy_grid() const¶
Returns the energy grid for the nuclide.
-
inline const CrossSection &total_xs() const¶
Returns the total CrossSection for the nuclide.
-
inline const CrossSection &elastic_xs() const¶
Returns the elastic scattering CrossSection for the nuclide.
-
inline const CrossSection &heating_number() const¶
Returns the heating number CrossSection for the nuclide. Upon evaluation, the average heating number if given for the nuclide, as the prescribed energy, in MeV.
-
inline const CrossSection &fission_xs() const¶
Returns the fission CrossSection for the nuclide.
-
inline const CrossSection &disappearance_xs() const¶
Returns the disappearance CrossSection for the nuclide.
-
inline const CrossSection &photon_production_xs() const¶
Returns the photon production CrossSection for the nuclide.
-
inline const std::vector<uint32_t> &mt_list() const¶
Returns a list of all scattering and absorption MT reactions present for the nuclide (other than elastic).
-
inline bool has_reaction(uint32_t mt) const¶
Checks to see if a nucldie has a given scattering or absorption reaction.
- Parameters
mt – MT reaction to search for.
-
inline const STReaction &reaction(uint32_t mt) const¶
Retrieved a given MT reaction.
- Parameters
mt – MT reaction to return.
-
inline const URRPTables &urr_ptables() const¶
Returns a reference to the URRPTables instance.
-
inline const Elastic &elastic() const¶
Returns a reference to the Elastic instance which contains the AngleEnergy distribution for elastic scattering.
-
inline Elastic &elastic()¶
Returns a modifiable reference to the Elastic instance which contains the AngleEnergy distribution for elastic scattering.
-
inline const Fission &fission()¶
Returns and reference to the Fission instance which contains all fission information.
-
STNeutron(const ACE &ace, const STNeutron &nuclide)¶
EnergyGrid¶
-
class EnergyGrid : public std::enable_shared_from_this<EnergyGrid>¶
Holds the hashed energy grid of a Nuclide. An energy grid should ALWAYS be instantiated as an std::shared_ptr, because a copy is kept inside all CrossSection instances.
Public Functions
-
EnergyGrid(const ACE &ace, uint32_t NBINS = 8192)¶
- Parameters
ace – ACE file from which to take the energy grid.
NBINS – Number of bins to hash the energy grid into. The default value is 8192, which is the number of bins used by MCNP.
-
EnergyGrid(const std::vector<double> &energy, uint32_t NBINS = 8192)¶
- Parameters
energy – Vector of all points in energy grid (sorted).
NBINS – Number of bins to hash the energy grid into. The default value is 8192, which is the number of bins used by MCNP.
-
~EnergyGrid() = default¶
-
inline double operator[](std::size_t i) const¶
Returns the ith energy in the grid in MeV.
- Parameters
i – Index into energy grid.
-
inline std::size_t size() const¶
Number of points in the complete energy grid.
-
inline const std::vector<double> &grid() const¶
Returns a reference to the energy grid.
-
inline double min_energy() const¶
Returns the lowest energy in the grid.
-
inline double max_energy() const¶
Returns the highest energy in the grid.
-
inline double urr_min_energy() const¶
Returns the starting energy for the unresolved resonance region.
-
inline bool has_urr() const¶
Returns true if the EnergyGrid has an associated unresolved resonance region.
-
inline std::size_t get_lower_index(double E) const¶
Finds the interpolation index for a given energy, using the hashing algorithm for speed.
- Parameters
E – Energy for which to find the index.
-
void hash_energy_grid(uint32_t NBINS)¶
Re-hashes the energy grid to specified number of pointers.
- Parameters
NBINS – Number of bins to hash the energy grid into.
-
EnergyGrid(const ACE &ace, uint32_t NBINS = 8192)¶
CrossSection¶
-
class CrossSection¶
Contains the linearly interpolable cross section data for a single MT.
Public Functions
- Parameters
ace – ACE file to take the data from.
i – Index in the XSS block where the cross section starts.
E_grid – Pointer to EnergyGrid associated with the cross section values.
get_index – Flag to indicate wether the cross section values begin at i, or if the energy grid index is at i. Default value is true.
is_heating – Flat to indicate that heating numbers are stored, and not cross sections. This allows the storred values to be negative without error.
- Parameters
xs – Vector containing the cross section values.
E_grid – Pointer to EnergyGrid to use for the cross section.
index – Starting index in the energy grid.
- Parameters
xs – Value for the cross section at all points in the provided energy grid.
E_grid – Pointer to EnergyGrid to use for the cross section.
-
~CrossSection() = default¶
-
inline double operator[](std::size_t i) const¶
Returns value of the cross section at index relative to the associated energy grid.
- Parameters
i – Index from associated energy grid.
-
inline double operator()(double E) const¶
Evaluates the cross section at a given energy. Uses bisection search.
- Parameters
E – Energy to evaluate the cross section at.
-
inline double operator()(double E, std::size_t i) const¶
Evaluates the cross section at a given energy, with the grid point already provided.
- Parameters
E – Energy to evaluate the cross section at.
i – Index of the points for interpolation in the frame of the energy grid.
-
inline double operator()(double E, std::size_t i, double El, double Eh) const¶
Evaluates the cross section at a given energy, with the grid point already provided.
- Parameters
E – Energy to evaluate the cross section at.
i – Index of the points for interpolation in the frame of the energy grid.
El – The value of the energy grid at index i.
Eh – The value of the energy grid at index i+1.
-
inline double evaluate(double E) const¶
Evaluates the cross section at a given energy. Uses bisection search.
- Parameters
E – Energy to evaluate the cross section at.
-
inline double evaluate(double E, std::size_t i) const¶
Evaluates the cross section at a given energy, with the grid point already provided.
- Parameters
E – Energy to evaluate the cross section at.
i – Index of the points for interpolation in the frame of the energy grid.
-
inline double evaluate(double E, std::size_t i, double El, double Eh) const¶
Evaluates the cross section at a given energy, with the grid point already provided.
- Parameters
E – Energy to evaluate the cross section at.
i – Index of the points for interpolation in the frame of the energy grid.
El – The value of the energy grid at index i.
Eh – The value of the energy grid at index i+1.
-
inline std::size_t index() const¶
Returns index in the energy grid at which the cross section values begin.
-
inline std::size_t size() const¶
Number of points in the cross section.
-
inline double xs(std::size_t i) const¶
Returns the ith cross section value.
-
inline double energy(std::size_t i) const¶
Returns the ith energy value, which corresponds with the ith cross section value.
-
inline const std::vector<double> &xs() const¶
Returns the cross section values as a vector of floats.
-
inline const EnergyGrid &energy_grid() const¶
@breif Returns a reference to the EnergyGrid object associated with the cross section.
-
std::vector<double> energy() const¶
Returns a copy of the energy grid points for the cross section as a vector of floats.
ReactionBase¶
-
class ReactionBase¶
Holds the non temperature-dependent info and product distributions for a single MT.
Subclassed by pndl::Reaction< CrossSection >
Public Functions
-
ReactionBase(const ReactionBase&) = default¶
-
inline uint32_t mt() const¶
Returns the MT of the reaction.
-
inline double q() const¶
Returns the Q-value of the reaction.
-
inline double threshold() const¶
Returns the threshold energy for the reaction.
-
inline const Function1D &yield() const¶
Returns the function for the reaction yield.
-
inline AngleEnergyPacket sample_neutron_angle_energy(double E_in, const std::function<double()> &rng) const¶
Samples and angle and energy from the neutron reaction product distribution.
- Parameters
E_in – Incident energy in MeV.
rng – Random number generation function.
-
inline const AngleEnergy &neutron_distribution() const¶
Returns the distribution for neutron reaction products.
-
ReactionBase(const ReactionBase&) = default¶
STReaction¶
-
using pndl::STReaction = Reaction<CrossSection>¶
Alias for Reaction<CrossSection>, which contains all data for a reaction MT at a single temperature.
-
template<>
class Reaction<CrossSection> : public pndl::ReactionBase¶ Holds all information for a reaction at a single temperature.
Public Functions
- Parameters
ace – ACE file to take reaction from.
indx – Reaction index in the MT array.
- Parameters
ace – ACE file to take cross section from.
indx – Reaction index in the MT array.
egrid – Pointer to the EnergyGrid for the nuclide.
reac – Reaction object to take distributions from.
- Parameters
xs – CrossSection for the reaction.
mt – The MT identifier of the reaction.
q – The Q-value of the reaction.
awr – Atomic Weight Ratio of the nuclide.
threshold – The energy threshold for the reaction.
yield – Average number of neutrons emitted, as a function of incident particle energy.
neutron_distribution – Distribution for outgoing neutrons.
-
inline const CrossSection &xs() const¶
Returns the CrossSection for the reaction.
Fission¶
-
class Fission¶
This class contains all of the information for the nuclide which is related to.
Public Functions
- Parameters
ace – ACE file from which to construct the data.
energy_grid – Pointer to the EnergyGrid for the nuclide.
- Parameters
ace – ACE file from which to construct the data.
energy_grid – Pointer to the EnergyGrid for the nuclide.
fission – Fission object to take distributions from.
-
inline const Function1D &nu_total() const¶
Returns the function for total nu.
-
inline const Function1D &nu_prompt() const¶
Returns the function for prompt nu.
-
inline const Function1D &nu_delayed() const¶
Returns the function for delayed nu.
-
inline const AngleEnergy &prompt_spectrum() const¶
Returns the prompt spectrum for fission neutrons.
-
inline std::size_t n_delayed_families() const¶
Returns the number of delayed neutron families.
-
inline const DelayedFamily &delayed_family(std::size_t i) const¶
Returns the ith delayed family data.
- Parameters
i – Index of the delayed family.
-
inline const std::vector<uint32_t> &mt_list() const¶
Returns a list of fission reactions present.
-
inline bool has_reaction(uint32_t mt) const¶
Checks to see if a given fission reaction is present. The only MT values which could possibly be present are 18, 19, 20, 21, and 38. All other MTs are guaranteed to return false.
- Parameters
mt – MT fission reaction to search for.
-
inline const STReaction &reaction(uint32_t mt) const¶
Retrieves a given MT fission reaction. The only MT values which could possibly be present are 18, 19, 20, 21, and 38 (check with has_reaction). All other MTs are guaranteed to throw a PNDLException.
- Parameters
mt – MT fission reaction to return.
DelayedFamily¶
-
class DelayedFamily¶
Contains data for a delayed neutron family.
Public Functions
-
DelayedFamily(const ACE &ace, std::size_t i, std::size_t g)¶
- Parameters
ace – ACE file to take delayed neutron data from.
i – Index to the beinning of the delayed family data in the XSS block.
g – Delayed family index.
-
~DelayedFamily() = default¶
-
inline double decay_constant() const¶
Returns the decay constant for the family in inverse seconds.
-
inline const Tabulated1D &probability() const¶
Returns the Tabulated1D function for the probability of selecting the delayed family for a given energy.
-
inline double sample_energy(double E, std::function<double()> rng) const¶
Samples and energy from the delayed family distribution.
- Parameters
E – Incident energy.
rng – Random number generation function.
-
DelayedFamily(const ACE &ace, std::size_t i, std::size_t g)¶
STThermalScatteringLaw¶
-
class STThermalScatteringLaw¶
Class to hold all thermal scattering data for a single nuclide at at single temperature.
Public Functions
-
STThermalScatteringLaw(const ACE &ace, bool unit_based_interpolation = false)¶
- Parameters
ace – ACE file which contains thermal scattering law.
unit_based_interpolation – If false (default value) and the incoherent inelastic scattering distribution is continuous in energy, unit based interpolation will not be applied. This is method used by MCNP, Serpent, and OpenMC, so we have made it our default. If set to true, unit based interpolation will be used.
-
~STThermalScatteringLaw() = default¶
-
inline double awr() const¶
Returns the nuclide Atomic Weight Ratio.
-
inline double temperature() const¶
Returns the temperature at which the data has been prepared.
-
inline double max_energy() const¶
Returns the maximum energy for the incoherent inelastic scattering reaction. This value is typtically used as the cutoff for using Sab tables in Monte Carlo codes.
-
inline bool has_coherent_elastic() const¶
Returns true if the nuclide has coherrent elastic scattering.
-
inline bool has_incoherent_elastic() const¶
Returns true if the nuclide has incoherrent elastic scattering.
-
inline const STTSLReaction &coherent_elastic() const¶
Returns a STTSLReaction reference to the coherent elastic scattering data.
-
inline const STTSLReaction &incoherent_elastic() const¶
Returns a STTSLReaction reference to the incoherent elastic scattering data.
-
inline const STTSLReaction &incoherent_inelastic() const¶
Returns a STTSLReaction reference to the incoherent inelastic data scattering data.
-
inline double xs(double E) const¶
@breif Returns the total thermal scattering cross section.
- Parameters
E – Energy at which to evaluate the cross section.
-
STThermalScatteringLaw(const ACE &ace, bool unit_based_interpolation = false)¶
STTSLReaction¶
-
class STTSLReaction : public pndl::AngleEnergy¶
Interface to represent any thermal neutron scattering reaction at a single temperature.
Subclassed by pndl::STCoherentElastic, pndl::STIncoherentElasticACE, pndl::STIncoherentInelastic
Public Functions
-
virtual double xs(double E) const = 0¶
Evaluates the cross section for the thermal neutron scattering reaction.
- Parameters
E – Incident energy at which to evaluate the cross section in MeV.
-
virtual double xs(double E) const = 0¶
STCoherentElastic¶
-
class STCoherentElastic : public pndl::STTSLReaction¶
Holds the Coherent Elastic scattering data for a single nuclide at a single temperature.
Public Functions
-
~STCoherentElastic() = default¶
-
inline virtual double xs(double E) const final override¶
Evaluates the cross section for the thermal neutron scattering reaction.
- Parameters
E – Incident energy at which to evaluate the cross section in MeV.
-
inline virtual AngleEnergyPacket sample_angle_energy(double E_in, const std::function<double()> &rng) const final override¶
Samples an angle and energy from the distribution.
- Parameters
E_in – Incident energy in MeV.
rng – Randum number generation function.
- Returns
Sampled cosine of the scattering angle and energy in an AngleEnergyPacket.
-
inline virtual std::optional<double> angle_pdf(double, double) const final override¶
Evaluates the marginal PDF for having a scattering cosine of mu at incoming energy E_in. Returns an std::optional<double>, as it may not always be possible to obtain the marginal PDF.
- Parameters
E_in – Incoming energy.
mu – Scattering cosine.
-
inline virtual std::optional<double> pdf(double, double, double) const final override¶
Evaluates the joint PDF for having a scattering cosine of mu at incoming energy E_in, and exit energy E_out. Returns an std::optional<double>, as it may not always be possible to calculate the joint PDF.
- Parameters
E_in – Incoming energy.
mu – Scattering cosine.
E_out – Exit energy.
-
inline const std::vector<double> &bragg_edges() const¶
Returns the vector of Bragg edges.
-
inline const std::vector<double> &structure_factor_sum() const¶
Returns the vector of the sum of structure factors.
-
~STCoherentElastic() = default¶
STIncoherentElasticACE¶
-
class STIncoherentElasticACE : public pndl::STTSLReaction¶
Holds the Incoherent Elastic scattering data for a single nuclide at a single temperature, according to the ACE format.
Public Functions
-
STIncoherentElasticACE(const ACE &ace)¶
- Parameters
ace – ACE file which contains thermal scattering law.
-
~STIncoherentElasticACE() = default¶
-
inline virtual double xs(double E) const final override¶
Evaluates the cross section for the thermal neutron scattering reaction.
- Parameters
E – Incident energy at which to evaluate the cross section in MeV.
-
inline virtual AngleEnergyPacket sample_angle_energy(double E_in, const std::function<double()> &rng) const final override¶
Samples an angle and energy from the distribution.
- Parameters
E_in – Incident energy in MeV.
rng – Randum number generation function.
- Returns
Sampled cosine of the scattering angle and energy in an AngleEnergyPacket.
-
inline virtual std::optional<double> angle_pdf(double, double) const final override¶
Evaluates the marginal PDF for having a scattering cosine of mu at incoming energy E_in. Returns an std::optional<double>, as it may not always be possible to obtain the marginal PDF.
- Parameters
E_in – Incoming energy.
mu – Scattering cosine.
-
inline virtual std::optional<double> pdf(double, double, double) const final override¶
Evaluates the joint PDF for having a scattering cosine of mu at incoming energy E_in, and exit energy E_out. Returns an std::optional<double>, as it may not always be possible to calculate the joint PDF.
- Parameters
E_in – Incoming energy.
mu – Scattering cosine.
E_out – Exit energy.
-
inline const Tabulated1D &xs() const¶
Returns the cross section function.
-
inline const std::vector<double> &incoming_energy() const¶
Returns vector to the incoming energy grid.
-
inline const std::vector<std::vector<double>> &cosines() const¶
Returns array of discrete scattering cosines.
-
STIncoherentElasticACE(const ACE &ace)¶
STIncoherentInelastic¶
-
class STIncoherentInelastic : public pndl::STTSLReaction¶
Holds the Incoherent Inelastic scattering data for a single nuclide at a single temperature.
Public Functions
-
STIncoherentInelastic(const ACE &ace, bool unit_based_interpolation = false)¶
- Parameters
ace – ACE file which contains thermal scattering law.
unit_based_interpolation – If false (default value), the distribution will be sampled without using unit-based interpolation, which is the method used by MCNP, Serpent, and OpenMC. If set to true, unit based interpolation will be applied to the sampling of the energy.
-
~STIncoherentInelastic() = default¶
-
inline virtual double xs(double E) const final override¶
Evaluates the cross section for the thermal neutron scattering reaction.
- Parameters
E – Incident energy at which to evaluate the cross section in MeV.
-
inline virtual AngleEnergyPacket sample_angle_energy(double E_in, const std::function<double()> &rng) const final override¶
Samples an angle and energy from the distribution.
- Parameters
E_in – Incident energy in MeV.
rng – Randum number generation function.
- Returns
Sampled cosine of the scattering angle and energy in an AngleEnergyPacket.
-
inline virtual std::optional<double> angle_pdf(double E_in, double mu) const final override¶
Evaluates the marginal PDF for having a scattering cosine of mu at incoming energy E_in. Returns an std::optional<double>, as it may not always be possible to obtain the marginal PDF.
- Parameters
E_in – Incoming energy.
mu – Scattering cosine.
-
inline virtual std::optional<double> pdf(double E_in, double mu, double E_out) const final override¶
Evaluates the joint PDF for having a scattering cosine of mu at incoming energy E_in, and exit energy E_out. Returns an std::optional<double>, as it may not always be possible to calculate the joint PDF.
- Parameters
E_in – Incoming energy.
mu – Scattering cosine.
E_out – Exit energy.
-
inline double max_energy() const¶
Retruns the maximum energy value which is tabulated for the cross section.
-
inline const Tabulated1D &xs() const¶
Returns the cross section function.
-
inline const AngleEnergy &distribution() const¶
Returns the AngleEnergy distribution.
-
STIncoherentInelastic(const ACE &ace, bool unit_based_interpolation = false)¶
URRPTables¶
-
class URRPTables¶
Class to hold the URR probability tables for a single nuclide, at a single temperature.
Public Functions
-
URRPTables(const ACE &ace, const CrossSection &total, const CrossSection &disappearance, const CrossSection &elastic, const CrossSection &capture, const CrossSection &fission, const CrossSection &heating, const std::vector<STReaction> &reactions)¶
- Parameters
ace – ACE file containing the probability tables.
total – Total cross section of the nuclide.
disappearance – Dissappearance cross section of the nuclide.
elastic – Elastic cross section of the nuclide.
capture – Capture cross section of the nuclide.
fission – Fission cross section of the nuclide.
heating – Heating number CrossSection of the nuclide.
reactions – Vector of all STReaction instances for the nuclide.
-
inline bool is_valid() const¶
Returns true if the PTables are present, and false if not.
-
inline std::optional<XSPacket> evaluate_xs(double E, std::size_t i, double xi) const¶
Calculates the cross section for a given incident energy and probability. If the incident energy is not within the URR, or if there are no probability tables, std::nullopt is returned.
- Parameters
E – Incident energy (MeV).
i – Index of E in the global energy grid, for evaluating cross sections.
xi – Random variable in the interval [0,1).
-
inline std::optional<XSPacket> evaluate_xs(double E, double xi) const¶
Calculates the cross section for a given incident energy and probability. If the incident energy is not within the URR, or if there are no probability tables, std::nullopt is returned.
- Parameters
E – Incident energy (MeV).
xi – Random variable in the interval [0,1).
-
inline double min_energy() const¶
Returns the minimum energy of the URR probability tables.
-
inline double max_energy() const¶
Returns the maximum energy of the URR probability tables.
-
inline bool energy_in_range(double E) const¶
Returns true if provided energy is in the URR energy range.
- Parameters
E – Energy to check, in MeV.
-
inline bool xs_factors() const¶
Returns true if the values in the probability tables are factors which must multiply the smooth cross sections. False is returned if the actual cross sections are stored.
-
inline bool inelastic_competition() const¶
Returns ture if there the nuclide also has inelastic reactions in the URR region.
-
inline bool absorption_competition() const¶
Returns ture if there the nuclide also has other obsorption reactions in the URR region.
-
URRPTables(const ACE &ace, const CrossSection &total, const CrossSection &disappearance, const CrossSection &elastic, const CrossSection &capture, const CrossSection &fission, const CrossSection &heating, const std::vector<STReaction> &reactions)¶