LCOV - code coverage report
Current view: top level - src/postprocessors - ElementIntegralVariablePostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #33187 (5aa0b2) with base d7c4bd Lines: 18 19 94.7 %
Date: 2026-06-30 12:18:20 Functions: 3 3 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 "ElementIntegralVariablePostprocessor.h"
      11             : 
      12             : registerMooseObject("MooseApp", ElementIntegralVariablePostprocessor);
      13             : 
      14             : InputParameters
      15       97704 : ElementIntegralVariablePostprocessor::validParams()
      16             : {
      17       97704 :   InputParameters params = ElementIntegralPostprocessor::validParams();
      18      390816 :   params.addRequiredCoupledVar("variable", "The name of the variable that this object operates on");
      19      195408 :   params.addClassDescription("Computes a volume integral of the specified variable");
      20      195408 :   params.addParam<bool>(
      21      195408 :       "use_absolute_value", false, "Whether to use absolute value of the variable or not");
      22       97704 :   return params;
      23           0 : }
      24             : 
      25       20421 : ElementIntegralVariablePostprocessor::ElementIntegralVariablePostprocessor(
      26       20421 :     const InputParameters & parameters)
      27             :   : ElementIntegralPostprocessor(parameters),
      28             :     MooseVariableInterface<Real>(this,
      29             :                                  false,
      30             :                                  "variable",
      31             :                                  Moose::VarKindType::VAR_ANY,
      32             :                                  Moose::VarFieldType::VAR_FIELD_STANDARD),
      33       20421 :     _u(coupledValue("variable")),
      34       40842 :     _grad_u(coupledGradient("variable")),
      35      102105 :     _use_abs_value(getParam<bool>("use_absolute_value"))
      36             : {
      37       20421 :   addMooseVariableDependency(&mooseVariableField());
      38       20421 : }
      39             : 
      40             : Real
      41    31985316 : ElementIntegralVariablePostprocessor::computeQpIntegral()
      42             : {
      43    31985316 :   if (_use_abs_value)
      44         128 :     return std::abs(_u[_qp]);
      45             :   else
      46    31985188 :     return _u[_qp];
      47             : }

Generated by: LCOV version 1.14