Line data Source code
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 : 14 : registerMooseObject("MooseApp", CylindricalAverage); 15 : 16 : InputParameters 17 14290 : CylindricalAverage::validParams() 18 : { 19 14290 : InputParameters params = SpatialAverageBase::validParams(); 20 14290 : params.addRequiredParam<Point>("cylinder_axis", "Vector along cylinder coordinate axis"); 21 14290 : params.addClassDescription("Compute a cylindrical average of a variableas a function of radius " 22 : "throughout the simulation domain."); 23 14290 : return params; 24 0 : } 25 : 26 13 : CylindricalAverage::CylindricalAverage(const InputParameters & parameters) 27 : : SpatialAverageBase(parameters), 28 13 : _cyl_axis(getParam<Point>("cylinder_axis")), 29 26 : _cyl_axis_norm(_cyl_axis.norm()) 30 : { 31 13 : } 32 : 33 : Real 34 12800 : CylindricalAverage::computeDistance() 35 : { 36 : // angle between cyl_axis and origin-to-q_point 37 12800 : Point oqp = _q_point[_qp] - _origin; 38 12800 : Real norm_oqp = oqp.norm(); 39 12800 : 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 12800 : return norm_oqp * std::sqrt(1 - cos_theta * cos_theta); 43 : }