www.mooseframework.org
SideIntegralPostprocessor.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 
16 {
18  return params;
19 }
20 
22  : SidePostprocessor(parameters), _qp(0), _integral_value(0), _qp_integration(true)
23 {
24 }
25 
26 void
28 {
30 
31  if (!_qp_integration && _mesh.allFaceInfo().size() == 0)
33 }
34 
35 void
37 {
38  _integral_value = 0;
39 }
40 
41 void
43 {
45 }
46 
47 Real
49 {
50  return _integral_value;
51 }
52 
53 void
55 {
56  const auto & pps = static_cast<const SideIntegralPostprocessor &>(y);
57  _integral_value += pps._integral_value;
58 }
59 
60 Real
62 {
63  Real sum = 0;
64  if (_qp_integration)
65  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
66  sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
67  else
68  {
69  // Finite volume functors integration is over FaceInfo, not quadrature points
70  getFaceInfos();
71 
72  for (auto & fi : _face_infos)
73  sum += fi->faceArea() * fi->faceCoord() * computeFaceInfoIntegral(fi);
74  }
75  return sum;
76 }
77 
78 void
80 {
82 }
SideIntegralPostprocessor(const InputParameters &parameters)
bool _qp_integration
Whether to integrate over quadrature points or FaceInfos.
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
unsigned int _qp
The local quadrature point index when computing an integral over quadrature points.
std::vector< const FaceInfo * > _face_infos
Holds the FaceInfos to loop on to consider all active neighbors of an element on a given side...
const MooseArray< Real > & _JxW
const std::vector< FaceInfo > & allFaceInfo() const
Accessor for all FaceInfo objects.
Definition: MooseMesh.h:2114
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Definition: UserObject.h:125
virtual Real computeFaceInfoIntegral(const FaceInfo *)
void getFaceInfos()
Computes the local FaceInfo(s) to use in functor arguments and interpolations.
This postprocessor computes a surface integral of the specified variable on a sideset on the boundary...
virtual void errorNoFaceInfo() const
Error method to call when face info is needed but not available.
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
const MooseArray< Real > & _coord
Base class for postprocessors executed on one or more sidesets.
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
virtual void threadJoin(const UserObject &y) override
Must override.
virtual Real computeQpIntegral()=0
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MooseMesh & _mesh
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
static InputParameters validParams()
const QBase *const & _qrule
virtual void execute() override
Execute method.
virtual void initialSetup()
Gets called at the beginning of the simulation before this object is asked to do its job...
Real _integral_value
Holds the postprocessor result, the integral.
Base class for user-specific data.
Definition: UserObject.h:39