www.mooseframework.org
ElementIntegralPostprocessor.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
12 #include "libmesh/quadrature.h"
13 
14 template <>
17 {
19  return params;
20 }
21 
23  : ElementPostprocessor(parameters), _qp(0), _integral_value(0)
24 {
25 }
26 
27 void
29 {
30  _integral_value = 0;
31 }
32 
33 void
35 {
37 }
38 
39 Real
41 {
43  return _integral_value;
44 }
45 
46 void
48 {
49  const ElementIntegralPostprocessor & pps = static_cast<const ElementIntegralPostprocessor &>(y);
51 }
52 
53 Real
55 {
56  Real sum = 0;
57 
58  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
59  sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
60  return sum;
61 }
This postprocessor computes a volume integral of the specified variable.
const MooseArray< Real > & _coord
virtual Real getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual Real computeQpIntegral()=0
virtual void threadJoin(const UserObject &y) override
Must override.
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Definition: UserObject.h:103
virtual void execute() override
Execute method.
const QBase *const & _qrule
InputParameters validParams< ElementPostprocessor >()
const MooseArray< Real > & _JxW
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
InputParameters validParams< ElementIntegralPostprocessor >()
Base class for user-specific data.
Definition: UserObject.h:37
ElementIntegralPostprocessor(const InputParameters &parameters)