www.mooseframework.org
NodalL2Error.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 "NodalL2Error.h"
16 #include "Function.h"
17 
18 template <>
21 {
23  params.addRequiredParam<FunctionName>("function", "The analytic solution to compare against");
24 
25  return params;
26 }
27 
29  : NodalVariablePostprocessor(parameters), _func(getFunction("function"))
30 {
31 }
32 
33 void
35 {
36  _integral_value = 0.;
37 }
38 
39 void
41 {
42  Real diff = _u[0] - _func.value(_t, *_current_node);
43  _integral_value += diff * diff;
44 }
45 
46 Real
48 {
50  return std::sqrt(_integral_value);
51 }
52 
53 void
55 {
56  const NodalL2Error & pps = static_cast<const NodalL2Error &>(y);
58 }
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 Node *& _current_node
Reference to current node pointer.
This is a base class for other classes which compute post-processed values based on nodal solution va...
Real _integral_value
Definition: NodalL2Error.h:39
InputParameters validParams< NodalL2Error >()
Definition: NodalL2Error.C:20
NodalL2Error(const InputParameters &parameters)
Definition: NodalL2Error.C:28
const VariableValue & _u
Holds the solution at current quadrature points.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual Real getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
Definition: NodalL2Error.C:47
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...
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Definition: UserObject.h:119
virtual void threadJoin(const UserObject &y) override
Must override.
Definition: NodalL2Error.C:54
Function & _func
Definition: NodalL2Error.h:40
InputParameters validParams< NodalVariablePostprocessor >()
virtual void execute() override
Execute method.
Definition: NodalL2Error.C:40
Base class for user-specific data.
Definition: UserObject.h:42
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition: NodalL2Error.C:34