LCOV - code coverage report
Current view: top level - src/postprocessors - ElementL2Error.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 13 14 92.9 %
Date: 2026-05-29 20:35:17 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 "ElementL2Error.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("MooseApp", ElementL2Error);
      14             : 
      15             : InputParameters
      16       10544 : ElementL2Error::validParams()
      17             : {
      18       10544 :   InputParameters params = ElementIntegralVariablePostprocessor::validParams();
      19       42176 :   params.addRequiredParam<FunctionName>("function", "The analytic solution to compare against");
      20       10544 :   params.addClassDescription(
      21             :       "Computes L2 error between a field variable and an analytical function");
      22       10544 :   return params;
      23           0 : }
      24             : 
      25        3861 : ElementL2Error::ElementL2Error(const InputParameters & parameters)
      26        7722 :   : ElementIntegralVariablePostprocessor(parameters), _func(getFunction("function"))
      27             : {
      28        3861 : }
      29             : 
      30             : Real
      31       17322 : ElementL2Error::getValue() const
      32             : {
      33       17322 :   return std::sqrt(ElementIntegralPostprocessor::getValue());
      34             : }
      35             : 
      36             : Real
      37     7587986 : ElementL2Error::computeQpIntegral()
      38             : {
      39     7587986 :   Real diff = _u[_qp] - _func.value(_t, _q_point[_qp]);
      40     7587986 :   return diff * diff;
      41             : }

Generated by: LCOV version 1.14