LCOV - code coverage report
Current view: top level - src/postprocessors - ElementIntegralVariablePostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 39a256 Lines: 18 19 94.7 %
Date: 2026-07-14 14:36:17 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       98174 : ElementIntegralVariablePostprocessor::validParams()
      16             : {
      17       98174 :   InputParameters params = ElementIntegralPostprocessor::validParams();
      18      392696 :   params.addRequiredCoupledVar("variable", "The name of the variable that this object operates on");
      19      196348 :   params.addClassDescription("Computes a volume integral of the specified variable");
      20      196348 :   params.addParam<bool>(
      21      196348 :       "use_absolute_value", false, "Whether to use absolute value of the variable or not");
      22       98174 :   return params;
      23           0 : }
      24             : 
      25       20667 : ElementIntegralVariablePostprocessor::ElementIntegralVariablePostprocessor(
      26       20667 :     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       20667 :     _u(coupledValue("variable")),
      34       41334 :     _grad_u(coupledGradient("variable")),
      35      103335 :     _use_abs_value(getParam<bool>("use_absolute_value"))
      36             : {
      37       20667 :   addMooseVariableDependency(&mooseVariableField());
      38       20667 : }
      39             : 
      40             : Real
      41    31985460 : ElementIntegralVariablePostprocessor::computeQpIntegral()
      42             : {
      43    31985460 :   if (_use_abs_value)
      44         128 :     return std::abs(_u[_qp]);
      45             :   else
      46    31985332 :     return _u[_qp];
      47             : }

Generated by: LCOV version 1.14