fiedl / hole-ice-study

This project aims to incorporate the effects of hole ice into the clsim photon propagation simulation of the icecube neutrino observatory.
Other
4 stars 2 forks source link

Set correct properties when leaving a nested cylinder #47

Closed fiedl closed 6 years ago

fiedl commented 6 years ago

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.

fiedl commented 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.

bildschirmfoto 2018-03-10 um 20 06 03
fiedl commented 6 years ago

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];
  }
}
fiedl commented 6 years ago

https://github.com/fiedl/clsim/commit/29624fd50ded875f3a926248f84a59624c58c928 fixes the issue.

Before:

before

After:

bildschirmfoto 2018-03-10 um 20 24 27

After (with more photons):

bildschirmfoto 2018-03-10 um 20 27 01
fiedl commented 6 years ago

Another demonstration:

With an outer cylinder that is configured for instant absorption:

bildschirmfoto 2018-03-10 um 20 27 37

Removing the outer cylinder, the photons that leave the inner cylinder may fly away:

bildschirmfoto 2018-03-10 um 20 30 10

Works as expected, now.