# Obtain average pressure over a range of slices?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 11, 2013, 10:55 Obtain average pressure over a range of slices? #1 Member   Ken Join Date: Aug 2012 Posts: 63 Blog Entries: 1 Rep Power: 5 I am trying to post-process some data in an irregular geometry with internal flow. I have created a range of x-normal slices, and would like to calculate the average pressure over each slice. However, when I apply the 'Integrate Variables' filter in paraview, I obtain the average pressure over the entire range instead of the average pressure over each slice. I could of course manually move a single slice and write down data points, but this is tedious if I want the average at say 100 different x-positions. Is there a faster way to do this? Thanks! -Nuc

April 11, 2013, 11:45
#2
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
Quote:
 Originally Posted by Nucleophobe I am trying to post-process some data in an irregular geometry with internal flow. I have created a range of x-normal slices, and would like to calculate the average pressure over each slice. However, when I apply the 'Integrate Variables' filter in paraview, I obtain the average pressure over the entire range instead of the average pressure over each slice. I could of course manually move a single slice and write down data points, but this is tedious if I want the average at say 100 different x-positions. Is there a faster way to do this? Thanks! -Nuc
In OpenFOAM the way to go would be a sampleSurface. I'm a bit ignorant and not sure whether there is a built-in utility in OF that does averaging on them (sample at least writes them out). I'd do it in swak4foam where you can do calculations on those (area weighted average pressure would be "sum(area()*p)/sum(area())"). The thing that swak does not solve is the 100 slices. But instead of tediously generating them by hand you could generate the definition of the 100 functionObjects via a script ... which stretches the definition of easy for most people ... I know (there is even something built into swak to do the generation on the fly ...)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 April 11, 2013, 12:52 #3 Member   Ken Join Date: Aug 2012 Posts: 63 Blog Entries: 1 Rep Power: 5 Hmmm.. This isn't exactly what I'm looking for. The advantage of doing this is in Paraview is that I can clip the geometry so that the slice only passes through the region in which I am interested. I have been trying to accomplish my goal by: 1) Creating a slice, say at x = 0 2) Applying the 'Integrate Variables' filter to the slice 3) Animating the slice offset, so that it moves from x = 0 to x = 10 over 10 seconds 4) Applying 'Plot selection over time' to the result of 'Integrate Variables' This ALMOST works. The variables in the 'Integrate Variables' table update during the animation as desired. However, the plot (step 4) does not work, and the data from the table is not saved during the animation. Edit: Basically I'm trying to do the same thing as what was discussed here: http://www.paraview.org/pipermail/pa...er/019544.html It looks like programming an extra filter is the best way to go? Any ideas on how to save the results from 'Integrate Variables' at each animation time step?

April 11, 2013, 13:11
#4
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
Quote:
 Originally Posted by Nucleophobe Hmmm.. This isn't exactly what I'm looking for. The advantage of doing this is in Paraview is that I can clip the geometry so that the slice only passes through the region in which I am interested. I have been trying to accomplish my goal by: 1) Creating a slice, say at x = 0 2) Applying the 'Integrate Variables' filter to the slice 3) Animating the slice offset, so that it moves from x = 0 to x = 10 over 10 seconds 4) Applying 'Plot selection over time' to the result of 'Integrate Variables' This ALMOST works. The variables in the 'Integrate Variables' table update during the animation as desired. However, the plot (step 4) does not work, and the data from the table is not saved during the animation. Edit: Basically I'm trying to do the same thing as what was discussed here: http://www.paraview.org/pipermail/pa...er/019544.html It looks like programming an extra filter is the best way to go? Any ideas on how to save the results from 'Integrate Variables' at each animation time step?
"Programmable Filter" where you can have a small Python-program do whatever you want with the input (you'll need a Python-enabled Paraview for that anyway). And if you can do "whatever" then you could for instance append the data that comes in to a file. But don't ask me how to do it exactly. Last time I experimented with this is quite some time ago (and you'll probably have to erase the file before starting the animation)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 April 11, 2013, 13:43 #5 Member   Ken Join Date: Aug 2012 Posts: 63 Blog Entries: 1 Rep Power: 5 Got it: Code: pdi = self.GetInputDataObject(0,0) localAArray = pdi.GetCellData().GetArray("Area") localPArray = pdi.GetCellData().GetArray("p") localA = localAArray.GetTuple(0)[0] localP = localPArray.GetTuple(0)[0] fout = open("/home/myUserName/results.txt",'a') print localA print localP data=str(localA)+'\t'+str(localP)+'\n' fout.write(data) fout.close() gschaider, wyldckat, caduqued and 1 others like this. Last edited by Nucleophobe; April 11, 2013 at 16:04. Reason: Fixed code

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Wijaya FLUENT 14 August 26, 2015 06:02 florian_krause OpenFOAM 108 June 9, 2015 08:13 joshi20h FLUENT 0 September 26, 2012 12:41 Vitalij FLUENT 1 April 10, 2007 03:39 Antech Main CFD Forum 0 April 25, 2006 02:15

All times are GMT -4. The time now is 02:16.