www.mooseframework.org
NodalL2Norm.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 "NodalL2Norm.h"
11 
12 registerMooseObject("MooseApp", NodalL2Norm);
13 
16 {
18  params.addClassDescription(
19  "Computes the nodal L2-norm of the coupled variable, which is defined by summing the square "
20  "of its value at every node and taking the square root.");
21  params.set<bool>("unique_node_execute") = true;
22  return params;
23 }
24 
26  : NodalVariablePostprocessor(parameters), _sum_of_squares(0.0)
27 {
28 }
29 
30 void
32 {
33  _sum_of_squares = 0.0;
34 }
35 
36 void
38 {
39  Real val = _u[_qp];
40  _sum_of_squares += val * val;
41 }
42 
43 Real
45 {
46  return std::sqrt(_sum_of_squares);
47 }
48 
49 void
51 {
52  const auto & pps = static_cast<const NodalL2Norm &>(y);
53  _sum_of_squares += pps._sum_of_squares;
54 }
55 
56 void
58 {
60 }
This is a base class for other classes which compute post-processed values based on nodal solution va...
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
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...
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
virtual void execute() override
Execute method.
Definition: NodalL2Norm.C:37
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Definition: UserObject.h:125
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition: NodalL2Norm.C:31
virtual void threadJoin(const UserObject &y) override
Must override.
Definition: NodalL2Norm.C:50
const unsigned int _qp
Quadrature point index.
NodalL2Norm(const InputParameters &parameters)
Definition: NodalL2Norm.C:25
static InputParameters validParams()
Definition: NodalL2Norm.C:15
Real _sum_of_squares
Definition: NodalL2Norm.h:33
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
Definition: NodalL2Norm.C:57
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...
registerMooseObject("MooseApp", NodalL2Norm)
static InputParameters validParams()
Base class for user-specific data.
Definition: UserObject.h:39
Computes the "nodal" L2-norm of the coupled variable, which is defined by summing the square of its v...
Definition: NodalL2Norm.h:19
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Definition: NodalL2Norm.C:44