https://mooseframework.inl.gov
CylindricalAverage.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 "CylindricalAverage.h"
11 
12 #include "libmesh/quadrature.h"
13 
15 
18 {
20  params.addRequiredParam<Point>("cylinder_axis", "Vector along cylinder coordinate axis");
21  params.addClassDescription("Compute a cylindrical average of a variableas a function of radius "
22  "throughout the simulation domain.");
23  return params;
24 }
25 
27  : SpatialAverageBase(parameters),
28  _cyl_axis(getParam<Point>("cylinder_axis")),
29  _cyl_axis_norm(_cyl_axis.norm())
30 {
31 }
32 
33 Real
35 {
36  // angle between cyl_axis and origin-to-q_point
37  Point oqp = _q_point[_qp] - _origin;
38  Real norm_oqp = oqp.norm();
39  Real cos_theta = oqp * _cyl_axis / norm_oqp / _cyl_axis_norm;
40 
41  // the distance is the sine times the length of the hypotenuse == norm_oqp
42  return norm_oqp * std::sqrt(1 - cos_theta * cos_theta);
43 }
static InputParameters validParams()
const MooseArray< Point > & _q_point
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
CylindricalAverage(const InputParameters &parameters)
const Real _cyl_axis_norm
axis norm
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
unsigned int _qp
current quadrature point - used in computeVolume()
auto norm(const T &a) -> decltype(std::abs(a))
static InputParameters validParams()
registerMooseObject("MooseApp", CylindricalAverage)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
const Point _origin
origin of sphere [or other body]
virtual Real computeDistance() override
compute the distance of the current quadarature point for binning
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 Point _cyl_axis
vector along cylinder axis
Compute a cylindrical average of a variableas a function of radius throughout the simulation domain...
Base clase for computing spatial average of a variable over simple spatial regions of the computation...