ElementW1pError.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 */
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 "ElementW1pError.h"
16 #include "Function.h"
17
18 template <>
21 {
23  params.addRangeCheckedParam<Real>("p", 2.0, "p>=1", "The exponent used in the norm.");
24  params.addRequiredParam<FunctionName>("function", "The analytic solution to compare against");
25  return params;
26 }
27
30  _p(getParam<Real>("p")),
31  _func(getFunction("function"))
32 {
33 }
34
35 Real
37 {
38  return std::pow(ElementIntegralPostprocessor::getValue(), 1. / _p);
39 }
40
41 Real
43 {
45  Real funcdiff = _u[_qp] - _func.value(_t, _q_point[_qp]);
46
47  // Raise the absolute function value difference to the pth power
48  Real val = std::pow(std::abs(funcdiff), _p);
49
50  // Add all of the absolute gradient component differences to the pth power
51  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
53
54  return val;
55 }
Definition: Assembly.h:43
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
Function objects can optionally provide a gradient at a point.
Definition: Function.C:49
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...