www.mooseframework.org
ElementL2ErrorFunctionAux.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 // MOOSE includes
17 #include "Function.h"
18 
19 template <>
22 {
24  params.addClassDescription("A class for computing the element-wise L^2 (Euclidean) error between "
25  "a function and a coupled variable.");
26  params.addRequiredParam<FunctionName>("function", "Function representing the exact solution");
27  return params;
28 }
29 
31  : ElementLpNormAux(parameters), _func(getFunction("function"))
32 {
33 }
34 
35 Real
37 {
38  return _func.value(_t, _q_point[_qp]) - _coupled_var[_qp];
39 }
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
Compute an elemental field variable (single value per element) equal to the Lp-norm of a coupled Vari...
virtual Real computeValue() override
Returns the difference between the solution variable and the exact solution Function.
const MooseArray< Point > & _q_point
Dimension of the problem being solved.
Definition: AuxKernel.h:159
InputParameters validParams< ElementLpNormAux >()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const VariableValue & _coupled_var
A reference to the variable to compute the norm of.
ElementL2ErrorFunctionAux(const InputParameters &parameters)
Class constructor.
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...
Function & _func
Function representing the exact solution.
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:192
InputParameters validParams< ElementL2ErrorFunctionAux >()
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...