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 "ElementL1Error.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("MooseApp", ElementL1Error); 14 : 15 : InputParameters 16 14399 : ElementL1Error::validParams() 17 : { 18 14399 : InputParameters params = ElementIntegralVariablePostprocessor::validParams(); 19 14399 : params.addClassDescription( 20 : "Computes L1 error between an elemental field variable and an analytical function."); 21 14399 : params.addRequiredParam<FunctionName>("function", "The analytic solution to compare against"); 22 14399 : return params; 23 0 : } 24 : 25 70 : ElementL1Error::ElementL1Error(const InputParameters & parameters) 26 70 : : ElementIntegralVariablePostprocessor(parameters), _func(getFunction("function")) 27 : { 28 70 : } 29 : 30 : Real 31 26096 : ElementL1Error::computeQpIntegral() 32 : { 33 26096 : return std::abs(_u[_qp] - _func.value(_t, _q_point[_qp])); 34 : }