Dear colleagues,
in my simulation I’d like to stop the simulation of current event and advance to the next one in case a specific “trigger” takes place - the trigger, in my case, is the passage of a particle through a given volume.
To do so, currently I am implementing this algorithm:
In mgdraw, entry bxdraw, I am checking for the passage of the particle through the volume I am interested in. If this occurs, I set a global variable killEvent to one (technically, I do this by a call to a C function, defined in a object file that I link to my executable). This variable is initialized to 0 at the beginning of each event
I activate usrmed in all materials, and in this I check if the killEvent variable is one. If so, I set WEE=zerzer.
Is there a better way to do so?
Thanks,
Bests,
Andrea
I had a very similar problem, and the solution that was suggested to me is pretty much what you already do. The most notable difference is the suggestion to check for the kill variable only where necessary (if the geometry and the logic of the problem allow it) to save some CPU time.
This can e.g. be done by creating copies for the materials surrounding the trigger volume and activating usrmed for those materials only.
Hi @rmartin, thanks for your feedback. Indeed, the suggestion to check the variable only where necessary is really nice, I’ll try to implement this.
Maybe we can ask to FLUKA developers to add this feature in the next release - just make a single call to force all stacks to be immediately flushed and the current event to be “killed”, jumping to the next primary.