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

#include <MeshTally.h>

Inheritance diagram for MeshTally:
[legend]

Public Member Functions

 MeshTally (const InputParameters &parameters)
 
virtual std::pair< unsigned int, openmc::Filter * > spatialFilter () override
 
virtual void resetTally () override
 A function to reset the tally. MeshTally overrides this function to delete the OpenMC mesh. More...
 
virtual void initializeTally ()
 
Real storeResults (const std::vector< unsigned int > &var_numbers, unsigned int local_score, unsigned int global_score, const std::string &output_type)
 
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
 
unsigned int numExtFilterBins () const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual Real storeResultsInner (const std::vector< unsigned int > &var_numbers, unsigned int local_score, unsigned int global_score, std::vector< xt::xtensor< double, 1 >> tally_vals) override
 
void checkMeshTemplateAndTranslations () 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

const std::string * _mesh_template_filename = nullptr
 
Point _mesh_translation
 The translation to apply to the mesh template. More...
 
unsigned int _instance
 The index into an array of mesh translations. More...
 
unsigned int _mesh_index
 The index of the mesh added by this tally. More...
 
openmc::MeshFilter * _mesh_filter
 OpenMC mesh filter for this unstructured mesh tally. More...
 
const openmc::LibMesh * _mesh_template
 OpenMC unstructured mesh instance for use with mesh tallies. More...
 
OpenMCCellAverageProblem_openmc_problem
 The OpenMCCellAverageProblem using the tally system. More...
 
MooseMesh & _mesh
 The MooseMesh. More...
 
AuxiliarySystem & _aux
 The aux system. More...
 
std::vector< std::shared_ptr< FilterBase > > _ext_filters
 The external filters added in the [Problem/Filters] block. 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...
 
unsigned int _num_ext_filter_bins = 1
 The number of non-spatial bins in 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< bool > _trigger_ignore_zeros
 
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

◆ MeshTally()

MeshTally::MeshTally ( 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

◆ checkMeshTemplateAndTranslations()

void MeshTally::checkMeshTemplateAndTranslations ( ) const
protected

Check the setup of the mesh template and translations. Because a simple copy transfer is used to write a mesh tally onto the [Mesh], we require that the meshes are identical - both in terms of the element ordering and the actual dimensions of each element. This function performs as many checks as possible to ensure that the meshes are indeed identical.

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

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

◆ numExtFilterBins()

unsigned int TallyBase::numExtFilterBins ( ) const
inlineinherited

Get the total number of external filter bins applied to this tally.

Returns
the total number of external filter bins.

◆ 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 MeshTally::resetTally ( )
overridevirtual

A function to reset the tally. MeshTally overrides this function to delete the OpenMC mesh.

Reimplemented from TallyBase.

◆ spatialFilter()

virtual std::pair<unsigned int, openmc::Filter *> MeshTally::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 unstructured mesh filter

Implements TallyBase.

◆ storeResults()

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

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

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
Returns
the sum of the tally over all bins. Only applicable for 'output_type = relaxed'

◆ storeResultsInner()

virtual Real MeshTally::storeResultsInner ( const std::vector< unsigned int > &  var_numbers,
unsigned int  local_score,
unsigned int  global_score,
std::vector< xt::xtensor< double, 1 >>  tally_vals 
)
overrideprotectedvirtual

A function which stores the results of this tally into the created auxvariables. This implements the copy transfer between the tally mesh and the MOOSE mesh.

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]tally_valsthe tally values to store
Returns
the sum of the tally over all bins.

Implements TallyBase.

◆ validParams()

static InputParameters MeshTally::validParams ( )
static

Member Data Documentation

◆ _aux

AuxiliarySystem& TallyBase::_aux
protectedinherited

The aux system.

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

◆ _estimator

openmc::TallyEstimator TallyBase::_estimator
protectedinherited

The OpenMC estimator to use with this tally.

◆ _ext_filters

std::vector<std::shared_ptr<FilterBase> > TallyBase::_ext_filters
protectedinherited

The external filters added in the [Problem/Filters] block.

◆ _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.

◆ _instance

unsigned int MeshTally::_instance
protected

The index into an array of mesh translations.

◆ _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.

◆ _mesh_filter

openmc::MeshFilter* MeshTally::_mesh_filter
protected

OpenMC mesh filter for this unstructured mesh tally.

◆ _mesh_index

unsigned int MeshTally::_mesh_index
protected

The index of the mesh added by this tally.

◆ _mesh_template

const openmc::LibMesh* MeshTally::_mesh_template
protected

OpenMC unstructured mesh instance for use with mesh tallies.

◆ _mesh_template_filename

const std::string* MeshTally::_mesh_template_filename = nullptr
protected

Mesh template file to use for creating mesh tallies in OpenMC; currently, this mesh must be identical to the mesh used in the [Mesh] block because a simple copy transfer is used to extract the tallies and put on the application's mesh in preparation for a transfer to another MOOSE app. If not set, this indicates that tallying will be performed directly on the [Mesh]. TODO: allow the mesh to not be identical, both in terms of using different units and more general differences like not having a particular phase present

◆ _mesh_translation

Point MeshTally::_mesh_translation
protected

The translation to apply to the mesh template.

◆ _num_ext_filter_bins

unsigned int TallyBase::_num_ext_filter_bins = 1
protectedinherited

The number of non-spatial bins in this tally.

◆ _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_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.

◆ _trigger_ignore_zeros

std::vector<bool> TallyBase::_trigger_ignore_zeros
protectedinherited

Whether tally bins for certain scores should ignore bins with zeros when computing trigger metrics. Indexed by the tally score.

◆ ZERO_TALLY_THRESHOLD

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

Tolerance for setting zero tally.


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