LCOV - code coverage report
Current view: top level - src/postprocessors - InterfaceIntegralPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 31 32 96.9 %
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 "InterfaceIntegralPostprocessor.h"
      11             : 
      12             : #include "libmesh/quadrature.h"
      13             : 
      14             : InputParameters
      15       86461 : InterfaceIntegralPostprocessor::validParams()
      16             : {
      17       86461 :   InputParameters params = InterfacePostprocessor::validParams();
      18       86461 :   params.addClassDescription(
      19             :       "Postprocessor class adding basic capabilities to compute an integral over an interface. "
      20             :       "This class is still abstract, refer to InterfaceIntegralVariableValuePostprocessor for a "
      21             :       "derived class example");
      22       86461 :   return params;
      23           0 : }
      24             : 
      25         453 : InterfaceIntegralPostprocessor::InterfaceIntegralPostprocessor(const InputParameters & parameters)
      26         453 :   : InterfacePostprocessor(parameters), _qp(0), _integral_value(0)
      27             : {
      28         453 : }
      29             : 
      30             : void
      31         418 : InterfaceIntegralPostprocessor::initialize()
      32             : {
      33         418 :   InterfacePostprocessor::initialize();
      34         418 :   _integral_value = 0;
      35         418 : }
      36             : 
      37             : void
      38        1877 : InterfaceIntegralPostprocessor::execute()
      39             : {
      40        1877 :   InterfacePostprocessor::execute();
      41        1877 :   _integral_value += computeIntegral();
      42        1877 : }
      43             : 
      44             : Real
      45         361 : InterfaceIntegralPostprocessor::getValue() const
      46             : {
      47         361 :   return _integral_value;
      48             : }
      49             : 
      50             : void
      51          35 : InterfaceIntegralPostprocessor::threadJoin(const UserObject & y)
      52             : {
      53          35 :   InterfacePostprocessor::threadJoin(y);
      54          35 :   const auto & pps = static_cast<const InterfaceIntegralPostprocessor &>(y);
      55          35 :   _integral_value += pps._integral_value;
      56          35 : }
      57             : 
      58             : Real
      59        1877 : InterfaceIntegralPostprocessor::computeIntegral()
      60             : {
      61        1877 :   Real sum = 0;
      62        4713 :   for (_qp = 0; _qp < _qrule->n_points(); _qp++)
      63        2836 :     sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
      64        1877 :   return sum;
      65             : }
      66             : 
      67             : void
      68         361 : InterfaceIntegralPostprocessor::finalize()
      69             : {
      70         361 :   InterfacePostprocessor::finalize();
      71         361 :   gatherSum(_integral_value);
      72         361 : }

Generated by: LCOV version 1.14