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

None Re: Discrete process at boundary crossing 

Forum: Physics List
Re: Question Discrete process at boundary crossing (Oliver Woolland)
Date: 05 Jul, 2015
From: Oliver Woolland <Oliver Woolland>

Thank you Vladimir, on your suggestion I had another read over the StepMax process.

Implementing PostStepGetInteractionLength appears to have solved my problem.

Much appreciated,

Oliver

On Tue, 30 Jun 2015 08:39:11 GMT, Oliver Woolland wrote:

> 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.
> 
> Cheers,
> 
> Oliver
> 
> 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) {
>   aParticleChange.Initialize(aTrack);
>   if (aStep.GetPostStepPoint()->GetStepStatus()==fGeomBoundary) { 
>     // PERFORM PARTICLE CHANGES HERE
>     return &aParticleChange;
>   } else return &aParticleChange;
> }
> 

 Add Message Add Message
to: "Re: 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 ]