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

Generated by: LCOV version 1.14