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

Generated by: LCOV version 1.14