Unexpected behavior when using discrete process

Geant4 Version: 11.03.2

To preface, what I am attempting to do is define a discrete process that causes all particles to reflect in a specular manner at certain boundaries, similar to other posts on the forum, such as " Particle reflection at volume boundary ". When including my discrete process in my physics list I can make some particles undergo specular reflection; Concernedly though, when including my discrete process the behavior of particles at boundaries is not always correct. Does anyone know what could be going wrong with how I implement my discrete process, or how I wrote my discrete process?

ReflectorProcess.cc (1.7 KB)

Physics.hh (507 Bytes)

ReflectorProcess.hh (573 Bytes)

Physics.cc (730 Bytes)

I have not been able to figure out all the cases in which this incorrect behavior occurs, so I will include a graphic that shows five neutrons taking different paths through my geometry. My geometry includes a world box containing a box of air (Green) which, in turn, contains another box of air (Blue) - each volume was defined as composed of air.


The discrete process I have contains a post step do it that checks if a particle is at a boundary and if the volume occupied by the prestep point was the blue box. In the case that both checks return true, then a new momentum is proposed. Unfortunately, in the five examples I provide, only one neutron reflected; more importantly though, by attaching my discrete process to my physics list, some particles are unintentionally terminated at some boundaries, see four of the provided examples. Considering that all volumes contained air, I expected a rather lengthy simulation in which neutrons would be stuck bouncing ad nauseam in the blue volume.

To add, I don’t think the contents of my post step do it are to blame, I simplified the contents of the post step do it to the point that it should not change anything and still observed that particles are terminated at boundaries.

ReflectorProcess_Simplified.cc (626 Bytes)

Anywho, thanks in advance, and I hope that everyone has been having a pleasant summer!

Hi @Keith-Huddleston , could you check the very start of your output? Do you see a large number of blocks like this?

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : ProcMan113
      issued by : G4ProcessManager::SetProcessOrderingToFirst()
Set Ordering First is invoked twice for Transportation to <some particle>
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

I ask because I built a small reproducer from your four files and I get about a thousand of these…

I don’t know why I was ignoring that message. After reading the message I was able to find the error, I needed to remove the AddTransportation(); line from my Physics.cc file and now everything is working properly.