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 "InternalSideIntegralPostprocessor.h" 11 : 12 : #include "libmesh/quadrature.h" 13 : 14 : InputParameters 15 6191 : InternalSideIntegralPostprocessor::validParams() 16 : { 17 6191 : InputParameters params = InternalSidePostprocessor::validParams(); 18 6191 : return params; 19 : } 20 : 21 36 : InternalSideIntegralPostprocessor::InternalSideIntegralPostprocessor( 22 36 : const InputParameters & parameters) 23 36 : : InternalSidePostprocessor(parameters), _qp(0), _integral_value(0), _qp_integration(true) 24 : { 25 36 : } 26 : 27 : void 28 34 : InternalSideIntegralPostprocessor::initialize() 29 : { 30 34 : _integral_value = 0; 31 34 : } 32 : 33 : void 34 2952 : InternalSideIntegralPostprocessor::execute() 35 : { 36 2952 : _integral_value += computeIntegral(); 37 2952 : } 38 : 39 : Real 40 31 : InternalSideIntegralPostprocessor::getValue() const 41 : { 42 31 : return _integral_value; 43 : } 44 : 45 : void 46 3 : InternalSideIntegralPostprocessor::threadJoin(const UserObject & y) 47 : { 48 3 : const auto & pps = static_cast<const InternalSideIntegralPostprocessor &>(y); 49 3 : _integral_value += pps._integral_value; 50 3 : } 51 : 52 : Real 53 2952 : InternalSideIntegralPostprocessor::computeIntegral() 54 : { 55 2952 : Real sum = 0; 56 2952 : if (_qp_integration) 57 4752 : for (_qp = 0; _qp < _qrule->n_points(); _qp++) 58 3240 : sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral(); 59 : else 60 : { 61 : // Finite volume functors integration is over FaceInfo, not quadrature points 62 1440 : getFaceInfos(); 63 : 64 2880 : for (auto & fi : _face_infos) 65 1440 : sum += fi->faceArea() * fi->faceCoord() * computeFaceInfoIntegral(fi); 66 : } 67 2952 : return sum; 68 : } 69 : 70 : void 71 31 : InternalSideIntegralPostprocessor::finalize() 72 : { 73 31 : gatherSum(_integral_value); 74 31 : }