Error during run with mgdraw user routine

Dear Fluka Expert,
Kindly help me to check both input and mgdraw files. when i run i get error message. i want to get the position of emmission, angle, energy distribution and weight of the neutron leakage from the target to tally.My.flair (2.0 KB)
My.inp (1.6 KB) mgdraw.f (5.2 KB)

Dear fluka expert,
I dont know why my outdata.txt file is empty after running successfully.
My.flair (2.1 KB) My.inp (1.5 KB)

Dear Saheed,

I had a check on your flair project and input file, and I don’t see any particular issue. The reason why your run goes smoothly but outdata.txt is not produced is because you have USRDUMP with WHAT(3)=1 (i.e. Source in Flair) so the entry BXDRAW will not be called. You should put it at least to 2 (See the manual page for USRDUMP)

The code you have written would then not work because you ask for region names that would not have exact correspondence with the ones that you have in the input file. You must also add a SAVE statement to prevent the variables containing the region number from becoming undefined at the next call of the routine. Instead of using STOP you can call FLABRT to abort the run in case of errors and printing a useful message to the output. It is always good practice to print message to standard output at the first call so you can easier spot problems that might occur :wink:
Since you have an open statement directly in your routine, there is no need to specify the unit in your USRDUMP card. Please have a look at my suggestions
mgdraw.f (5.9 KB)

This should solve you issues with mgdraw but there could be a simpler solution for your needs. To score the double differential neutron fluence in energy and angle I would suggest to use the USRBDX scoring card: it is a built-in scoring so you could profit from all the built-in postprocessing and plotting. You can have a look at the manual page for USRBDX to best set it up for your case. Mind that you would have to normalize correctly for the area of the surface and that the solid angle is intended to be 2\pi(1-\cos\theta) where \theta is the angle between the particle trajectory and the surface normal.
Together with the few tweaks above, I have added an example in this input file
example.inp (2.0 KB)

Let me know if something is not clear or if you need further help :wink:
Cheers,
Davide

PS: I have a general suggestion regarding the material definition.
When defining materials with the MATERIAL card I personally would not fill the WHAT(4) if your input is name-based. It’s ok for a very simple input but can be error prone for a complex case with many cards: you would have to make sure that the number sequence is interrupted, and you might override a number that has already been assigned. Unless necessary, I would not overwrite the atomic weight and leave it blank: if you leave the mass number blank, the atomic weight will be computed from the natural composition (which is what I assume you intended to do).

Dear David
Thanks for your response. I will do the necessary correction as you suggested and update you.

A post was split to a new topic: Defining PbBi compound