Cardinal
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
CellTally Class Reference

#include <CellTally.h>

Inheritance diagram for CellTally:
[legend]

Public Member Functions

 CellTally (const InputParameters &parameters)
 
virtual std::pair< unsigned int, openmc::Filter * > spatialFilter () override
 
virtual Real storeResults (const std::vector< unsigned int > &var_numbers, unsigned int local_score, unsigned int global_score, const std::string &output_type) override
 
virtual void initializeTally ()
 
virtual void resetTally ()
 
void addScore (const std::string &score)
 
void computeSumAndMean ()
 
void relaxAndNormalizeTally (unsigned int local_score, const Real &alpha, const Real &norm)
 
const openmc::Tally * getWrappedTally () const
 
const std::vector< std::string > & getScores () const
 
const std::vector< std::string > & getAuxVarNames () const
 
const std::vector< std::string > & getOutputs () const
 
openmc::TallyEstimator getTallyEstimator () const
 
const Real & getMean (unsigned int local_score) const
 
const Real & getSum (unsigned int local_score) const
 
bool hasTrigger () const
 
bool hasOutputs () const
 
bool renamesTallyVars () const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

void checkCellMappedSubdomains ()
 
std::vector< OpenMCCellAverageProblem::cellInfogetTallyCells () const
 
void fillElementalAuxVariable (const unsigned int &var_num, const std::vector< unsigned int > &elem_ids, const Real &value)
 
void applyTriggersToLocalTally (openmc::Tally *tally)
 

Protected Attributes

std::unordered_set< SubdomainID > _tally_blocks
 Blocks for which to add cell tallies. More...
 
std::map< OpenMCCellAverageProblem::cellInfo, bool > _cell_has_tally
 Whether a cell index, instance pair should be added to the tally filter. More...
 
openmc::CellInstanceFilter * _cell_filter
 OpenMC mesh filter for this unstructured mesh tally. More...
 
const bool & _check_equal_mapped_tally_volumes
 
const Real & _equal_tally_volume_abs_tol
 Absolute tolerance for checking equal tally mapped volumes. More...
 
OpenMCCellAverageProblem_openmc_problem
 The OpenMCCellAverageProblem using the tally system. More...
 
MooseMesh & _mesh
 The MooseMesh. More...
 
AuxiliarySystem & _aux
 The aux system. More...
 
openmc::TallyEstimator _estimator
 The OpenMC estimator to use with this tally. More...
 
std::vector< std::string > _tally_score
 OpenMC tally score(s) to use with this tally. More...
 
std::vector< std::string > _tally_name
 Auxiliary variable name(s) for this tally. More...
 
openmc::Tally * _local_tally = nullptr
 The OpenMC tally object this class wraps. More...
 
unsigned int _local_tally_index
 The index of the OpenMC tally this object wraps. More...
 
unsigned int _filter_index
 The index of the first filter added by this tally. More...
 
std::vector< Real > _local_sum_tally
 Sum value of this tally across all bins. Indexed by score. More...
 
std::vector< Real > _local_mean_tally
 
const MultiMooseEnum * _tally_trigger
 
std::vector< Real > _tally_trigger_threshold
 
std::vector< xt::xtensor< double, 1 > > _current_tally
 
std::vector< xt::xtensor< double, 1 > > _previous_tally
 Previous fixed point iteration tally result (after relaxation) More...
 
std::vector< xt::xtensor< double, 1 > > _current_raw_tally
 Current "raw" tally output from Monte Carlo solution. More...
 
std::vector< xt::xtensor< double, 1 > > _current_raw_tally_std_dev
 Current "raw" tally standard deviation. More...
 
const bool _renames_tally_vars
 Whether this tally stores results in variables names something other than '_tally_score'. More...
 
const bool _has_outputs
 Whether this tally has additional outputs or not. More...
 
std::vector< std::string > _output_name
 Suffixes to apply to 'tally_name' in order to name the fields in the 'output'. More...
 

Static Protected Attributes

static constexpr Real ZERO_TALLY_THRESHOLD = 1e-12
 Tolerance for setting zero tally. More...
 

Constructor & Destructor Documentation

◆ CellTally()

CellTally::CellTally ( const InputParameters &  parameters)

Member Function Documentation

◆ addScore()

void TallyBase::addScore ( const std::string &  score)
inherited

Add a score to this tally.

Parameters
[in]scorescore to add

◆ applyTriggersToLocalTally()

void TallyBase::applyTriggersToLocalTally ( openmc::Tally *  tally)
protectedinherited

Applies triggers to a tally. This is often the local tally wrapped by this object.

Parameters
[in]tallythe tally to apply triggers to

◆ checkCellMappedSubdomains()

void CellTally::checkCellMappedSubdomains ( )
protected

Loop over all the OpenMC cells and determine if a cell maps to more than one subdomain that also has different tally settings (i.e. we would not know whether to add or not to add tallies to the cell).

◆ computeSumAndMean()

void TallyBase::computeSumAndMean ( )
inherited

A function which computes and stores the sum and mean of the tally across all bins for a particular score.

◆ fillElementalAuxVariable()

