I have managed recently to run simulations on CAD defined geometries using flair in combination with FluDAG.
I am now interested in post-processing .bnn files using Paraview, in a way similar to flair’s geoviewer where one could visualize the .bnn file data projected on the geometry of interest.
I tried importing the .dat file, which is produced by flair after plotting .bnn files, to Paraview, but I haven’t been able to plot it yet. Any suggestions on how to visualize .bnn files using Paraview would be gratefully accepted.
You can trivially convert the DAGMC geometry to an STL file for plotting with Paraview/Visit (I personally prefer Visit but each to their own), using the mbconvert tool which can be found in the moab/bin directory
mbconvert dagmc.h5m geometry.stl
When it comes to conversion of the tally data, a few years ago we wrote some routines in the PyNE toolkit for the conversion of FLUKA Usrbin tallies. Firstly go grab PyNE - Python for Nuclear Engineering (pyne.io for documentation and github.com/pyne/pyne for the code).
git clone https://github.com/pyne/pyne
cd pyne
python3 setup.py install --user --moab <path to >/moab --dagmc <path to>/dagmc
This should, go off and install PyNE for you - it does depend upon a few libraries, so this will go off and grab them. It also depends upon MOAB and DAGMC, so in the case of MOAB make sure you’ve build the pyMOAB package, this is quite easy from the MOAB build directory (the one you made when you configured CMAKE - make sure you enabled pymoab = -DENABLE_PYMOAB=ON
cd pymoab
python3 setup.py install --user
When you’re all built, you should be able to launch convert FLUKA USRBIN’s, typically I would use flair to combine the USRBIN’s and then convert the combined file to ASCII (we only wrote an ASCII parser)
from pyne.fluka import usrbin
mesh = Usrbin('fluka_tally_22.bnn)
print(mesh.tally.keys() # this will tell you the tally names
tally_data = mesh.tally["NFLUX"]
tally_data.write_hdf5("fluka_tally_22_nflux.vtk")
You can then load your STL and your USRBIN concurrently and have all the features of Paraview/Visit at your disposal.
thank you for your detailed response! I have successfully installed pymoab as you indicated and I am now having trouble producing the .vtk file you end up with in your Python script.
I am providing my .bnn file as an attachment in case you would like to verify my outcome. The problem is that I get an empty dictionary and I can’t proceed to generate the .vtk file.
I think in this case, looking at your file, I think I mentioned it about, but maybe I forgot, you must convert the bnn file to ASCII before this reader can read it. We never got around to writing a binary version, but I think if you use the binary->ascii converter in Flair, or the usbrea executable from the FLUKA bin directory, then I think it will work fine for you.
What I did was to right click on the .bnn file under the Run/Files tab of flair and then select the “to ascii” option which produced the ascii file I provide as an input to the Usrbin function. Could a MOAB reinstallation solve this problem? Thank you for your support.
I would try the following, reconigure the stack to use the system HDF5 instead, so sudo apt-get install libhdf5-dev or dnf install hdf5-devel
Don’t build the HDF5 library yourself, reconfigure the stack - i.e. rebuild moab, dagmc, and pyne using that system HDF5. This maybe a religious point, but I would use cmake to build MOAB rather than autotools.
cd moab
mkdir bld
cd bld
cmake .. -DCMAKE_INSTALL_PREFIX=.. -DENABLE_HDF5=ON
make -j4
make test
make install
thank you for the continuous support on this matter!
In order to build MOAB and DAGMC using the system HDF5 is it sufficient to replace the autotool command in the MOAB installation procedure and the cmake command in the FluDAG installation part i.e. the commands
just as an update, I tried to build MOAB using the cmake command you provided. The following screenshot includes the whole process that I followed, resulting to a CMake Error i.e.
CMake Error: The source directory “/mnt/c/users/nnikolop/desktop/dagmc_bld/MOAB” does not appear to contain CMakeLists.txt.