Revolving 2D data
Sometimes when analyzing the output from different codes, it is useful to compare the output of a 3D code versus the output of a 2D code. In that case, and for certain geometries, it can be useful to revolve the 2D code's output into 3D where it can be compared against the 3D code's results. This page shows a script that reads in a 2D file and revolves it into 3D, saving out all of the scalar variables too. The output format is Silo by default but it can be changed (see Exporting databases).
def revolve_dataset(infile, outfile): DeleteAllPlots() OpenDatabase(infile) # Do a plot of the first scalar and make a list of scalars to export md = GetMetaData(infile) scalars =  for i in range(md.GetNumScalars()): if i == 0: AddPlot("Pseudocolor", md.GetScalars(i).name) scalars = scalars + ["default"] else: scalars = scalars + [md.GetScalars(i).name] AddOperator("Revolve") DrawPlots() # Export the database dbAtts = ExportDBAttributes() dbAtts.db_type = "Silo" dbAtts.filename = outfile dbAtts.variables = tuple(scalars) ExportDatabase(dbAtts) DeleteAllPlots() # Revolve the rect2d.silo dataset and save it out as rev-rect2d.silo revolve_dataset("/usr/gapps/data/rect2d.silo", "rev-rect2d")