https://mooseframework.inl.gov
IntegralRayKernel.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 "IntegralRayKernel.h"
11 
12 // Local includes
13 #include "RayTracingStudy.h"
14 
17 {
18  auto params = IntegralRayKernelBase::validParams();
19  params.addParam<bool>(
20  "average",
21  false,
22  "Whether or not to compute the average value (divides by the segment length)");
23  return params;
24 }
25 
27  : IntegralRayKernelBase(params),
28  _integral_data_index(_study.registerRayData(integralRayDataName())),
29  _average(getParam<bool>("average"))
30 {
31 }
32 
33 void
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  for (_qp = 0; _qp < _q_point.size(); ++_qp)
44  integral += _JxW[_qp] * computeQpIntegral();
45 
46  // If we're computing the average, divide by the length
47  if (_average)
48  integral /= _current_segment_length;
49 
50  // Accumulate the integral into the Ray
51  currentRay()->data(_integral_data_index) += integral;
52 }
Base class for a RayKernel that integrates along a Ray segment.
const bool _average
Whether or not to compute the average (divide by the length)
const Real & _current_segment_length
The length of the current Ray&#39;s segment.
void onSegment() override final
Called on each segment of a Ray.
const std::shared_ptr< Ray > & currentRay() const
Gets the current Ray that this is working on.
unsigned int size() const
IntegralRayKernel(const InputParameters &params)
const RayDataIndex _integral_data_index
The index into the data on the Ray that this integral accumulates into.
const MooseArray< Real > & _JxW
The current quadrature point weight value.
unsigned int _qp
The current quadrature point index.
static InputParameters validParams()
const MooseArray< Point > & _q_point
The physical location of the segment&#39;s quadrature points, indexed by _qp.
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real computeQpIntegral()=0