Merge pull request #2134 from paulromano/thermal-mixed-elastic

Add support for mixed incoherent/coherent elastic thermal scattering
This commit is contained in:
Amelia J Trainer 2022-07-28 15:43:55 -04:00 committed by GitHub
commit a18abd4fd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 476 additions and 48 deletions

View file

@ -126,6 +126,26 @@ private:
debye_waller_; //!< Debye-Waller integral divided by atomic mass in [eV^-1]
};
//==============================================================================
//! Sum of multiple 1D functions
//==============================================================================
class Sum1D : public Function1D {
public:
// Constructors
explicit Sum1D(hid_t group);
//! Evaluate each function and sum results
//! \param[in] x independent variable
//! \return Function evaluated at x
double operator()(double E) const override;
const unique_ptr<Function1D>& functions(int i) const { return functions_[i]; }
private:
vector<unique_ptr<Function1D>> functions_; //!< individual functions
};
//! Read 1D function from HDF5 dataset
//! \param[in] group HDF5 group containing dataset
//! \param[in] name Name of dataset

View file

@ -61,6 +61,8 @@ void ensure_exists(hid_t obj_id, const char* name, bool attribute = false);
vector<std::string> group_names(hid_t group_id);
vector<hsize_t> object_shape(hid_t obj_id);
std::string object_name(hid_t obj_id);
hid_t open_object(hid_t group_id, const std::string& name);
void close_object(hid_t obj_id);
//==============================================================================
// Fortran compatibility functions

View file

@ -150,6 +150,34 @@ private:
//!< each incident energy
};
//==============================================================================
//! Mixed coherent/incoherent elastic angle-energy distribution
//==============================================================================
class MixedElasticAE : public AngleEnergy {
public:
//! Construct from HDF5 file
//
//! \param[in] group HDF5 group
explicit MixedElasticAE(
hid_t group, const CoherentElasticXS& coh_xs, const Function1D& incoh_xs);
//! Sample distribution for an angle and energy
//! \param[in] E_in Incoming energy in [eV]
//! \param[out] E_out Outgoing energy in [eV]
//! \param[out] mu Outgoing cosine with respect to current direction
//! \param[inout] seed Pseudorandom number seed pointer
void sample(
double E_in, double& E_out, double& mu, uint64_t* seed) const override;
private:
CoherentElasticAE coherent_dist_; //!< Coherent distribution
unique_ptr<AngleEnergy> incoherent_dist_; //!< Incoherent distribution
const CoherentElasticXS& coherent_xs_; //!< Ref. to coherent XS
const Function1D& incoherent_xs_; //!< Polymorphic ref. to incoherent XS
};
} // namespace openmc
#endif // OPENMC_SECONDARY_THERMAL_H