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 "SideAverageValue.h" 11 : 12 : registerMooseObject("MooseApp", SideAverageValue); 13 : 14 : InputParameters 15 31350 : SideAverageValue::validParams() 16 : { 17 31350 : InputParameters params = SideIntegralVariablePostprocessor::validParams(); 18 31350 : params.addClassDescription("Computes the average value of a variable on a " 19 : "sideset. Note that this cannot be used on the " 20 : "centerline of an axisymmetric model."); 21 31350 : return params; 22 0 : } 23 : 24 1457 : SideAverageValue::SideAverageValue(const InputParameters & parameters) 25 1457 : : SideIntegralVariablePostprocessor(parameters), _volume(0) 26 : { 27 1457 : } 28 : 29 : void 30 55581 : SideAverageValue::initialize() 31 : { 32 55581 : SideIntegralVariablePostprocessor::initialize(); 33 55581 : _volume = 0; 34 55581 : } 35 : 36 : void 37 359004 : SideAverageValue::execute() 38 : { 39 359004 : SideIntegralVariablePostprocessor::execute(); 40 359004 : _volume += volume(); 41 359004 : } 42 : 43 : Real 44 50857 : SideAverageValue::getValue() const 45 : { 46 50857 : if (MooseUtils::absoluteFuzzyEqual(_volume, 0.0)) 47 : { 48 4 : if (_coord_sys == Moose::COORD_RZ) 49 4 : mooseError("The total area of the boundary is zero. This could be due to " 50 : "using a boundary on the centerline of an axisymmetric model."); 51 : else 52 0 : mooseError("The total area of the boundary is zero."); 53 : } 54 : 55 50853 : return _integral_value / _volume; 56 : } 57 : 58 : Real 59 358924 : SideAverageValue::volume() 60 : { 61 358924 : return _current_side_volume; 62 : } 63 : 64 : void 65 4724 : SideAverageValue::threadJoin(const UserObject & y) 66 : { 67 4724 : SideIntegralVariablePostprocessor::threadJoin(y); 68 4724 : const auto & pps = static_cast<const SideAverageValue &>(y); 69 4724 : _volume += pps._volume; 70 4724 : } 71 : 72 : void 73 50857 : SideAverageValue::finalize() 74 : { 75 50857 : gatherSum(_volume); 76 50857 : gatherSum(_integral_value); 77 50857 : }