MCNPX running scripts
1. Common pitfalls
- The tab character ('\t') is not allowed. So mind your indentation habits.
- The maximum number of characters per line is 80. Use '&'.
- Using macrobodies and sticking them together will cause some surfaces to be removed.
This might cause a fatal error if you use surface tallies.
Check which surfaces have been deleted in the output file and change the tally surface accordingly. - If you work under Windows and Unix, you surely will experience troubles with line endings.
flip allows you to fix this both ways.
2. A one-line command...
The function below works for any MCNP file having 0 or 1 mesh tally. If you have more, change it accordingly (see the comment inside the function).
The mesh tally output is an ASCII file à la Tecplot (x y z tally dtally).
See here to plot it in a voxelized way in Root.
The extension of your MCNP file has to be .mcn (Moritz convention).
Copy this function in your ~/.bashrc and source it (source ~/.bashrc).
To execute it (from anywhere), just type: mcnprun myMCNPfile.mcn
----------------------------------------------------------------------------
function mcnprun() { #rm -f *.{out,run,tra,mdata,dat} mcnpx i=$1 o=${1/.mcn/.out} r=${1/.mcn/.run} mdata=${1/.mcn/.mdata} && [ -f ptrac ] && mv ptrac ${1/.mcn/.tra} grep -q "^\ *tmesh" $1 && echo -e "mdata\n${1/.mcn/.mdata}\ny\nn\n1\ntecplot\n${1/.mcn/.dat}\nn\n$1\n3\nn\nn" | gridconv 1>/dev/null # ... \n1\ntecplot ... where 1 refers to the data set number. It just depends on the order of appearance of the mesh, no matter it is a [rcs]mesh for flux or data scoring. chmod a-x * && chmod a+rw * } ----------------------------------------------------------------------------
3. Batch processing
Please see my talk (and feel free to have a look here).
4. Multiprocessing mode
Please see here.