CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Averaging field over a spatial direction (

fs82 August 7, 2009 08:14

Averaging field over a spatial direction

I searched the forum but I didn't found a solution for my problem. I have a 3d cylinder case, with periodic boundaries in spanwise direction. For postprocessing, in detail for comparing my solution to a certain paper, I need some mean-velocity profiles of the wake. I use the sample utility to get horizontal lines (y-coordinate) at different downstream positions (x-coordinate), this works fine. But I want to average, or collapse the mean velocity field in spanwise direction (periodic z-coordinate) first, before I extract the profiles. Is there a tool available which averages a field for a given spatial direction? I have read something about patchAverage, but I dont want to average a patch. After averaging it would be great to use sample for getting the profiles. So may be somebody experienced the same problem and found a solution?


sega August 7, 2009 11:20

When you are talking about a "3d cylinder case" and a "wake" you are doing an external flow simulation, right?

fs82 August 10, 2009 02:36

Yes it is a 3d case with a flow around a cylinder.

sega August 10, 2009 02:42

Ok. I was asking because I haven't heard of averaging in external flow simulations so far. All I have dealt with was the averaging in internal channel flows.

So you are using a turbulent solver? Aren't some of them producing mean flow fields?!

fs82 August 10, 2009 03:01

The channel is similar to what I'am looking for. The postChannel averages over both periodic spatial directions in a channel case. But now I want to average not over two spatial directions, but just over one spatial direction. So I need a utility which averages a given field, e.g. UMean over z. I thought about rewriting the postChannel tool, but the amount of work to do this is for this one comparison a little bit to much. So my hope was, that anybody has done this allready.
I'am using the oodles solver and I allready have the UMean und UPrimeToMean fields. But I need the UMean field averaged in z direction, to get UMean(y) at different x locations in the wake of my cylinder :-D

cfdmarkus August 10, 2009 03:55

Hi Fabian,

have a look at this thread:


fs82 August 10, 2009 06:46

Yeah this looks good, but I get a Segmantation fault. I think the Problem is my geometry, in detail the cylinder. Do you have tried averaging with a similar case?

cfdmarkus August 10, 2009 07:00


I haven't had the time to test the tool yet, but I would hope that it works for all geometries. It probably does not work for unstructured grids.

I am actually quite interested in your findings since I am doing a two tandem cylinder case at the moment and I was going to use this tool as well.

Maybe you can try using it on the channelOodles tutorial case that comes with OF.

Let me know if you get it to work!

fs82 August 11, 2009 04:15

Hi Markus,

is tested the tool yesterday and it didn't work. It has a problem with my geomtry. The routine which extracts the mesh points along a straight line normal to the wall produces strange id values for the mesh points. I allready asked Frederic, the author of the tool, with this problem. He is very busy at the moment, but is working on the problem.

fs82 August 11, 2009 09:20

Allright, after spending 2 days of work for this problem I decided to use Tecplot for calculating the average. The only usable way to get averaged profiles in z direction for my case is: use sample utility to extract the desired profile at different z positions, import the raw-files into tecplot and average over the zones. This is time-consuming but works.

cfdmarkus August 12, 2009 10:44

thanks for the update.
I also tested the tool and I get exactly the same error as you did.
I haven't had the time to look into the code in more detail but I guess, I will do this at some point and see whether I can modify it.


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