mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Implement filter for secondary particle production binned by energy (#3453)
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
1039b5d9ff
commit
f2c936cf5b
18 changed files with 328 additions and 26 deletions
|
|
@ -301,7 +301,7 @@ enum class TallyEstimator { ANALOG, TRACKLENGTH, COLLISION };
|
|||
enum class TallyEvent { SURFACE, LATTICE, KILL, SCATTER, ABSORB };
|
||||
|
||||
// Tally score type -- if you change these, make sure you also update the
|
||||
// _SCORES dictionary in openmc/capi/tally.py
|
||||
// _SCORES dictionary in openmc/lib/tally.py
|
||||
//
|
||||
// These are kept as a normal enum and made negative, since variables which
|
||||
// store one of these enum values usually also may be responsible for storing
|
||||
|
|
|
|||
|
|
@ -535,6 +535,11 @@ private:
|
|||
|
||||
vector<SourceSite> secondary_bank_;
|
||||
|
||||
// Keep track of how many secondary particles were created in the collision
|
||||
// and what the starting index is in the secondary bank for this particle
|
||||
int n_secondaries_ {0};
|
||||
int secondary_bank_index_ {0};
|
||||
|
||||
int64_t current_work_;
|
||||
|
||||
vector<double> flux_derivs_;
|
||||
|
|
@ -689,7 +694,20 @@ public:
|
|||
|
||||
// secondary particle bank
|
||||
SourceSite& secondary_bank(int i) { return secondary_bank_[i]; }
|
||||
const SourceSite& secondary_bank(int i) const { return secondary_bank_[i]; }
|
||||
decltype(secondary_bank_)& secondary_bank() { return secondary_bank_; }
|
||||
decltype(secondary_bank_) const& secondary_bank() const
|
||||
{
|
||||
return secondary_bank_;
|
||||
}
|
||||
|
||||
// Number of secondaries created in a collision
|
||||
int& n_secondaries() { return n_secondaries_; }
|
||||
const int& n_secondaries() const { return n_secondaries_; }
|
||||
|
||||
// Starting index in secondary bank for this collision
|
||||
int& secondary_bank_index() { return secondary_bank_index_; }
|
||||
const int& secondary_bank_index() const { return secondary_bank_index_; }
|
||||
|
||||
// Current simulation work index
|
||||
int64_t& current_work() { return current_work_; }
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ enum class FilterType {
|
|||
MUSURFACE,
|
||||
PARENT_NUCLIDE,
|
||||
PARTICLE,
|
||||
PARTICLE_PRODUCTION,
|
||||
POLAR,
|
||||
SPHERICAL_HARMONICS,
|
||||
SPATIAL_LEGENDRE,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_ENERGY_H
|
||||
#define OPENMC_TALLIES_FILTER_ENERGY_H
|
||||
|
||||
#include "openmc/particle.h"
|
||||
#include "openmc/span.h"
|
||||
#include "openmc/tallies/filter.h"
|
||||
#include "openmc/vector.h"
|
||||
|
|
@ -72,5 +73,36 @@ public:
|
|||
std::string text_label(int bin) const override;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
//! Bins the outgoing energy of secondary particles
|
||||
//!
|
||||
//! This filter can be used to get the photon production matrix for multigroup
|
||||
//! photon transport, the energy distribution of secondary neutrons, etc. Unlike
|
||||
//! other energy filters, the weight that is applied is equal to the weight of
|
||||
//! the secondary particle. Thus, to get secondary production it should be used
|
||||
//! in conjunction with the "events" score.
|
||||
//==============================================================================
|
||||
|
||||
class ParticleProductionFilter : public EnergyFilter {
|
||||
public:
|
||||
//----------------------------------------------------------------------------
|
||||
// Methods
|
||||
|
||||
std::string type_str() const override { return "particleproduction"; }
|
||||
FilterType type() const override { return FilterType::PARTICLE_PRODUCTION; }
|
||||
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
protected:
|
||||
ParticleType secondary_type_; //!< Type of secondary particle to filter
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_ENERGY_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue