exporting a specific data out of paraview

Hi;
I have completed a simulation in OpenFoam. My domain has over 15 million cells.
One of the arrays I am loading into ParaView is volume of each cell (called V, available for each cell). Others are velocity, pressure, gradU, vorticity, etc.
Now, I am going to calculate some volume-average values for the entire domain. Like, for example consider X as an array defined for each cell. I want to calculate:
volumeAverageX=sum(X * V) / sum(V)
The numerator is the cell’s X value multiplied by the cell’s volume, integrated over the entire mesh domain divided by the volume of the entire domain.
What I am doing right now is create a python calculator filter with the expression “sum(X * V) / sum(V)”.
ParaView calculates it and everything is fine. But the problem is that when I open the spreadsheet to find out about this value, ParaView reports this value for all the cells in the spreadsheet, which all of them are the same of course, because this value is a single value calculated for the entire volume.
Now when I want to copy this volume-average value from one of the cells in the spreadsheet (by mouse selection), it just crashes, because of the huge list of cells (over 15 million). Note that I am able to take a look at the value in the spreadsheet and just manually write it down on a notepad or something, but since it is a value with lots of digits and also have to repeat it for 60 other cases, I am looking for a more systematic approach. I have been so far unsuccessful in copying the exact value for the desired volume-average. Note that saving the data is also not an option, because ParaView again crashes due to large number of cells, and even if it manages to save the data, opening the exported csv file will be a hassle.
So, is there anyway I could get this single volume-average value somewhere without dealing with my crashing spreadsheet?

A crash for a large number of cells in not ok, unless you are running out of memory, so you may want to check that first.

A simple workaround maybe to use the DescriptiveStatistics filter to compute the average which will reduce the millions of values to a single one.

In any case, your current pipeline is highly inneficient, and you may be able to use another filter instead of the python calculator. I’m still unsure of your computation to suggest one.

1 Like

Thanks Mathieu!
Yes, I know my current pipeline is inefficient, and am trying to make it as efficient as possible.
Maybe I was not exact when I used the word “crash”. By crash I mean, it took so long (+30min) that it does not make sense to wait more, so I killed the application. I think adding more RAM will help, but it is not an option right now for me.
Anyway, I will see if the DescriptiveStatistics filter will work for me or not.
Thanks

Where can I find an example of how to use DescriptiveStatistics?
I just have zero experience with this filter and could not find anything in ParaView manual.

Just use it on your data and you should be fine.

1 Like