Message: Discrete process at boundary crossing Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Discrete process at boundary crossing 

Forum: Physics List
Date: 30 Jun, 2015
From: Oliver Woolland <Oliver Woolland>

Hello all,

I have a question about implementing discrete processes, I have a mostly functioning class which returns an exception. It would be great to get advice on either fixing my current implementation or on what the best practice might be in my case.

I am trying to implement a process which executes whenever an electron crosses a geometric boundary. When a boundary crossing occurs I wish to alter the kinetic energy and momentum direction of the particle and allow it to continue on its way.

To achieve this I have created a class derived from G4VDiscreteProcess and implemented the GetMeanFreePath and PostStepDoIt methods (minimal example below).

My current approach is to have my process called after every step by setting the mean free path to infinity and setting the G4ForceCondition to Forced, then testing if the particle is at a boundary. This works as expected but I receive the following exception.

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : ProcMan201
      issued by : G4VProcess::SubtractNumberOfInteractionLengthLeft()
Negative currentInteractionLength for MyProcess
*** Event Must Be Aborted ***
-------- EEEE -------- G4Exception-END --------- EEEE -------

Any suggestions on how to resolve this exception, or a more appropriate way to design this class would be appreciated.



Minimal example:

G4double MyProcess::GetMeanFreePath (const G4Track &aTrack,
				    G4double previousStepSize,
				    G4ForceCondition *condition) {
  *condition = Forced;
  return DBL_MAX;

G4VParticleChange* MyProcess::PostStepDoIt(const G4Track & aTrack,
					   const G4Step & astep) {
  if (aStep.GetPostStepPoint()->GetStepStatus()==fGeomBoundary) { 
    return &aParticleChange;
  } else return &aParticleChange;

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Discrete process at boundary crossing   (Vladimir Ivanchenko - 04 Jul, 2015)
2 None: Re: Discrete process at boundary crossing   (Oliver Woolland - 05 Jul, 2015)
 Add Message Add Message
to: "Discrete process at boundary crossing"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]