https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NodalSum.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 "NodalSum.h"
11#include "MooseMesh.h"
12#include "SubProblem.h"
13
15
18{
20 params.set<bool>("unique_node_execute") = true;
21
22 params.addClassDescription("Computes the sum of all of the nodal values of the specified "
23 "variable. Note: This object sets the default \"unique_node_execute\" "
24 "flag to true to avoid double counting nodes between shared blocks.");
25 return params;
26}
27
29 : NodalVariablePostprocessor(parameters), _sum(0)
30{
31}
32
33void
35{
36 _sum = 0;
37}
38
39void
41{
42 _sum += _u[_qp];
43}
44
45Real
47{
48 return _sum;
49}
50
51void
56
57void
59{
60 const auto & pps = static_cast<const NodalSum &>(y);
61 _sum += pps._sum;
62}
registerMooseObject("MooseApp", NodalSum)
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 a sum of the nodal values of the coupled variable.
Definition NodalSum.h:18
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition NodalSum.C:34
Real _sum
Definition NodalSum.h:32
void threadJoin(const UserObject &y) override
Must override.
Definition NodalSum.C:58
virtual void execute() override
Execute method.
Definition NodalSum.C:40
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
Definition NodalSum.C:52
static InputParameters validParams()
Definition NodalSum.C:17
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Definition NodalSum.C:46
NodalSum(const InputParameters &parameters)
Definition NodalSum.C:28
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