www.mooseframework.org
ElementL2Error.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "ElementL2Error.h"
16 #include "Function.h"
17 
18 template <>
21 {
23  params.addRequiredParam<FunctionName>("function", "The analytic solution to compare against");
24  return params;
25 }
26 
28  : ElementIntegralVariablePostprocessor(parameters), _func(getFunction("function"))
29 {
30 }
31 
32 Real
34 {
35  return std::sqrt(ElementIntegralPostprocessor::getValue());
36 }
37 
38 Real
40 {
41  Real diff = _u[_qp] - _func.value(_t, _q_point[_qp]);
42  return diff * diff;
43 }
virtual Real getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
virtual Real value(Real t, const Point &p)
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero...
Definition: Function.C:43
const MooseArray< Point > & _q_point
This postprocessor computes a volume integral of the specified variable.
virtual Real getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
InputParameters validParams< ElementL2Error >()
const VariableValue & _u
Holds the solution at current quadrature points.
ElementL2Error(const InputParameters &parameters)
InputParameters validParams< ElementIntegralVariablePostprocessor >()
Function & _func
virtual Real computeQpIntegral() override