Skip to content

Commit

Permalink
Merge pull request #3 from paulromano/mixed_ncrystal_const
Browse files Browse the repository at this point in the history
Change ncrystal_max_energy to be a global constant
  • Loading branch information
tkittel authored Jan 11, 2023
2 parents fe4a1de + e83ced8 commit 93aaa32
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
3 changes: 3 additions & 0 deletions include/openmc/ncrystal_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ namespace openmc {

extern "C" const bool NCRYSTAL_ENABLED;

//! Energy in [eV] to switch between NCrystal and ENDF
constexpr double NCRYSTAL_MAX_ENERGY {5.0};

//==============================================================================
// Wrapper class an NCrystal material
//==============================================================================
Expand Down
2 changes: 0 additions & 2 deletions include/openmc/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ extern int n_log_bins; //!< number of bins for logarithmic energy grid
extern int n_batches; //!< number of (inactive+active) batches
extern int n_max_batches; //!< Maximum number of batches
extern int max_tracks; //!< Maximum number of particle tracks written to file
extern double
ncrystal_max_energy; //!< Energy in eV to switch between NCrystal and ENDF
extern ResScatMethod res_scat_method; //!< resonance upscattering method
extern double res_scat_energy_min; //!< Min energy in [eV] for res. upscattering
extern double res_scat_energy_max; //!< Max energy in [eV] for res. upscattering
Expand Down
2 changes: 1 addition & 1 deletion src/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ void Material::calculate_neutron_xs(Particle& p) const

// Calculate NCrystal cross section
double ncrystal_xs = -1.0;
if (ncrystal_mat_ && p.E() < settings::ncrystal_max_energy) {
if (ncrystal_mat_ && p.E() < NCRYSTAL_MAX_ENERGY) {
ncrystal_xs = ncrystal_mat_.xs(p);
}

Expand Down
2 changes: 1 addition & 1 deletion src/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void sample_neutron_reaction(Particle& p)
// Sample a scattering reaction and determine the secondary energy of the
// exiting neutron
const auto& ncrystal_mat = model::materials[p.material()]->ncrystal_mat();
if (ncrystal_mat && p.E() < settings::ncrystal_max_energy) {
if (ncrystal_mat && p.E() < NCRYSTAL_MAX_ENERGY) {
ncrystal_mat.scatter(p);
} else {
scatter(p, i_nuclide);
Expand Down
1 change: 0 additions & 1 deletion src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ int n_batches;
int n_max_batches;
int max_splits {1000};
int max_tracks {1000};
double ncrystal_max_energy {5.0};
ResScatMethod res_scat_method {ResScatMethod::rvs};
double res_scat_energy_min {0.01};
double res_scat_energy_max {1000.0};
Expand Down

0 comments on commit 93aaa32

Please sign in to comment.