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 "SideIntegralPostprocessor.h" 11 : 12 : #include "libmesh/quadrature.h" 13 : 14 : InputParameters 15 435385 : SideIntegralPostprocessor::validParams() 16 : { 17 435385 : InputParameters params = SidePostprocessor::validParams(); 18 435385 : return params; 19 : } 20 : 21 3838 : SideIntegralPostprocessor::SideIntegralPostprocessor(const InputParameters & parameters) 22 3838 : : SidePostprocessor(parameters), _qp(0), _integral_value(0), _qp_integration(true) 23 : { 24 3838 : } 25 : 26 : void 27 3689 : SideIntegralPostprocessor::initialSetup() 28 : { 29 3689 : SidePostprocessor::initialSetup(); 30 : 31 3689 : if (!_qp_integration && _mesh.isFiniteVolumeInfoDirty()) 32 4 : errorNoFaceInfo(); 33 3685 : } 34 : 35 : void 36 65209 : SideIntegralPostprocessor::initialize() 37 : { 38 65209 : _integral_value = 0; 39 65209 : } 40 : 41 : void 42 487678 : SideIntegralPostprocessor::execute() 43 : { 44 487678 : _integral_value += computeIntegral(); 45 487675 : } 46 : 47 : Real 48 8553 : SideIntegralPostprocessor::getValue() const 49 : { 50 8553 : return _integral_value; 51 : } 52 : 53 : void 54 5262 : SideIntegralPostprocessor::threadJoin(const UserObject & y) 55 : { 56 5262 : const auto & pps = static_cast<const SideIntegralPostprocessor &>(y); 57 5262 : _integral_value += pps._integral_value; 58 5262 : } 59 : 60 : Real 61 487558 : SideIntegralPostprocessor::computeIntegral() 62 : { 63 487558 : Real sum = 0; 64 487558 : if (_qp_integration) 65 1394533 : for (_qp = 0; _qp < _qrule->n_points(); _qp++) 66 929482 : sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral(); 67 : else 68 : { 69 : // Finite volume functors integration is over FaceInfo, not quadrature points 70 22504 : getFaceInfos(); 71 : 72 46864 : for (auto & fi : _face_infos) 73 24360 : sum += fi->faceArea() * fi->faceCoord() * computeFaceInfoIntegral(fi); 74 : } 75 487555 : return sum; 76 : } 77 : 78 : void 79 8553 : SideIntegralPostprocessor::finalize() 80 : { 81 8553 : gatherSum(_integral_value); 82 8553 : }