G4PhantomParameterisation and Stuck Particles

I set up an electron problem using G4PhantomParameterisation to split up my simple box of water into voxels. I find that if I start electrons down the -X axis, that they get “stuck” every time they cross a voxel boundary. I was looking at G4PhantomParameterisation::GetReplicaNo in version 10.06.p01; the criteria for fixing the cell number if the localPoint is near a voxel boundary does not look quite right to me. For example, it seems like line G4PhantomParameterisation.cc:271 should be some thing like:

if( (fx - nx)*fVoxelHalfX < kCarTolerance )

instead of

if( fx - nx < kCarTolerance*fVoxelHalfX )

because previously kCarTolerance is treated as absolute distance, not really a fraction. See line 255 for example.

With the change above, it appears to solve all my stuck particle problems. Should I report this as a bug? Should I provide a test program? What’s next?

Thanks,
Allen

kCarTolerance is an absolute distance, but the numerical unprecision of fx will depend on the magnitude of it, so this check is write. I am quite surprised that the change you propose solves your problem.
In any case we added a more robust “stucking solution” in geant4.10.6. Could you please try?

Hi: This is what I see from Geant4.10.6.p01: It gets started in the wrong cell (effectively) and it takes 10 steps to get unstuck every time it gets to a voxel boundary. (localpoint.x goes from 50 to 49 to 48 and so on until the electron stops after a few cm.) I attached my example program. I’ve tried to simplify it as much as possible, but it’s entirely possible that I haven’t set this up correctly.
Thanks,
Allen
electrons.cc (7.1 KB) electrons.txt (950 Bytes)

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomNav1002
      issued by : G4PhantomParameterisation::GetReplicaNo()
Corrected the copy number! It was negative or too big
          LocalPoint: (50,0.5,0.5)
          LocalDir: (-1,0,0)
          Voxel container size: 50 50 50
          LocalPoint - wall: 0 -49.5 -49.5
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomNav1002
      issued by : G4Navigator::ComputeStep()
Stuck Track: potential geometry or navigation problem.
  Track stuck, not moving for 10 steps.
  Current  phys volume: 'phantom'
   - at position : (99,0.5,0.5)
     in direction: (-1,0,0)
    (local position: (-0.5,0,0))
    (local direction: (-1,0,0)).
  Previous phys volume: 'phantom'

  Likely geometry overlap - else navigation problem !
   *** Trying to get *unstuck* using a push - expanding step to 1e-07 (mm) ...       Potential overlap in geometry !

*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomNav1002
      issued by : G4Navigator::ComputeStep()
Stuck Track: potential geometry or navigation problem.
  Track stuck, not moving for 10 steps.
  Current  phys volume: 'phantom'
   - at position : (98,0.5,0.5)
     in direction: (-1,0,0)
    (local position: (-0.5,0,0))
    (local direction: (-1,0,0)).
  Previous phys volume: 'phantom'

  Likely geometry overlap - else navigation problem !
   *** Trying to get *unstuck* using a push - expanding step to 1e-07 (mm) ...       Potential overlap in geometry !

*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomNav1002
      issued by : G4Navigator::ComputeStep()
Stuck Track: potential geometry or navigation problem.
  Track stuck, not moving for 10 steps.
  Current  phys volume: 'phantom'
   - at position : (97,0.5,0.5)
     in direction: (-1,0,0)
    (local position: (-0.5,0,0))
    (local direction: (-1,0,0)).
  Previous phys volume: 'phantom'

  Likely geometry overlap - else navigation problem !
   *** Trying to get *unstuck* using a push - expanding step to 1e-07 (mm) ...       Potential overlap in geometry !

*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

Here’s the CMake file, too.
CMakeLists.txt (430 Bytes)

1 Like

I have this problem too. I want to know if you have solved? Thank you very much.

This should be solved in geant4.11.0. Could you please try?

I used geant4.11.0 for simulation, and the problem is as follows, which I think is similar to allenbarnett’s problem. The particle is going in the direction of (0,0,1).