How to calculate depth averages in ParaView

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Search this Thread Display Modes
 June 3, 2019, 11:40 How to calculate depth averages in ParaView #1 Senior Member   Join Date: Jul 2013 Posts: 116 Rep Power: 10 Hi All, Suppose I have output velocity/pressure from an OpenFOAM simulation. Is it possible to use ParaView to calculate the depth-averaged velocities? I do not have any experience with the custom filters. For example, suppose I modify the cavity tutorial to be 3D, and then I want to look at the depth-averaged velocity profile. How can I do that with ParaView? Thanks so much Edit: I'm sorry, I just saw that there is a separate ParaView forum, but I am unable to delete or move this thread.

 October 29, 2020, 17:14 #2 Senior Member   Join Date: Jul 2019 Posts: 148 Rep Power: 3 I am wondering if you found the way. Thanks.

 October 29, 2020, 20:31 #3 Senior Member   Join Date: Jul 2013 Posts: 116 Rep Power: 10 I never found a way to do this. I'm guessing with a simple regular grid you could just program it in the python filter.

 October 29, 2020, 21:02 #4 Senior Member   Join Date: Jul 2019 Posts: 148 Rep Power: 3 Thanks for the reply. I have been looking into this for a while and could not get any useful answer. In my case, I have 2D domain (x-y plane) and I want to average the phase fraction at every y and repeat the process at each time step. The mesh I am using is rectangular, but it is non-uniform. I normally do my postprocessing with MATLAB; however, I find it difficult to do the area weighted average on the interpolated data which I extract from OpenFOAM (i.e. no information on the area of each cell).

 October 30, 2020, 08:36 #5 Senior Member   Join Date: Jul 2013 Posts: 116 Rep Power: 10 One thing you could possibly try is to use a slice filter at each x value, and use the integrate variables filter to find the average for that x. Then you can write a macro that changes the x values of the slice filter and records the corresponding average.

October 30, 2020, 08:47
#6
Senior Member

Join Date: Jul 2019
Posts: 148
Rep Power: 3
Quote:
 Originally Posted by wildfire230 One thing you could possibly try is to use a slice filter at each x value, and use the integrate variables filter to find the average for that x. Then you can write a macro that changes the x values of the slice filter and records the corresponding average.
Thank you for the suggestion. Right, I did it for one slice. Unfortunately, I do not know how to write programmable macros (i.e. I am not a python user). I should look into that. I would appreciate any references if you are aware of any useful ones.

 October 30, 2020, 09:13 #7 Senior Member   Join Date: Jul 2013 Posts: 116 Rep Power: 10 What I have done whenever I need a paraview macro is something like this: 1. Load your case (Apply). 2. Then you want to record a macro where you manually setup the filters and such that you need. In my version of paraview this starts with Tools -> Start Trace. Go with "only *user-modified* properties" in the trace. 3. After that be careful because everything you do will be recorded in the macro, so you only want the necessary commands. Click the slice filter and set it in the correct plane and the correct starting position and then apply it. 4. Then add the integrate variables filter and apply. 5. Then switch to the slice filter and change the x coordinate and apply again. 6. Change the x coordinate and apply again. 7. Change the x coordinate and apply again. 8. Then go to Tools -> Stop trace 9. Then you should save the python code that is generated as a macro. 10. Next, you will need to try to understand the python code it generated. The most important parts will be going near the end of the code there will be probably a line like this " slice1.SliceType.Origin = [-7.0, 0.0, 0.004999999888241291]" Probably you will have multiple of those lines for each time you changed the origin of the slice filter. You will need to learn enough python to write a for loop to iterate over the positions you need, for you I think this is the x-coordinate. The other thing you will need to learn, which I do not know about, is how to access the value of the integrated variables, and then output that value along with the x value into probably a csv file for your data. Sorry that I can't help with this step, but hopefully by trying to understand the code produced in the python trace you will get some hints that will help you google about this. Once you have edited your macro, you can just click it to run the macro again, but make sure your current "state" in paraview is identical to when you started recording the macro. You have to delete all the filters and such before you run the macro again. Also, one thing to note, when I have done something like this before, it was important to set the x values and the dx exactly such that I was cutting through the center of the cells. If you try to take multiple values within a single cell for instance, you might get some small oscillations happening. p, li { white-space: pre-wrap; }

 October 30, 2020, 09:18 #8 Senior Member   Join Date: Jul 2019 Posts: 148 Rep Power: 3 Thank you for your time. Much appreciated.

 Tags depth-averages, paraview

 Thread Tools Search this Thread Search this Thread: Advanced Search 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 Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post snak ParaView 0 October 17, 2016 10:22 buffi OpenFOAM Post-Processing 0 July 20, 2015 08:34 hmasenger CFX 3 January 31, 2015 16:46 lentschi OpenFOAM Installation 1 March 9, 2011 02:32 alain Main CFD Forum 0 March 14, 2006 05:49

All times are GMT -4. The time now is 03:17.

 Contact Us - CFD Online - Privacy Statement - Top