refactoring

This commit is contained in:
liangjg 2019-04-11 12:14:18 -04:00
parent a795de2db5
commit 57fcb078d3
5 changed files with 12 additions and 13 deletions

View file

@ -108,7 +108,7 @@ constexpr std::array<const char*, 39> SUBSHELLS = {
// Void material and nuclide
// TODO: refactor and remove
constexpr int MATERIAL_VOID {-1};
constexpr int NUCLIDE_VOID {-1};
constexpr int NUCLIDE_NONE {-1};
// ============================================================================
// CROSS SECTION RELATED CONSTANTS
@ -128,7 +128,7 @@ constexpr int TEMPERATURE_INTERPOLATION {2};
// Reaction types
// TODO: Convert to enum
constexpr int NONE_REACTION {0};
constexpr int REACTION_NONE {0};
constexpr int TOTAL_XS {1};
constexpr int ELASTIC {2};
constexpr int N_NONELASTIC {3};

View file

@ -261,7 +261,7 @@ public:
// Post-collision physical data
int n_bank_ {0}; //!< number of fission sites banked
int n_bank_second_ {0}; //!< number of secondary particles
int n_bank_second_ {0}; //!< number of secondary particles banked
double wgt_bank_ {0.0}; //!< weight of fission sites banked
int n_delayed_bank_[MAX_DELAYED_GROUPS]; //!< number of delayed fission
//!< sites banked

View file

@ -44,7 +44,7 @@ void sample_positron_reaction(Particle* p);
//!
//! \param[in] p Particle
//! \return Index in the data::nuclides vector
int sample_nuclide(Particle* p);
int sample_nuclide(const Particle* p);
//! Determine the average total, prompt, and delayed neutrons produced from
//! fission and creates appropriate bank sites.

View file

@ -161,8 +161,8 @@ Particle::transport()
// Reset event variables
event_ = EVENT_KILL;
event_nuclide_ = NUCLIDE_VOID;
event_mt_ = NONE_REACTION;
event_nuclide_ = NUCLIDE_NONE;
event_mt_ = REACTION_NONE;
// If the cell hasn't been determined based on the particle's location,
// initiate a search for the current cell. This generally happens at the

View file

@ -81,6 +81,9 @@ void sample_neutron_reaction(Particle* p)
// Sample a nuclide within the material
int i_nuclide = sample_nuclide(p);
// Save which nuclide particle had collision with
p->event_nuclide_ = i_nuclide;
// Create fission bank sites. Note that while a fission reaction is sampled,
// it never actually "happens", i.e. the weight of the particle does not
// change when sampling fission sites. The following block handles all
@ -394,7 +397,7 @@ void sample_positron_reaction(Particle* p)
p->event_ = EVENT_ABSORB;
}
int sample_nuclide(Particle* p)
int sample_nuclide(const Particle* p)
{
// Sample cumulative distribution function
double cutoff = prn() * p->macro_xs_.total;
@ -411,11 +414,7 @@ int sample_nuclide(Particle* p)
// Increment probability to compare to cutoff
prob += atom_density * p->neutron_xs_[i_nuclide].total;
if (prob >= cutoff) {
// Save which nuclide particle had collision with
p->event_nuclide_ = i_nuclide;
return i_nuclide;
}
if (prob >= cutoff) return i_nuclide;
}
// If we reach here, no nuclide was sampled
@ -443,7 +442,7 @@ int sample_element(Particle* p)
// Increment probability to compare to cutoff
prob += sigma;
if (prob > cutoff) {
// Save which nuclide particle had collision with
// Save which nuclide particle had collision with for tally purpose
p->event_nuclide_ = mat->nuclide_[i];
return i_element;