Cardinal
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
TallyBase Class Referenceabstract

#include <TallyBase.h>

Inheritance diagram for TallyBase:
[legend]

Public Member Functions

 TallyBase (const InputParameters &parameters)
 
virtual std::pair< unsigned int, openmc::Filter * > spatialFilter ()=0
 
virtual void initializeTally ()
 
virtual void resetTally ()
 
virtual Real storeResults (const std::vector< unsigned int > &var_numbers, unsigned int local_score, unsigned int global_score, const std::string &output_type)=0
 
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 fillElementalAuxVariable (const unsigned int &var_num, const std::vector< unsigned int > &elem_ids, const Real &value)
 
void applyTriggersToLocalTally (openmc::Tally *tally)
 

Protected Attributes

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

◆ TallyBase()

TallyBase::TallyBase ( const InputParameters &  parameters)

Member Function Documentation

◆ addScore()

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

Add a score to this tally.

Parameters
[in]scorescore to add

◆ applyTriggersToLocalTally()

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

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

Parameters
[in]tallythe tally to apply triggers to

◆ computeSumAndMean()

void TallyBase::computeSumAndMean ( )

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 
)
protected

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
inline

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
inline

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
inline

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
inline

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
inline

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.

◆ getTallyEstimator()

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

Get the estimator used in this tally.

Returns
the tally estimator

◆ getWrappedTally()

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

Get the OpenMC tally that this object wraps.

Returns
the OpenMC tally object

◆ hasOutputs()

bool TallyBase::hasOutputs ( ) const
inline

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
inline

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 ( )
virtual

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

◆ relaxAndNormalizeTally()

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

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
inline

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 ( )
virtual

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

Reimplemented in MeshTally.

◆ spatialFilter()

virtual std::pair<unsigned int, openmc::Filter *> TallyBase::spatialFilter ( )
pure virtual

A function which the derivied tally must override to create the OpenMC spatial filter the object maps to.

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

Implemented in CellTally, and MeshTally.

◆ storeResults()

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

A function which stores the results of this tally into the created auxvariables. This must be implemented by a derived class.

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

Implemented in MeshTally, and CellTally.

◆ validParams()

static InputParameters TallyBase::validParams ( )
static

Member Data Documentation

◆ _aux

AuxiliarySystem& TallyBase::_aux
protected

The aux system.

◆ _current_raw_tally

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

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
protected

Current "raw" tally standard deviation.

◆ _current_tally

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

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).

◆ _estimator

openmc::TallyEstimator TallyBase::_estimator
protected

The OpenMC estimator to use with this tally.

◆ _filter_index

unsigned int TallyBase::_filter_index
protected

The index of the first filter added by this tally.

◆ _has_outputs

const bool TallyBase::_has_outputs
protected

Whether this tally has additional outputs or not.

◆ _local_mean_tally

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

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
protected

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

◆ _local_tally

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

The OpenMC tally object this class wraps.

◆ _local_tally_index

unsigned int TallyBase::_local_tally_index
protected

The index of the OpenMC tally this object wraps.

◆ _mesh

MooseMesh& TallyBase::_mesh
protected

The MooseMesh.

◆ _openmc_problem

OpenMCCellAverageProblem& TallyBase::_openmc_problem
protected

The OpenMCCellAverageProblem using the tally system.

◆ _output_name

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

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
protected

Previous fixed point iteration tally result (after relaxation)

◆ _renames_tally_vars

const bool TallyBase::_renames_tally_vars
protected

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

◆ _tally_name

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

Auxiliary variable name(s) for this tally.

◆ _tally_score

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

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

◆ _tally_trigger

const MultiMooseEnum* TallyBase::_tally_trigger
protected

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
protected

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

◆ ZERO_TALLY_THRESHOLD

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

Tolerance for setting zero tally.


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