www.mooseframework.org
ElementL2Difference.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 "ElementL2Difference.h"
11 #include "Function.h"
12 
14 
17 {
19  params.addRequiredCoupledVar("other_variable", "The variable to compare to");
20 
21  params.addClassDescription("Computes the element-wise L2 difference between the current variable "
22  "and a coupled variable.");
23  return params;
24 }
25 
27  : ElementIntegralVariablePostprocessor(parameters), _other_var(coupledValue("other_variable"))
28 {
29 }
30 
31 Real
33 {
35 }
36 
37 Real
39 {
40  Real diff = _u[_qp] - _other_var[_qp];
41  return diff * diff;
42 }
This postprocessor computes a volume integral of the specified variable.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual Real computeQpIntegral() override
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
ElementL2Difference(const InputParameters &parameters)
const VariableValue & _other_var
The variable to compare to.
registerMooseObject("MooseApp", ElementL2Difference)
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
const VariableValue & _u
Holds the solution at current quadrature points.
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...
Computes the L2-Norm difference between two solution fields.