OpenMC/include/openmc/wmp.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

122 lines
4.1 KiB
C
Raw Permalink Normal View History

2018-12-26 07:24:21 -06:00
#ifndef OPENMC_WMP_H
#define OPENMC_WMP_H
#include "hdf5.h"
#include "openmc/tensor.h"
2018-12-26 07:24:21 -06:00
#include <complex>
2018-12-26 07:24:21 -06:00
#include <string>
#include <tuple>
2018-12-26 07:24:21 -06:00
#include "openmc/array.h"
#include "openmc/vector.h"
2018-12-26 07:24:21 -06:00
namespace openmc {
//========================================================================
// Constants
//========================================================================
// Constants that determine which value to access
constexpr int MP_EA {0}; // Pole
constexpr int MP_RS {1}; // Residue scattering
constexpr int MP_RA {2}; // Residue absorption
constexpr int MP_RF {3}; // Residue fission
// Polynomial fit indices
constexpr int FIT_S {0}; // Scattering
constexpr int FIT_A {1}; // Absorption
constexpr int FIT_F {2}; // Fission
2019-01-24 14:33:15 -06:00
// Multipole HDF5 file version
constexpr array<int, 2> WMP_VERSION {1, 1};
2019-01-24 14:33:15 -06:00
//========================================================================
// Windowed multipole data
//========================================================================
2018-12-26 07:24:21 -06:00
class WindowedMultipole {
public:
// Types
struct WindowInfo {
int index_start; // Index of starting pole
int index_end; // Index of ending pole
bool broaden_poly; // Whether to broaden polynomial curvefit
};
2018-12-26 07:24:21 -06:00
// Constructors, destructors
WindowedMultipole(hid_t group);
// Methods
2019-01-08 08:04:31 -06:00
//! \brief Evaluate the windowed multipole equations for cross sections in the
//! resolved resonance regions
//!
//! \param E Incident neutron energy in [eV]
//! \param sqrtkT Square root of temperature times Boltzmann constant
//! \return Tuple of elastic scattering, absorption, and fission cross
//! sections in [b]
std::tuple<double, double, double> evaluate(double E, double sqrtkT) const;
2019-01-08 08:04:31 -06:00
//! \brief Evaluates the windowed multipole equations for the derivative of
//! cross sections in the resolved resonance regions with respect to
//! temperature.
//!
//! \param E Incident neutron energy in [eV]
//! \param sqrtkT Square root of temperature times Boltzmann constant
//! \return Tuple of derivatives of elastic scattering, absorption, and
//! fission cross sections in [b/K]
std::tuple<double, double, double> evaluate_deriv(
double E, double sqrtkT) const;
2018-12-26 07:24:21 -06:00
// Data members
std::string name_; //!< Name of nuclide
double E_min_; //!< Minimum energy in [eV]
double E_max_; //!< Maximum energy in [eV]
double sqrt_awr_; //!< Square root of atomic weight ratio
double inv_spacing_; //!< 1 / spacing in sqrt(E) space
2018-12-26 07:24:21 -06:00
int fit_order_; //!< Order of the fit
bool fissionable_; //!< Is the nuclide fissionable?
vector<WindowInfo> window_info_; // Information about a window
tensor::Tensor<double>
curvefit_; // Curve fit coefficients (window, poly order, reaction)
tensor::Tensor<std::complex<double>> data_; //!< Poles and residues
2021-01-07 15:43:32 -05:00
// Constant data
static constexpr int MAX_POLY_COEFFICIENTS =
11; //!< Max order of polynomial fit plus one
2018-12-26 07:24:21 -06:00
};
2019-01-24 14:33:15 -06:00
//========================================================================
// Non-member functions
//========================================================================
//! Check to make sure WMP library data version matches
//!
//! \param[in] file HDF5 file object
void check_wmp_version(hid_t file);
//! \brief Checks for the existence of a multipole library in the directory and
//! loads it
//!
//! \param[in] i_nuclide Index in global nuclides array
void read_multipole_data(int i_nuclide);
//==============================================================================
//! Doppler broadens the windowed multipole curvefit.
//!
//! The curvefit is a polynomial of the form a/E + b/sqrt(E) + c + d sqrt(E)...
//!
//! \param E The energy to evaluate the broadening at
//! \param dopp sqrt(atomic weight ratio / kT) with kT given in eV
//! \param n The number of components to the polynomial
//! \param factors The output leading coefficient
//==============================================================================
extern "C" void broaden_wmp_polynomials(
double E, double dopp, int n, double factors[]);
2018-12-26 07:24:21 -06:00
} // namespace openmc
#endif // OPENMC_WMP_H