https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
33Real
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}
registerMooseObject("MooseApp", CylindricalAverage)
Compute a cylindrical average of a variableas a function of radius throughout the simulation domain.
CylindricalAverage(const InputParameters &parameters)
const Real _cyl_axis_norm
axis norm
virtual Real computeDistance() override
compute the distance of the current quadarature point for binning
const Point _cyl_axis
vector along cylinder axis
static InputParameters validParams()
const MooseArray< Point > & _q_point
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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...
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.
Base clase for computing spatial average of a variable over simple spatial regions of the computation...
static InputParameters validParams()
const Point _origin
origin of sphere [or other body]
unsigned int _qp
current quadrature point - used in computeVolume()