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 "SideIntegralUserObject.h" 11 : 12 : #include "libmesh/quadrature.h" 13 : 14 : InputParameters 15 258780 : SideIntegralUserObject::validParams() 16 : { 17 258780 : InputParameters params = SideUserObject::validParams(); 18 258780 : return params; 19 : } 20 : 21 870 : SideIntegralUserObject::SideIntegralUserObject(const InputParameters & parameters) 22 870 : : SideUserObject(parameters), _qp(0), _integral_value(0) 23 : { 24 870 : } 25 : 26 : void 27 3710 : SideIntegralUserObject::initialize() 28 : { 29 3710 : _integral_value = 0; 30 3710 : } 31 : 32 : void 33 0 : SideIntegralUserObject::execute() 34 : { 35 0 : _integral_value += computeIntegral(); 36 0 : } 37 : 38 : void 39 0 : SideIntegralUserObject::finalize() 40 : { 41 0 : gatherSum(_integral_value); 42 0 : } 43 : 44 : Real 45 0 : SideIntegralUserObject::getValue() const 46 : { 47 0 : return _integral_value; 48 : } 49 : 50 : void 51 291 : SideIntegralUserObject::threadJoin(const UserObject & y) 52 : { 53 291 : const auto & pps = static_cast<const SideIntegralUserObject &>(y); 54 291 : _integral_value += pps._integral_value; 55 291 : } 56 : 57 : Real 58 139892 : SideIntegralUserObject::computeIntegral() 59 : { 60 139892 : Real sum = 0; 61 605848 : for (_qp = 0; _qp < _qrule->n_points(); _qp++) 62 465956 : sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral(); 63 139892 : return sum; 64 : }