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