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 "AnalyticalIndicator.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("MooseApp", AnalyticalIndicator); 14 : 15 : InputParameters 16 14461 : AnalyticalIndicator::validParams() 17 : { 18 14461 : InputParameters params = ElementIntegralIndicator::validParams(); 19 14461 : params.addRequiredParam<FunctionName>("function", "The analytic solution to compare against"); 20 14461 : params.addClassDescription("Compute the square of the error as the difference between an unknown " 21 : "variable and an analytical solution."); 22 14461 : return params; 23 0 : } 24 : 25 102 : AnalyticalIndicator::AnalyticalIndicator(const InputParameters & parameters) 26 102 : : ElementIntegralIndicator(parameters), _func(getFunction("function")) 27 : { 28 102 : } 29 : 30 : Real 31 144944 : AnalyticalIndicator::computeQpIntegral() 32 : { 33 144944 : Real diff = _u[_qp] - _func.value(_t, _q_point[_qp]); 34 144944 : return diff * diff; 35 : }