LCOV - code coverage report
Current view: top level - src/postprocessors - InternalSideIntegralPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 31 31 100.0 %
Date: 2025-08-08 20:01:16 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       28659 : InternalSideIntegralPostprocessor::validParams()
      16             : {
      17       28659 :   InputParameters params = InternalSidePostprocessor::validParams();
      18       28659 :   return params;
      19             : }
      20             : 
      21          67 : InternalSideIntegralPostprocessor::InternalSideIntegralPostprocessor(
      22          67 :     const InputParameters & parameters)
      23          67 :   : InternalSidePostprocessor(parameters), _qp(0), _integral_value(0), _qp_integration(true)
      24             : {
      25          67 : }
      26             : 
      27             : void
      28          63 : InternalSideIntegralPostprocessor::initialize()
      29             : {
      30          63 :   _integral_value = 0;
      31          63 : }
      32             : 
      33             : void
      34        3567 : InternalSideIntegralPostprocessor::execute()
      35             : {
      36        3567 :   _integral_value += computeIntegral();
      37        3567 : }
      38             : 
      39             : Real
      40          58 : InternalSideIntegralPostprocessor::getValue() const
      41             : {
      42          58 :   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        3567 : InternalSideIntegralPostprocessor::computeIntegral()
      54             : {
      55        3567 :   Real sum = 0;
      56        3567 :   if (_qp_integration)
      57        6174 :     for (_qp = 0; _qp < _qrule->n_points(); _qp++)
      58        4227 :       sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
      59             :   else
      60             :   {
      61             :     // Finite volume functors integration is over FaceInfo, not quadrature points
      62        1620 :     getFaceInfos();
      63             : 
      64        3240 :     for (auto & fi : _face_infos)
      65        1620 :       sum += fi->faceArea() * fi->faceCoord() * computeFaceInfoIntegral(fi);
      66             :   }
      67        3567 :   return sum;
      68             : }
      69             : 
      70             : void
      71          58 : InternalSideIntegralPostprocessor::finalize()
      72             : {
      73          58 :   gatherSum(_integral_value);
      74          58 : }

Generated by: LCOV version 1.14