Computing Line Integrals
The Ray Tracing Module can be utilized to integrate fields along a line throughout the domain. Example fields include Variables, AuxVariables, Material properties, and Functions.
The discussion that follows will describe how to integrate a variable across a line in a simple diffusion problem. To integrate other fields, the process remains the same except for the definition of the RayKernel.
Problem Definition
We begin with the standard "simple diffusion" problem:
(contrib/moose/modules/ray_tracing/test/tests/raykernels/variable_integral_ray_kernel/simple_diffusion_line_integral.i)For this problem, we seek the value of the integrals (where is the finite-element solution)
and
in which we will denote the first line, , as diag
and the second, , as right_up
for simplicity.
Note that the integral along the second line, , is trivial due to the Dirichlet boundary condition,
which implies
Defining the Study
A RepeatableRayStudy is defined that generates and executes the rays that compute the variable line integral:
(contrib/moose/modules/ray_tracing/test/tests/raykernels/variable_integral_ray_kernel/simple_diffusion_line_integral.i)The study
object defines two rays to be executed on TIMESTEP_END
:
diag
from toright_up
from to
Defining the RayKernel
RayKernels are objects that are executed on the segments of the rays. In this case, we wish to compute the integral of a variable so we will define a VariableIntegralRayKernel:
(contrib/moose/modules/ray_tracing/test/tests/raykernels/variable_integral_ray_kernel/simple_diffusion_line_integral.i)The u_integral
VariableIntegralRayKernel will accumulate the variable line integral of the u
Variable for our defined rays, diag
and right_up
.
Other commonly used IntegralRayKernels are the FunctionIntegralRayKernel and the MaterialIntegralRayKernel.
Integral Output
Lastly, we need to obtain the accumulated integrals from the study
. We will utilize a RayIntegralValue Postprocessor to achieve this:
The accumulated integrals are seen in output:
Segment-wise Integral Output
The segment-wise accumulated integral can also be outputted in a mesh format using the RayTracingMeshOutput. For more information, see Example.