Script for averaging over successive shells in visit

Here is a script I wrote in python for averaging over successive shells in Visit, writing to a file, then plotting that file as a .curve in Visit:

What this script does is the following:

  1. Begins with a small sphere (or in my simulations - an octant of a sphere), of radius ~2*dx, where dx=length of smallest cell. The sphere is averaged for the quantity of interest - here rho, and this value, along with the radius, is printed to a file.
  1. The operators are removed, and then added again in a for-loop that adjusts the radius of successive shells to clip and then average. Inverse = 0 means clip (or in other words, get rid of) data within the clip object, whereas inverse = 1 clips data outside of the clip object.
  1. The for-loop iterates over 48 steps, increasing each radius over which to average by ~dx. The for-loop ends at about 1.5 Rbe.
  1. Average-value data written to a .curve file is then plotted and visualized in the Visit window.

Things I learned during this process:

You can record steps you take in making a plot in the GUI, and the GUI can then translate these steps into Python language. I did this for some of the more complicated plot attributes.

The plot needs to be drawn before Visit can query; when you add operators, you must also draw plots in order to query.

Python is pretty cool.

Attachments (3)

Download all attachments as: .zip

Comments

No comments.