ReflectRayBC

A RayBC that reflects a Ray in a specular manner on a boundary.

It can properly handle reflections at domain corners/edges that are reflecting on all boundaries at the corner/edge (see Hitting Multiple Boundaries for more information).

It achieves the reflection by changing the direction of the Ray:

void
ReflectRayBC::onBoundary(const unsigned int num_applying)
{
  if (_warn_non_planar && _study.sideIsNonPlanar(_current_elem, _current_intersected_side))
    mooseWarning("A Ray is being reflected on a non-planar side.\n\n",
                 "Ray tracing on elements with non-planar faces is an approximation.\n\n",
                 "The normal used to compute the reflected direction is computed at\n",
                 "the side centroid and may not be valid for a non-planar side.\n\n",
                 "To disable this warning, set RayKernels/",
                 name(),
                 "/warn_non_planar=false.\n\n",
                 currentRay()->getInfo());

  // No need to do anything if the Ray's gonna die anyway
  if (!currentRay()->shouldContinue())
    return;

  // The direction this Ray reflects off this boundary
  const auto & normal = _study.getSideNormal(_current_elem, _current_intersected_side, _tid);
  const auto reflected_direction = reflectedDirection(currentRay()->direction(), normal);

  // Change it! Note here the usage of num_applying: if we are at a corner with a reflecting
  // boundary condition on both sides, we want to allow both boundary conditions to reflect the Ray.
  // Therefore, we skip the check that another RayBC has changed the Ray's trajectory when we are
  // applying multiple of the same ReflectRayBC at different boundaries at the same point to allow
  // this. Note that this double (or triple in 3D) reflection will only be allowed when the same
  // ReflectRayBC object is on both boundaries.
  changeRayDirection(reflected_direction, /* skip_changed_check = */ num_applying > 1);
}
(moose/modules/ray_tracing/src/raybcs/ReflectRayBC.C)

Per the specularly reflected direction (static and available for other RayBCs to use):

Point
ReflectRayBC::reflectedDirection(const Point & direction, const Point & normal)
{
  mooseAssert(MooseUtils::absoluteFuzzyEqual(direction.norm(), 1.), "Direction not normalized");
  mooseAssert(MooseUtils::absoluteFuzzyEqual(normal.norm(), 1.), "Normal not normalized");

  Point reflected_direction = direction;
  reflected_direction -= 2.0 * (reflected_direction * normal) * normal;
  return reflected_direction / reflected_direction.norm();
}
(moose/modules/ray_tracing/src/raybcs/ReflectRayBC.C)

Input Parameters

  • boundaryThe list of boundary IDs from the mesh where this object applies

    C++ Type:std::vector<BoundaryName>

    Unit:(no unit assumed)

    Controllable:No

    Description:The list of boundary IDs from the mesh where this object applies

Required Parameters

  • depends_onOther RayBCs that this RayBC depends on

    C++ Type:std::vector<std::string>

    Unit:(no unit assumed)

    Controllable:No

    Description:Other RayBCs that this RayBC depends on

  • raysThe name of the Rays associated with this object; only used if Ray registration is enabled within the study. If no Rays are supplied, this object will be applied to all Rays.

    C++ Type:std::vector<std::string>

    Unit:(no unit assumed)

    Controllable:No

    Description:The name of the Rays associated with this object; only used if Ray registration is enabled within the study. If no Rays are supplied, this object will be applied to all Rays.

  • studyThe RayTracingStudy associated with this object. If none provided, this will default to the one study that exists.

    C++ Type:UserObjectName

    Unit:(no unit assumed)

    Controllable:No

    Description:The RayTracingStudy associated with this object. If none provided, this will default to the one study that exists.

  • warn_non_planarTrueWhether or not to emit a warning if a Ray is being reflected on a non-planar side

    Default:True

    C++ Type:bool

    Unit:(no unit assumed)

    Controllable:No

    Description:Whether or not to emit a warning if a Ray is being reflected on a non-planar side

Optional Parameters

  • control_tagsAdds user-defined labels for accessing object parameters via control logic.

    C++ Type:std::vector<std::string>

    Unit:(no unit assumed)

    Controllable:No

    Description:Adds user-defined labels for accessing object parameters via control logic.

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Unit:(no unit assumed)

    Controllable:No

    Description:Set the enabled status of the MooseObject.

Advanced Parameters