LCOV - code coverage report
Current view: top level - src/postprocessors - InterfaceIntegralPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 31 32 96.9 %
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 "InterfaceIntegralPostprocessor.h"
      11             : 
      12             : #include "libmesh/quadrature.h"
      13             : 
      14             : InputParameters
      15       86531 : InterfaceIntegralPostprocessor::validParams()
      16             : {
      17       86531 :   InputParameters params = InterfacePostprocessor::validParams();
      18       86531 :   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       86531 :   return params;
      23           0 : }
      24             : 
      25         488 : InterfaceIntegralPostprocessor::InterfaceIntegralPostprocessor(const InputParameters & parameters)
      26         488 :   : InterfacePostprocessor(parameters), _qp(0), _integral_value(0)
      27             : {
      28         488 : }
      29             : 
      30             : void
      31         453 : InterfaceIntegralPostprocessor::initialize()
      32             : {
      33         453 :   InterfacePostprocessor::initialize();
      34         453 :   _integral_value = 0;
      35         453 : }
      36             : 
      37             : void
      38        2112 : InterfaceIntegralPostprocessor::execute()
      39             : {
      40        2112 :   InterfacePostprocessor::execute();
      41        2112 :   _integral_value += computeIntegral();
      42        2112 : }
      43             : 
      44             : Real
      45         394 : InterfaceIntegralPostprocessor::getValue() const
      46             : {
      47         394 :   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        2112 : InterfaceIntegralPostprocessor::computeIntegral()
      60             : {
      61        2112 :   Real sum = 0;
      62        5304 :   for (_qp = 0; _qp < _qrule->n_points(); _qp++)
      63        3192 :     sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
      64        2112 :   return sum;
      65             : }
      66             : 
      67             : void
      68         394 : InterfaceIntegralPostprocessor::finalize()
      69             : {
      70         394 :   InterfacePostprocessor::finalize();
      71         394 :   gatherSum(_integral_value);
      72         394 : }

Generated by: LCOV version 1.14