https://mooseframework.inl.gov
ElementVariableStatistics.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 
13 
16 {
18 
19  params.addRequiredCoupledVar("coupled_var", "Coupled variable whose value is used.");
20 
21  params.addClassDescription("Element reporter to get statistics for a coupled variable. This can "
22  "be transfered to other apps.");
23  return params;
24 }
25 
27  : ElementStatistics(parameters), _v(coupledValue("coupled_var"))
28 {
29 }
30 
31 Real
33 {
34  Real avg_val = 0;
35 
36  for (unsigned int qp = 0; qp < _qrule->n_points(); ++qp)
37  avg_val += _v[qp] * _JxW[qp] * _coord[qp];
38  avg_val /= _current_elem_volume;
39 
40  return avg_val;
41 }
static InputParameters validParams()
const MooseArray< Real > & _coord
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
registerMooseObject("MooseApp", ElementVariableStatistics)
const VariableValue & _v
The coupled variable used.
const Real & _current_elem_volume
The current element volume (available during execute())
ElementVariableStatistics(const InputParameters &parameters)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const QBase *const & _qrule
const MooseArray< Real > & _JxW
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
virtual Real computeValue() override