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 "ElementAverageValue.h" 11 : 12 : registerMooseObject("MooseApp", ElementAverageValue); 13 : 14 : InputParameters 15 84607 : ElementAverageValue::validParams() 16 : { 17 84607 : InputParameters params = ElementIntegralVariablePostprocessor::validParams(); 18 84607 : params.addClassDescription("Computes the volumetric average of a variable"); 19 84607 : return params; 20 0 : } 21 : 22 6866 : ElementAverageValue::ElementAverageValue(const InputParameters & parameters) 23 6866 : : ElementIntegralVariablePostprocessor(parameters), _volume(0) 24 : { 25 6866 : } 26 : 27 : void 28 88445 : ElementAverageValue::initialize() 29 : { 30 88445 : ElementIntegralVariablePostprocessor::initialize(); 31 88445 : _volume = 0; 32 88445 : } 33 : 34 : void 35 5271408 : ElementAverageValue::execute() 36 : { 37 5271408 : ElementIntegralVariablePostprocessor::execute(); 38 5271408 : _volume += _current_elem_volume; 39 5271408 : } 40 : 41 : Real 42 81243 : ElementAverageValue::getValue() const 43 : { 44 81243 : return _integral_value / _volume; 45 : } 46 : 47 : void 48 81243 : ElementAverageValue::finalize() 49 : { 50 81243 : gatherSum(_volume); 51 81243 : gatherSum(_integral_value); 52 81243 : } 53 : 54 : void 55 7202 : ElementAverageValue::threadJoin(const UserObject & y) 56 : { 57 7202 : ElementIntegralVariablePostprocessor::threadJoin(y); 58 7202 : const auto & pps = static_cast<const ElementAverageValue &>(y); 59 7202 : _volume += pps._volume; 60 7202 : }