https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FunctionElementLoopIntegralUserObject.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 "Assembly.h"
12#include "Function.h"
13
15
18{
20
21 params.addClassDescription("Computes the integral of a function using an element loop.");
22
23 params.addRequiredParam<FunctionName>("function", "Function to integrate.");
24
25 return params;
26}
27
29 const InputParameters & parameters)
30 : ElementLoopUserObject(parameters),
31
32 _function(getFunction("function")),
33 _qp(0),
34 _integral_value(0)
35{
36}
37
38void
43
44void
50
51void
57
58void
63
64Real
66{
67 Real sum = 0;
68 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
69 sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
70 return sum;
71}
72
73Real
78
79Real
const std::vector< double > y
registerMooseObject("ThermalHydraulicsApp", FunctionElementLoopIntegralUserObject)
void reinit(const Elem *elem)
A base class that loops over elements and do things.
const MooseArray< Real > & _JxW
const QBase *const & _qrule
const MooseArray< Real > & _coord
const MooseArray< Point > & _q_point
static InputParameters validParams()
Computes the integral of a function using an element loop.
virtual void threadJoin(const UserObject &y) override
FunctionElementLoopIntegralUserObject(const InputParameters &parameters)
virtual Real getValue() const
Returns the integral value.
virtual Real computeIntegral()
Computes integral on an element.
virtual Real computeQpIntegral()
Computes value of integrand at quadrature point.
virtual Real value(Real t, const Point &p) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void gatherSum(T &value)
Assembly & _assembly