Vorpal Blocks in VisIt

VorpalVisIt 0.11

  • Uses VorpalDom
  • Extracts all or some blocks which can be plotted
  • Creates a Visit friendly .h5 file
  • There must be a .in file and “”*_Globals_1.h5″.

Having become frustrated with Matlab’s inability to draw more than about 10,000 electrons without becoming unusable slow I thought I’d have a look at VisIt. It’s always nice to be able to plot the blocks from your .pre file so I thought I’d write something like VorpalPlotter to work with VisIt.


pmlSlab example with blocks plotted

Using VorpalDOM to read the Vorpal .in file and parse it helpfully its actually pretty straight forward to extract the block bounds information. It’s a little harder to persuade VisIt to draw these blocks helpfully. VorpalVisIt writes the block bounds to a “*_Block.h5″ file. If you open this in visit you can plot the blocks using the mesh function. This allows you to colour them and change their opacity.

If you want to plot fields over the top of the blocks the colours disappear sadly, but you can still see the outlines.


pmlSlab with fields and blocks

This is a much better option than plotting with matlab (although it isn’t quite as pretty) as VisIt deals with large data sets fairly well. Matlab is a disaster area.


pmlSlab example with vector fields and blocks

To generate the “*_Block.h5″ file all you need to do is download the zip from this page and edit blocks.py.

from VorpalIn import *
from VorpalBlocks import *

vFile = VorpalDOM('pmlSlab.in')
extractor = BlockExtractor(vFile)

The plotNamedBlock allows you to extract only certain blocks (plotTypedBlock allows the same with block types) and * is a wildcard. This short bit of code automatically creates the blocks file. To make my life a bit easier I’ve copied some variables visit needs from the “*_Globals_*.h5″ files, so you have to at least have “”*_Globals_1.h5″.


  1. Might be worth playing with the line width to make the blocks a bit clearer when you’re plotting fields as well. I also recommend the three-slice operator, so you’re looking at the field potentially somewhere more interesting.

  2. This function works, and visit can open the h5 file, but there is nothing to plot for whatever reason.
    It seems that chris did an update in may 2012. http://www.thousandmonkeys.com/?m=201205. This one works great. I spent a few hours debugging/learning the old code when the good code exists here. I wanted to spare anyone else from the pain.

    Thanks Chris for the script, and the code is very well commented and organized.

    • Chris Lingwood

      I think you’ve probably come across a bug in visit. For some reason it won’t plot mesh items with 0 or 1 cells in any direction any more (since 2.4 I think). All the blocks drawn with this script get killed by that bug. Took me ages to work out what was going on.

      The other scripts are better and include a fix for that issue.

Leave a Reply