I have a user that would like to find the average or mean of a variable over a block. This is on a large dataset, and only loads into ParaView on a cluster. Thus, I need a parallel solution. This is on a multiblock dataset.
You should be able to use Python Annotation and an expression like
arrayName is the name of the array and
blockId is the block ID. Make sure to set the Array Association appropriately to make the array names available as variables in the Python expression, e.g., “Point Data” or “Cell Data”.
Thanks Cory! Won’t this double count Points between processor boundaries? I assume ghost cells won’t help here either?
Unfortunately, it will indeed double count points/cells duplicated across ranks.
If you are finding the mean of cell data and have ghost cells, you should be able to apply Remove Ghost Information to avoid double counting cells.
@cory.quammen I tried what you said, and it didn’t work. Here is what I did:
- 5.6.0, Linux, builtin server.
- Open can.exo. All variables on. Apply.
- (Check with the spreadsheet which blocks are which. Currently, blocks are named 2 and 3. Grrr).
- Python Annotation. Expression is mean(ACCL.Arrays). Apply.
Error message is name ‘ACCL’ is not defined.
What are my user and I doing wrong?
Make sure that the Array Association is set to “Point Data”.
As for the array index, admittedly this will be an unsatisfying answer, but the
Arrays[blockIdx] is the linear index of the leaf datasets in the block structure if you perform an in-order traversal of the multiblock data structure, not the number in the spreadsheet or the Find Data dialog. For can.exo, there are two blocks index 0 and 1. This is not an ideal way to address blocks in a Python expression, but its what we have available.
Probably a better thing to do is add an Extract Block filter to extract the block you want to find the mean of followed by a Python Annotation with the expression
mean(ACCL). That saves you the trouble of figuring out the array index from the block structure.