Post Processing with Paraview

Dear Community,

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.

Best regards,
Nikos.

Hi @Nikos

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.

Thanks

Andy

Dear @makeclean,

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.

Any suggestions?

With appreciation,
Nikos.

beampipe_24.zip (722.1 KB)

Hi @nnikolop

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.

Thanks

Andy

Hi @makeclean,

you are absolutely right, I got carried away and gave the binary file instead, sorry about that…

After providing the ASCII file I got from the flair converter, I now get this MOAB error:

and no .vtk is produced. I am not sure what to do next or what is the cause of the error whatsoever.

Thank you for your support,
Nikos.

Hi @nnikolop

Try doing

tally_data.write_hdf5("fluka_tally_22_nflux.h5m")

If that works, you can then convert to vtk on the command line, using the mbconvert command in the moab/bin directory

mbconvert fluka_tally_22_nflux.h5m fluka_tally_22_nflux.vtk

Let me know :slight_smile:

Thanks

Andy

Okay, it seems that I get a similar error for the .h5m case too:

which is unfortunate.

Hi @nnikolop

Hmm, I did the following

from pyne.fluka import Usrbin
data = Usrbin("beampipe_24_bnn.asc")
tally = data.tally['BeamEn']
tally.write_hdf5('test.h5m')

I used usbrea to convert

And after vtk’ing i get this below

Could you have another go, just in case?

Thanks

Andy

Dear @makeclean,

I am glad to see that creating a .h5m file works for you, but this is strange because the same error persists in my case…

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.

Best regards,
Nikos.

Hi @nnikolop

Could you share how you build moab,which cmake options? Did you use the system hdf5 or did you build your own?

Thanks

Andy

Hello @makeclean,

I followed exactly the instructions under the “MOAB Installation” section of the link below:

Installing dependencies — DAGMC.

Do I have to somehow alter the configuration commands in the MOAB build procedure?

…/src/configure --enable-optimize
–enable-shared
–disable-debug
–with-hdf5=$HOME/dagmc_bld/HDF5
–prefix=$HOME/dagmc_bld/MOAB

Best regards,
Nikos.

Hi @nnikolop

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

Thanks

Andy

Hi @makeclean,

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

…/src/configure --enable-optimize
                --enable-shared
                --disable-debug
                --with-hdf5=$HOME/dagmc_bld/HDF5
                --prefix=$HOME/dagmc_bld/MOAB

and

cmake ../src -DMOAB_DIR=$HOME/dagmc_bld/MOAB \
             -DBUILD_FLUKA=ON \
             -DFLUKA_DIR=$FLUPRO \
             -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH

with

cmake ../src -DCMAKE_INSTALL_PREFIX=.. \
             -DENABLE_HDF5=ON

and

cmake ../src -DMOAB_DIR=$HOME/dagmc_bld/MOAB \
             -DBUILD_FLUKA=ON \
             -DFLUKA_DIR=\usr\local\fluka\bin \
             -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH \
             -DCMAKE_BUILD_TYPE=Debug \
             -DENABLE_HDF5=ON

and completely skip the “HDF5 Installation” part as described in the aforementioned link?

How can I include the omitted (–enable-optimize, --enable-shared and --disable-debug) options to the cmake command necessary for installing MOAB?

Concluding, will FluDAG behave properly if an HDF5 folder is not included inside the dagmc_bld directory?

With appreciation,
Nikos.

Dear @makeclean,

I hope that you are well.

I am revisiting this topic because I am unable to rebuild MOAB, dagmc and pyne using the system HDF5.

Could you provide the cmake commands for rebuilding MOAB and dagmc which make use of the system HDF5 instead of the HDF5 dependency described here?

Best regards,
Nikos.

Hi Nikos

Sorry, I’ve been on holiday - could you let me know what OS you’re using and I’ll write some scripts to do the building.

It should be case that for MOAB, the following should work

cd moab
mkdir bld
cd bld
cmake .. -DCMAKE_INSTALL_PREFIX=.. -DENABLE_HDF5=ON
make -j
make install
cd .. 
cd ..

Should do the job

Thanks

Andy

You can also ignore these

Hi @makeclean,

of course I am working on WSL 2 environment on a W10 pc.

Ubuntu version can de found on the screenshot below.

ubuntu_version

Gratefully,
Nikos.

Hello @makeclean,

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.

Any suggestions?

Best regards,
Nikos.