LCOV - code coverage report
Current view: top level - src/postprocessors - InternalSideIntegralPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 31 31 100.0 %
Date: 2025-07-17 01:28:37 Functions: 8 8 100.0 %
Legend: Lines: hit not hit

          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       28651 : InternalSideIntegralPostprocessor::validParams()
      16             : {
      17       28651 :   InputParameters params = InternalSidePostprocessor::validParams();
      18       28651 :   return params;
      19             : }
      20             : 
      21          63 : InternalSideIntegralPostprocessor::InternalSideIntegralPostprocessor(
      22          63 :     const InputParameters & parameters)
      23          63 :   : InternalSidePostprocessor(parameters), _qp(0), _integral_value(0), _qp_integration(true)
      24             : {
      25          63 : }
      26             : 
      27             : void
      28          59 : InternalSideIntegralPostprocessor::initialize()
      29             : {
      30          59 :   _integral_value = 0;
      31          59 : }
      32             : 
      33             : void
      34        3180 : InternalSideIntegralPostprocessor::execute()
      35             : {
      36        3180 :   _integral_value += computeIntegral();
      37        3180 : }
      38             : 
      39             : Real
      40          54 : InternalSideIntegralPostprocessor::getValue() const
      41             : {
      42          54 :   return _integral_value;
      43             : }
      44             : 
      45             : void
      46           5 : InternalSideIntegralPostprocessor::threadJoin(const UserObject & y)
      47             : {
      48           5 :   const auto & pps = static_cast<const InternalSideIntegralPostprocessor &>(y);
      49           5 :   _integral_value += pps._integral_value;
      50           5 : }
      51             : 
      52             : Real
      53        3180 : InternalSideIntegralPostprocessor::computeIntegral()
      54             : {
      55        3180 :   Real sum = 0;
      56        3180 :   if (_qp_integration)
      57        5544 :     for (_qp = 0; _qp < _qrule->n_points(); _qp++)
      58        3804 :       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        3180 :   return sum;
      68             : }
      69             : 
      70             : void
      71          54 : InternalSideIntegralPostprocessor::finalize()
      72             : {
      73          54 :   gatherSum(_integral_value);
      74          54 : }

Generated by: LCOV version 1.14