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