LCOV - code coverage report
Current view: top level - src/postprocessors - SideAverageValue.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 31 33 93.9 %
Date: 2026-05-29 20:35:17 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        8939 : SideAverageValue::validParams()
      16             : {
      17        8939 :   InputParameters params = SideIntegralVariablePostprocessor::validParams();
      18        8939 :   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        8939 :   return params;
      22           0 : }
      23             : 
      24        1457 : SideAverageValue::SideAverageValue(const InputParameters & parameters)
      25        1457 :   : SideIntegralVariablePostprocessor(parameters), _volume(0)
      26             : {
      27        1457 : }
      28             : 
      29             : void
      30       86728 : SideAverageValue::initialize()
      31             : {
      32       86728 :   SideIntegralVariablePostprocessor::initialize();
      33       86728 :   _volume = 0;
      34       86728 : }
      35             : 
      36             : void
      37      564881 : SideAverageValue::execute()
      38             : {
      39      564881 :   SideIntegralVariablePostprocessor::execute();
      40      564881 :   _volume += volume();
      41      564881 : }
      42             : 
      43             : Real
      44       79372 : SideAverageValue::getValue() const
      45             : {
      46       79372 :   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       79369 :   return _integral_value / _volume;
      56             : }
      57             : 
      58             : Real
      59      564801 : SideAverageValue::volume()
      60             : {
      61      564801 :   return _current_side_volume;
      62             : }
      63             : 
      64             : void
      65        7356 : SideAverageValue::threadJoin(const UserObject & y)
      66             : {
      67        7356 :   SideIntegralVariablePostprocessor::threadJoin(y);
      68        7356 :   const auto & pps = static_cast<const SideAverageValue &>(y);
      69        7356 :   _volume += pps._volume;
      70        7356 : }
      71             : 
      72             : void
      73       79372 : SideAverageValue::finalize()
      74             : {
      75       79372 :   gatherSum(_volume);
      76       79372 :   gatherSum(_integral_value);
      77       79372 : }

Generated by: LCOV version 1.14