Problem 1888 - Photon stuck in infinite loop when traveling almost perpendicular to the surface normal
Summary: Photon stuck in infinite loop when traveling almost perpendicular to the surf...
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/optical (show other problems)
Version: 10.2
Hardware: PC Linux
: P4 normal
Assignee: gum
URL:
Depends on:
Blocks:
 
Reported: 2016-09-09 06:59 CEST by Juan Pablo Yanez
Modified: 2016-10-04 01:26 CEST (History)
0 users

See Also:


Attachments
Patch to add a tolerance to the Done condition (442 bytes, patch)
2016-09-09 06:59 CEST, Juan Pablo Yanez
Details | Diff

Note You need to log in before you can comment on or make changes to this problem.
Description Juan Pablo Yanez 2016-09-09 06:59:24 CEST
Created attachment 412 [details]
Patch to add a tolerance to the Done condition

The photon is traveling almost perpendicular to an acrylic surface, but still approaching it. The reflection angle is calculated, but due to the numerical precision of the machine (I suppose), the resulting angle does not meet the condition of (NewMomentum*theGlobalNormal >= 0). The product is of order 10^-8, but negative. The calculation sits in a loop, that you can only exit if you meet the condition stated above. Since the condition is never met, the program stays in that loop. 

The problem was replicated in multiple systems.

Adding a tolerance solves the issue.
Comment 1 Juan Pablo Yanez 2016-09-09 07:01:18 CEST
EDIT: Photon path is almost perpendicular to the surface normal (parallel to the surface).
Comment 2 gum 2016-10-04 01:26:30 CEST
Thank you for the bug-report and for providing a fix. This is tagged as op-V10-02-02 and will be in the next public release (10.3)