www.mooseframework.org
ElementL2Difference.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 "ElementL2Difference.h"
16 #include "Function.h"
17 
18 template <>
21 {
23  params.addRequiredCoupledVar("other_variable", "The variable to compare to");
24  return params;
25 }
26 
28  : ElementIntegralVariablePostprocessor(parameters), _other_var(coupledValue("other_variable"))
29 {
30 }
31 
32 Real
34 {
35  return std::sqrt(ElementIntegralPostprocessor::getValue());
36 }
37 
38 Real
40 {
41  Real diff = _u[_qp] - _other_var[_qp];
42  return diff * diff;
43 }
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...
virtual Real computeQpIntegral() override
ElementL2Difference(const InputParameters &parameters)
virtual Real getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
const VariableValue & _other_var
The variable to compare to.
const VariableValue & _u
Holds the solution at current quadrature points.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
InputParameters validParams< ElementIntegralVariablePostprocessor >()
InputParameters validParams< ElementL2Difference >()