https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NodalL2Norm.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
13
16{
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
30void
35
36void
38{
39 Real val = _u[_qp];
40 _sum_of_squares += val * val;
41}
42
43Real
45{
46 return std::sqrt(_sum_of_squares);
47}
48
49void
51{
52 const auto & pps = static_cast<const NodalL2Norm &>(y);
54}
55
56void
registerMooseObject("MooseApp", NodalL2Norm)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Computes the "nodal" L2-norm of the coupled variable, which is defined by summing the square of its v...
Definition NodalL2Norm.h:20
NodalL2Norm(const InputParameters &parameters)
Definition NodalL2Norm.C:25
virtual void threadJoin(const UserObject &y) override
Must override.
Definition NodalL2Norm.C:50
Real _sum_of_squares
Definition NodalL2Norm.h:33
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition NodalL2Norm.C:31
virtual void execute() override
Execute method.
Definition NodalL2Norm.C:37
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
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Definition NodalL2Norm.C:44
static InputParameters validParams()
Definition NodalL2Norm.C:15
const unsigned int _qp
Quadrature point index.
This is a base class for other classes which compute post-processed values based on nodal solution va...
const VariableValue & _u
Holds the solution at current quadrature points.
static InputParameters validParams()
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Base class for user-specific data.
Definition UserObject.h:20