www.mooseframework.org
NodalL2Error.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "NodalL2Error.h"
11 #include "Function.h"
12 
14 
15 template <>
18 {
20  params.addRequiredParam<FunctionName>("function", "The analytic solution to compare against");
21 
22  return params;
23 }
24 
26  : NodalVariablePostprocessor(parameters), _func(getFunction("function"))
27 {
28 }
29 
30 void
32 {
33  _integral_value = 0.;
34 }
35 
36 void
38 {
39  Real diff = _u[0] - _func.value(_t, *_current_node);
40  _integral_value += diff * diff;
41 }
42 
43 Real
45 {
47  return std::sqrt(_integral_value);
48 }
49 
50 void
52 {
53  const NodalL2Error & pps = static_cast<const NodalL2Error &>(y);
55 }
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:38
This is a base class for other classes which compute post-processed values based on nodal solution va...
Real _integral_value
Definition: NodalL2Error.h:33
const Node *const & _current_node
Reference to current node pointer.
InputParameters validParams< NodalL2Error >()
Definition: NodalL2Error.C:17
NodalL2Error(const InputParameters &parameters)
Definition: NodalL2Error.C:25
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:44
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:103
virtual void threadJoin(const UserObject &y) override
Must override.
Definition: NodalL2Error.C:51
Function & _func
Definition: NodalL2Error.h:34
registerMooseObject("MooseApp", NodalL2Error)
InputParameters validParams< NodalVariablePostprocessor >()
virtual void execute() override
Execute method.
Definition: NodalL2Error.C:37
Base class for user-specific data.
Definition: UserObject.h:37
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition: NodalL2Error.C:31