https://mooseframework.inl.gov
Loading...
Searching...
No Matches
AverageNodalVariableValue.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
11#include "MooseMesh.h"
12#include "SubProblem.h"
13
15
18{
20
21 params.addClassDescription("Computes the average value of a field by sampling all nodal "
22 "solutions on the domain or within a subdomain");
23 return params;
24}
25
27 : NodalVariablePostprocessor(parameters), _sum(0), _n(0)
28{
29}
30
31// doco-init-start
32void
38// doco-init-end
39
40// doco-execute-get-start
41void
47
48Real
50{
51 return _sum / _n;
52}
53// doco-execute-get-end
54
55// doco-final-start
56void
62// doco-final-end
63
64// doco-thread-start
65void
67{
68 const auto & pps = static_cast<const AverageNodalVariableValue &>(y);
69 _sum += pps._sum;
70 _n += pps._n;
71}
72// doco-thread-end
registerMooseObject("MooseApp", AverageNodalVariableValue)
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
static InputParameters validParams()
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
virtual void threadJoin(const UserObject &y) override
Must override.
virtual void execute() override
Execute method.
AverageNodalVariableValue(const InputParameters &parameters)
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.
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