Plotting data from FLASH files

This script was contributed by Kenneth Dere, Research Professor of Solar Physics at George Mason University.

# assume this file is named visit_test.py
# callling syntax:
# > python -i visit_test.py myfilename
# ipython > %run visit_test.py myfilename
import sys
filename=sys.argv[1]
import visit
try:
    visit.Launch()
    visit.OpenComputeEngine('localhost')
except:
    pass
args = ('-assume_format', 'FLASH')      # Note: see below for the  
visit.OpenMDServer('localhost', args)   #       recommended substitution 
visit.OpenDatabase(filename)            #       for these three lines.
visit.AddPlot('Pseudocolor', 'mesh_blockandlevel/vely')
p = visit.PseudocolorAttributes()
p.minFlag = 1
p.min = -2.e+6
p.maxFlag = 1
p.max = 2.e+6
p.colorTableName = 'hot'
visit.SetPlotOptions(p)
visit.DrawPlots()
visit.CloseComputeEngine('localhost')


DEPRECATION WARNING

The "-assume_format" argument has been deprecated, beginning in VisIt 2.0. However, there are other options:

1. Specify the FLASH file format reader when opening the file, e.g. remove the setting of this argument and the manual launching of the MDServer, and replace the OpenDatabase line with this (noting that "0" signifies to open the file at its first time state):

visit.OpenDatabase(filename, 0, "FLASH_1.0")

This works in current 1.x versions (1.12) as well as the upcoming 2.0.

2. In version 2.0, you can now set preferred file formats without needing to use command-line arguments. e.g. remove the setting of -assume_format and the manual launching of the MDServer, and replace the OpenDatabase line with these two lines:

visit.SetPreferredFileFormats("FLASH_1.0")
visit.OpenDatabase(filename)

This only works in version 2.0 and above.