21 params.addRequiredCoupledVar(
"field",
"The field variable that denotes the phase");
23 params.addParam<
Real>(
"r1", 1.0,
"The first index of refraction");
24 params.addParam<
Real>(
"r2", 1.33,
"The second index of refraction");
31 _field(coupledValue(
"field")),
32 _grad_field(coupledGradient(
"field")),
33 _r1(getParam<
Real>(
"r1")),
34 _r2(getParam<
Real>(
"r2")),
35 _has_refracted_data_index(_study.registerRayData(
"has_refracted"))
76 const Real c = std::abs(normal * direction);
77 if (
c > 1.0 - TOLERANCE)
80 const Real r = r1 / r2;
81 return (r * direction + (r *
c - std::sqrt(1 - r * r * (1 -
c *
c))) * normal).unit();
const Real _r1
The first index of refraction.
Point refract(const Point &direction, const Point &normal, const Real r1, const Real r2) const
Computes the refracted direction using Snell's law.
const VariableGradient & _grad_field
The gradient of the field variable that notes the phase.
Simplified RayKernel that refracts Rays when the phase changes (phase change denoted by a field varia...
const std::shared_ptr< Ray > & currentRay() const
Gets the current Ray that this is working on.
registerMooseObject("RayTracingTestApp", RefractionRayKernelTest)
static InputParameters validParams()
const Real _r2
The second index of refraction.
static InputParameters validParams()
const RayDataIndex _has_refracted_data_index
Index of the Ray data that notes if the Ray has refracted or not.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableValue & _field
The field variable that notes the phase.
virtual void onSegment() override
Called on each segment of a Ray.
void changeRayStartDirection(const Point &start, const Point &direction)
Changes the current Ray's start point and direction.
RefractionRayKernelTest(const InputParameters ¶ms)
const Point & _current_segment_end
The end point of the current Ray's segment.
const Point & _current_segment_start
The start point of the current Ray's segment.