void TallyBase::fillElementalAuxVariable ( const unsigned int &  var_num,
const std::vector< unsigned int > &  elem_ids,
const Real &  value 
)
protectedinherited

Set an auxiliary elemental variable to a specified value

Parameters
[in]var_numvariable number
[in]elem_idselement IDs to set
[in]valuevalue to set

◆ getAuxVarNames()

const std::vector<std::string>& TallyBase::getAuxVarNames ( ) const
inlineinherited

Gets the auxvariable names for use in creating and storing tally results. This allows for the splitting of tally results into energy bins, angular bins, etc.

Returns
vector of variable names to be associated with this tally

◆ getMean()

const Real& TallyBase::getMean ( unsigned int  local_score) const
inlineinherited

Get the mean for a score summed over all bins.

Parameters
[in]local_scorethe index representing a tally score
Returns
mean for a score summed over all bins.

◆ getOutputs()

const std::vector<std::string>& TallyBase::getOutputs ( ) const
inlineinherited

Gets the output names to append to the end of the '_tally_name' when adding tally auxvariables for additional outputs.

Returns
additional tally outputs

◆ getScores()

const std::vector<std::string>& TallyBase::getScores ( ) const
inlineinherited

Get the list of scores this tally uses.

Returns
list of scores this tally uses

◆ getSum()

const Real& TallyBase::getSum ( unsigned int  local_score) const
inlineinherited

Get the sum for a score summed over all bins.

Parameters
[in]local_scorethe index representing a tally score
Returns
sum for a score summed over all bins.

◆ getTallyCells()

std::vector<OpenMCCellAverageProblem::cellInfo> CellTally::getTallyCells ( ) const
protected

Loop over all the OpenMC cells and find those for which we should add tallies.

Returns
cells to which we should add tallies

◆ getTallyEstimator()

openmc::TallyEstimator TallyBase::getTallyEstimator ( ) const
inlineinherited

Get the estimator used in this tally.

Returns
the tally estimator

◆ getWrappedTally()

const openmc::Tally* TallyBase::getWrappedTally ( ) const
inherited

Get the OpenMC tally that this object wraps.

Returns
the OpenMC tally object

◆ hasOutputs()

bool TallyBase::hasOutputs ( ) const
inlineinherited

Check to see if this tally adds additional output variables or not.

Returns
whether this tally adds additional output variables or not

◆ hasTrigger()

bool TallyBase::hasTrigger ( ) const
inlineinherited

Check to see if this tally uses a trigger or not.

Returns
whether this tally uses a trigger or not

◆ initializeTally()

virtual void TallyBase::initializeTally ( )
virtualinherited

A function to initialize the tally object. Override with care.

◆ relaxAndNormalizeTally()

void TallyBase::relaxAndNormalizeTally ( unsigned int  local_score,
const Real &  alpha,
const Real &  norm 
)
inherited

Relax the tally and normalize it according to some normalization factor 'norm'. This tends to either be the sum of the over all bins OR a global tally over the entire problem.

NOTE: This function relaxes the tally distribution, and not the actual magnitude of the sum. That is, we relax the shape distribution and then multiply it by the power (for k-eigenvalue) or source strength (for fixed source) of the current step before applying it to MOOSE. If the magnitude of the power or source strength is constant in time, there is zero error in this. But if the magnitude of the tally varies in time, we are basically relaxing the distribution of the tally, but then multiplying it by the current mean tally magnitude.

There will be very small errors in these approximations unless the power/source strength change dramatically with iteration. But because relaxation is itself a numerical approximation, this is still inconsequential at the end of the day as long as your problem has converged the relaxed tally to the raw (unrelaxed) tally.

Parameters
[in]local_scorethe local index of the current score to normalize
[in]alphathe relaxation factor
[in]normthe normalization factor

◆ renamesTallyVars()

bool TallyBase::renamesTallyVars ( ) const
inlineinherited

Check to see if the user has requested special names for the tallies.

Returns
whether this tally names stored values something other than '_tally_score'

◆ resetTally()

virtual void TallyBase::resetTally ( )
virtualinherited

A function to reset the tally object. Override with care.

Reimplemented in MeshTally.

◆ spatialFilter()

virtual std::pair<unsigned int, openmc::Filter *> CellTally::spatialFilter ( )
overridevirtual

A function to generate the cell filter needed by this object.

Returns
a pair where the first entry is the filter index in the global filter array and the second entry is an OpenMC distributed cell filter

Implements TallyBase.

◆ storeResults()

virtual Real CellTally::storeResults ( const std::vector< unsigned int > &  var_numbers,
unsigned int  local_score,
unsigned int  global_score,
const std::string &  output_type 
)
overridevirtual

A function which stores the results of this tally into the created auxvariables.

Parameters
[in]var_numbersvariables which the tally will store results in
[in]local_scoreindex into the tally's local array of scores which represents the current score being stored
[in]global_scoreindex into the global array of tally results which represents the current score being stored
[in]output_typethe output type

Implements TallyBase.

◆ validParams()

static InputParameters CellTally::validParams ( )
static

