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