Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ list(APPEND libopenmc_SOURCES
src/tallies/filter_musurface.cpp
src/tallies/filter_parent_nuclide.cpp
src/tallies/filter_particle.cpp
src/tallies/filter_particle_production.cpp
src/tallies/filter_polar.cpp
src/tallies/filter_sph_harm.cpp
src/tallies/filter_sptl_legendre.cpp
Expand Down
32 changes: 29 additions & 3 deletions docs/source/io_formats/tallies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ attributes/sub-elements:

:type:
The type of the filter. Accepted options are "cell", "cellfrom",
"cellborn", "surface", "material", "universe", "energy", "energyout", "mu",
"polar", "azimuthal", "mesh", "distribcell", "delayedgroup",
"energyfunction", and "particle".
"cellborn", "surface", "material", "universe", "energy", "energyout",
"mu", "polar", "azimuthal", "mesh", "distribcell", "delayedgroup",
"energyfunction", "particle", and "particleproduction".

:bins:
A description of the bins for each type of filter can be found in
Expand Down Expand Up @@ -321,6 +321,32 @@ should be set to:
A list of particle identifiers to tally, specified as strings (e.g.,
``neutron``, ``photon``, ``He4``) or as integer PDG numbers.

:particleproduction:
This filter tallies secondary particles produced in reactions, binned by
particle type and, optionally, by energy. Unlike other energy filters, the
weight applied is the weight of the secondary particle. To obtain secondary
particle production rates, use this filter with the ``events`` score.

The filter uses the following sub-elements instead of ``bins``:

:particles:
A space-separated list of secondary particle types to tally (e.g.,
``photon``, ``neutron``, ``electron``).

:energies:
An optional monotonically increasing list of energy boundaries in [eV]
for binning the secondary particle energies. If omitted, total production
is tallied without energy binning.

For example, to tally photon and neutron production in three energy groups:

.. code-block:: xml

<filter id="1" type="particleproduction">
<particles>photon neutron</particles>
<energies>0.0 1.0e5 1.0e6 20.0e6</energies>
</filter>

------------------
``<mesh>`` Element
------------------
Expand Down
31 changes: 0 additions & 31 deletions include/openmc/tallies/filter_energy.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,36 +73,5 @@ class EnergyoutFilter : public EnergyFilter {
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
53 changes: 53 additions & 0 deletions include/openmc/tallies/filter_particle_production.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#ifndef OPENMC_TALLIES_FILTER_PARTICLE_PRODUCTION_H
#define OPENMC_TALLIES_FILTER_PARTICLE_PRODUCTION_H

#include <unordered_map>

#include "openmc/particle.h"
#include "openmc/tallies/filter.h"
#include "openmc/vector.h"

namespace openmc {

//==============================================================================
//! Bins the outgoing energy of secondary particles
//!
//! This filter bins secondary particles by type and, optionally, by energy. It
//! can be used to get the photon production matrix for multigroup photon
//! transport, the energy distribution of secondary neutrons, etc. 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 Filter {
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;

private:
//----------------------------------------------------------------------------
// Data members

vector<ParticleType> secondary_types_; //!< Types of secondary particles

//! Map from PDG number to index in secondary_types_ for O(1) lookup
std::unordered_map<int32_t, int> type_to_index_;

vector<double> energy_bins_; //!< Energy bin boundaries (optional)
};

} // namespace openmc
#endif // OPENMC_TALLIES_FILTER_PARTICLE_PRODUCTION_H
Loading
Loading