LCOV - code coverage report
Current view: top level - src/postprocessors - SideAverageValue.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 9a5f1f Lines: 31 33 93.9 %
Date: 2026-06-21 21:23:42 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 "SideAverageValue.h"
      11             : 
      12             : registerMooseObject("MooseApp", SideAverageValue);
      13             : 
      14             : InputParameters
      15        9115 : SideAverageValue::validParams()
      16             : {
      17        9115 :   InputParameters params = SideIntegralVariablePostprocessor::validParams();
      18        9115 :   params.addClassDescription("Computes the average value of a variable on a "
      19             :                              "sideset. Note that this cannot be used on the "
      20             :                              "centerline of an axisymmetric model.");
      21        9115 :   return params;
      22           0 : }
      23             : 
      24        1549 : SideAverageValue::SideAverageValue(const InputParameters & parameters)
      25        1549 :   : SideIntegralVariablePostprocessor(parameters), _volume(0)
      26             : {
      27        1549 : }
      28             : 
      29             : void
      30       86816 : SideAverageValue::initialize()
      31             : {
      32       86816 :   SideIntegralVariablePostprocessor::initialize();
      33       86816 :   _volume = 0;
      34       86816 : }
      35             : 
      36             : void
      37      565105 : SideAverageValue::execute()
      38             : {
      39      565105 :   SideIntegralVariablePostprocessor::execute();
      40      565105 :   _volume += volume();
      41      565105 : }
      42             : 
      43             : Real
      44       79452 : SideAverageValue::getValue() const
      45             : {
      46       79452 :   if (MooseUtils::absoluteFuzzyEqual(_volume, 0.0))
      47             :   {
      48           3 :     if (_coord_sys == Moose::COORD_RZ)
      49           3 :       mooseError("The total area of the boundary is zero. This could be due to "
      50             :                  "using a boundary on the centerline of an axisymmetric model.");
      51             :     else
      52           0 :       mooseError("The total area of the boundary is zero.");
      53             :   }
      54             : 
      55       79449 :   return _integral_value / _volume;
      56             : }
      57             : 
      58             : Real
      59      565025 : SideAverageValue::volume()
      60             : {
      61      565025 :   return _current_side_volume;
      62             : }
      63             : 
      64             : void
      65        7364 : SideAverageValue::threadJoin(const UserObject & y)
      66             : {
      67        7364 :   SideIntegralVariablePostprocessor::threadJoin(y);
      68        7364 :   const auto & pps = static_cast<const SideAverageValue &>(y);
      69        7364 :   _volume += pps._volume;
      70        7364 : }
      71             : 
      72             : void
      73       79452 : SideAverageValue::finalize()
      74             : {
      75       79452 :   gatherSum(_volume);
      76       79452 :   gatherSum(_integral_value);
      77       79452 : }

Generated by: LCOV version 1.14