Member Data Documentation

◆ _aux

AuxiliarySystem& TallyBase::_aux
protectedinherited

The aux system.

◆ _cell_filter

openmc::CellInstanceFilter* CellTally::_cell_filter
protected

OpenMC mesh filter for this unstructured mesh tally.

◆ _cell_has_tally

std::map<OpenMCCellAverageProblem::cellInfo, bool> CellTally::_cell_has_tally
protected

Whether a cell index, instance pair should be added to the tally filter.

◆ _check_equal_mapped_tally_volumes

const bool& CellTally::_check_equal_mapped_tally_volumes
protected

Whether to check that the [Mesh] volume each cell tally maps to is identical. This is a useful helper function for OpenMC models where each cell tally has the same volume (often the case for many reactor geometries). If the OpenMC model cell tallies all are of the same spatial size, it's still possible that they can map to different volumes in the MOOSE mesh if the MOOSE elements don't line up with the edges of the OpenMC cells. Different volumes then can distort the volume normalization that we do to convert the fission power to a volumetric power (in a perfect world, we would actually divide OpenMC's tallies by the results of a stochastic volume calculation in OpenMC, but that is too expensive).

◆ _current_raw_tally

std::vector<xt::xtensor<double, 1> > TallyBase::_current_raw_tally
protectedinherited

Current "raw" tally output from Monte Carlo solution.

◆ _current_raw_tally_std_dev

std::vector<xt::xtensor<double, 1> > TallyBase::_current_raw_tally_std_dev
protectedinherited

Current "raw" tally standard deviation.

◆ _current_tally

std::vector<xt::xtensor<double, 1> > TallyBase::_current_tally
protectedinherited

Current fixed point iteration tally result; for instance, when using constant relaxation, the tally is updated as: q(n+1) = (1-a) * q(n) + a * PHI(q(n), s) where q(n+1) is _current_tally, a is the relaxation factor, q(n) is _previous_tally, and PHI is the most-recently-computed tally result (the _current_raw_tally).

◆ _equal_tally_volume_abs_tol

const Real& CellTally::_equal_tally_volume_abs_tol
protected

Absolute tolerance for checking equal tally mapped volumes.

◆ _estimator

openmc::TallyEstimator TallyBase::_estimator
protectedinherited

The OpenMC estimator to use with this tally.

◆ _filter_index

unsigned int TallyBase::_filter_index
protectedinherited

The index of the first filter added by this tally.

◆ _has_outputs

const bool TallyBase::_has_outputs
protectedinherited

Whether this tally has additional outputs or not.

◆ _local_mean_tally

std::vector<Real> TallyBase::_local_mean_tally
protectedinherited

Mean value of this tally across all bins; only used for fixed source mode. Indexed by score.

◆ _local_sum_tally

std::vector<Real> TallyBase::_local_sum_tally
protectedinherited

Sum value of this tally across all bins. Indexed by score.

◆ _local_tally

openmc::Tally* TallyBase::_local_tally = nullptr
protectedinherited

The OpenMC tally object this class wraps.

◆ _local_tally_index

unsigned int TallyBase::_local_tally_index
protectedinherited

The index of the OpenMC tally this object wraps.

◆ _mesh

MooseMesh& TallyBase::_mesh
protectedinherited

The MooseMesh.

◆ _openmc_problem

OpenMCCellAverageProblem& TallyBase::_openmc_problem
protectedinherited

The OpenMCCellAverageProblem using the tally system.

◆ _output_name

std::vector<std::string> TallyBase::_output_name
protectedinherited

Suffixes to apply to 'tally_name' in order to name the fields in the 'output'.

◆ _previous_tally

std::vector<xt::xtensor<double, 1> > TallyBase::_previous_tally
protectedinherited

Previous fixed point iteration tally result (after relaxation)

◆ _renames_tally_vars

const bool TallyBase::_renames_tally_vars
protectedinherited

Whether this tally stores results in variables names something other than '_tally_score'.

◆ _tally_blocks

std::unordered_set<SubdomainID> CellTally::_tally_blocks
protected

Blocks for which to add cell tallies.

◆ _tally_name

std::vector<std::string> TallyBase::_tally_name
protectedinherited

Auxiliary variable name(s) for this tally.

◆ _tally_score

std::vector<std::string> TallyBase::_tally_score
protectedinherited

OpenMC tally score(s) to use with this tally.

◆ _tally_trigger

const MultiMooseEnum* TallyBase::_tally_trigger
protectedinherited

Type of trigger to apply to OpenMC tallies to indicate when the simulation is complete. These can be used to on-the-fly adjust the number of active batches in order to reach some desired criteria (which is specified by this parameter).

◆ _tally_trigger_threshold

std::vector<Real> TallyBase::_tally_trigger_threshold
protectedinherited

Thresholds to use for accepting this tally when using triggers. Indexed by score.

◆ ZERO_TALLY_THRESHOLD

constexpr Real TallyBase::ZERO_TALLY_THRESHOLD = 1e-12
staticconstexprprotectedinherited

Tolerance for setting zero tally.


The documentation for this class was generated from the following file: