Closed fiedl closed 6 years ago
In this test, two photons are started within the inner cylinder. The outer cylinder is set to instant absorption, but both photons cross the outer cylinder.
When following this definition of how the order of cylinders should be, then, when leaving a cylinder, the properties of the next larger cylinder, which is the cylinder that is defined before (index - 1) the current one. If there is no such cylinder, use the properties of the bulk ice.
if (intersection_s2(p) > 0) {
// The photon leaves the hole ice on its way.
*number_of_medium_changes += 1;
distances_to_medium_changes[*number_of_medium_changes] = intersection_s2(p);
if (i == 0) // there is no larger cylinder
{
const int photonLayerAtTheCylinderBorder =
photon_layer(photonPosAndTime.z + photonDirAndWlen.z * intersection_s2(p));
local_scattering_lengths[*number_of_medium_changes] =
getScatteringLength(photonLayerAtTheCylinderBorder, photonDirAndWlen.w);
local_absorption_lengths[*number_of_medium_changes] =
getAbsorptionLength(photonLayerAtTheCylinderBorder, photonDirAndWlen.w);
} else {
// There is a larger cylinder outside this one, which is the one before in the array.
// See: https://github.com/fiedl/hole-ice-study/issues/47
//
local_scattering_lengths[*number_of_medium_changes] = cylinderScatteringLengths[i - 1];
local_absorption_lengths[*number_of_medium_changes] = cylinderAbsorptionLengths[i - 1];
}
}
https://github.com/fiedl/clsim/commit/29624fd50ded875f3a926248f84a59624c58c928 fixes the issue.
Before:
After:
After (with more photons):
Another demonstration:
With an outer cylinder that is configured for instant absorption:
Removing the outer cylinder, the photons that leave the inner cylinder may fly away:
Works as expected, now.
Consider two nested hole-ice cylinders. When leaving any cylinder, currently, the bulk-ice properties kick in at the second intersection point. But when leaving the inner cylinder, the properties of the outer cylinder should be used rather than the properties of the bulk ice.
As test case, create two nested cylinders. Start photons within the inner cylinder and set the outer cylinder to instant absorption. No photon should be able to leave the outer cylinder then.