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 "IntegralRayKernel.h" 11 : 12 : // Local includes 13 : #include "RayTracingStudy.h" 14 : 15 : InputParameters 16 740 : IntegralRayKernel::validParams() 17 : { 18 740 : auto params = IntegralRayKernelBase::validParams(); 19 1480 : params.addParam<bool>( 20 : "average", 21 1480 : false, 22 : "Whether or not to compute the average value (divides by the segment length)"); 23 740 : return params; 24 0 : } 25 : 26 399 : IntegralRayKernel::IntegralRayKernel(const InputParameters & params) 27 : : IntegralRayKernelBase(params), 28 399 : _integral_data_index(_study.registerRayData(integralRayDataName())), 29 1197 : _average(getParam<bool>("average")) 30 : { 31 399 : } 32 : 33 : void 34 2710 : IntegralRayKernel::onSegment() 35 : { 36 : // Note that here we do not multiply by _coord[_qp]! 37 : // 38 : // The integral done here is the integral of a field variable/material/etc, and not 39 : // an integration that contributes to the residual/Jacobian. Hence: it is something like 40 : // a line integral. In RZ and RSPHERICAL, we want line integrals to still be line integrals. 41 : // Therefore, it does not make sense to multiply by the coordinate transformation. 42 : Real integral = 0; 43 7214 : for (_qp = 0; _qp < _q_point.size(); ++_qp) 44 4504 : integral += _JxW[_qp] * computeQpIntegral(); 45 : 46 : // If we're computing the average, divide by the length 47 2710 : if (_average) 48 720 : integral /= _current_segment_length; 49 : 50 : // Accumulate the integral into the Ray 51 2710 : currentRay()->data(_integral_data_index) += integral; 52 2710 : }