Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
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 
14 registerMooseObject("MooseApp", NodalSum);
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 
33 void
35 {
36  _sum = 0;
37 }
38 
39 void
41 {
42  _sum += _u[_qp];
43 }
44 
45 Real
47 {
48  return _sum;
49 }
50 
51 void
53 {
54  gatherSum(_sum);
55 }
56 
57 void
59 {
60  const auto & pps = static_cast<const NodalSum &>(y);
61  _sum += pps._sum;
62 }
This is a base class for other classes which compute post-processed values based on nodal solution va...
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
NodalSum(const InputParameters &parameters)
Definition: NodalSum.C:28
static InputParameters validParams()
Definition: NodalSum.C:17
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:58
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:32
registerMooseObject("MooseApp", NodalSum)
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:124
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:17
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Definition: NodalSum.C:46
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...
static InputParameters validParams()
Base class for user-specific data.
Definition: UserObject.h:39