www.mooseframework.org
NodalSum.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 "NodalSum.h"
16 #include "MooseMesh.h"
17 #include "SubProblem.h"
18 
19 template <>
22 {
24  params.set<bool>("unique_node_execute") = true;
25  return params;
26 }
27 
29  : NodalVariablePostprocessor(parameters), _sum(0)
30 {
31 }
32 
33 void
35 {
36  _sum = 0;
37 }
38 
39 void
41 {
42  _sum += _u[_qp];
43 }
44 
45 Real
47 {
48  gatherSum(_sum);
49 
50  return _sum;
51 }
52 
53 void
55 {
56  const NodalSum & pps = static_cast<const NodalSum &>(y);
57  _sum += pps._sum;
58 }
This is a base class for other classes which compute post-processed values based on nodal solution va...
NodalSum(const InputParameters &parameters)
Definition: NodalSum.C:28
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
void threadJoin(const UserObject &y) override
Must override.
Definition: NodalSum.C:54
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...
Real _sum
Definition: NodalSum.h:41
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition: NodalSum.C:34
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Definition: UserObject.h:119
const unsigned int _qp
Quadrature point index.
virtual void execute() override
Execute method.
Definition: NodalSum.C:40
Computes a sum of the nodal values of the coupled variable.
Definition: NodalSum.h:29
InputParameters validParams< NodalSum >()
Definition: NodalSum.C:21
InputParameters validParams< NodalVariablePostprocessor >()
virtual Real getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
Definition: NodalSum.C:46
Base class for user-specific data.
Definition: UserObject.h:42