Line data Source code
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 : 10 : #include "ElementVariableStatistics.h" 11 : 12 : registerMooseObject("MooseApp", ElementVariableStatistics); 13 : 14 : InputParameters 15 14290 : ElementVariableStatistics::validParams() 16 : { 17 14290 : InputParameters params = ElementStatistics::validParams(); 18 : 19 14290 : params.addRequiredCoupledVar("coupled_var", "Coupled variable whose value is used."); 20 : 21 14290 : params.addClassDescription("Element reporter to get statistics for a coupled variable. This can " 22 : "be transfered to other apps."); 23 14290 : return params; 24 0 : } 25 : 26 13 : ElementVariableStatistics::ElementVariableStatistics(const InputParameters & parameters) 27 13 : : ElementStatistics(parameters), _v(coupledValue("coupled_var")) 28 : { 29 13 : } 30 : 31 : Real 32 800 : ElementVariableStatistics::computeValue() 33 : { 34 800 : Real avg_val = 0; 35 : 36 4000 : for (unsigned int qp = 0; qp < _qrule->n_points(); ++qp) 37 3200 : avg_val += _v[qp] * _JxW[qp] * _coord[qp]; 38 800 : avg_val /= _current_elem_volume; 39 : 40 800 : return avg_val; 41 : }