LCOV - code coverage report
Current view: top level - src/postprocessors - ElementH1SemiError.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 13 14 92.9 %
Date: 2025-07-17 01:28:37 Functions: 4 4 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 "ElementH1SemiError.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("MooseApp", ElementH1SemiError);
      14             : 
      15             : InputParameters
      16       15035 : ElementH1SemiError::validParams()
      17             : {
      18       15035 :   InputParameters params = ElementIntegralVariablePostprocessor::validParams();
      19       15035 :   params.addRequiredParam<FunctionName>("function", "The analytic solution to compare against");
      20       15035 :   params.addClassDescription("Returns the gradient difference norm part of the H1 error");
      21       15035 :   return params;
      22           0 : }
      23             : 
      24         399 : ElementH1SemiError::ElementH1SemiError(const InputParameters & parameters)
      25         399 :   : ElementIntegralVariablePostprocessor(parameters), _func(getFunction("function"))
      26             : {
      27         399 : }
      28             : 
      29             : Real
      30         463 : ElementH1SemiError::getValue() const
      31             : {
      32         463 :   return std::sqrt(ElementIntegralVariablePostprocessor::getValue());
      33             : }
      34             : 
      35             : Real
      36      519630 : ElementH1SemiError::computeQpIntegral()
      37             : {
      38      519630 :   RealGradient diff = _grad_u[_qp] - _func.gradient(_t, _q_point[_qp]);
      39     1039260 :   return diff * diff;
      40             : }

Generated by: LCOV version 1.14