https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
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
33void
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.
static InputParameters validParams()
const MooseArray< Real > & _JxW
The current quadrature point weight value.
unsigned int _qp
The current quadrature point index.
const MooseArray< Point > & _q_point
The physical location of the segment's quadrature points, indexed by _qp.
const bool _average
Whether or not to compute the average (divide by the length)
static InputParameters validParams()
const RayDataIndex _integral_data_index
The index into the data on the Ray that this integral accumulates into.
virtual Real computeQpIntegral()=0
void onSegment() override final
Called on each segment of a Ray.
IntegralRayKernel(const InputParameters &params)
const T * data() const
unsigned int size() const
const Real & _current_segment_length
The length of the current Ray's segment.
const std::shared_ptr< Ray > & currentRay() const
Gets the current Ray that this is working on.