CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Post-Processing

Spanwise averaging of three-dimensional field

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

Like Tree8Likes
  • 1 Post By Fuchs
  • 3 Post By Fuchs
  • 1 Post By Fuchs
  • 3 Post By catapult

Reply
 
LinkBack Thread Tools Display Modes
Old   September 13, 2012, 11:46
Default Spanwise averaging of three-dimensional field
  #1
New Member
 
Marian Fuchs
Join Date: Dec 2010
Location: Berlin, Germany
Posts: 9
Rep Power: 6
Fuchs is on a distinguished road
Hi everyone,

i'm currently running a NACA0021 profile in 3D. Since the mean flow field for this case is basically 2D, the common procedure for post-processing is to average the 3D flow field in spanwise direction (z) to obtain a two-dimensional field of all mean quantities. I'm wondering if there is already a post-processing utility for this purpose available within the community, since spanwise averaging is a common procedure for many (at least) academic cases (e.g. airfoils, cylinders, etc.). I know that OpenFOAM contains the utility "postChannel", maybe someone has already modified the utility so that it does averaging in only one spatial direction instead of 2 and outputs a two-dimensional field?

Thanks for your help,
Marian
rajibroy likes this.
Fuchs is offline   Reply With Quote

Old   October 12, 2012, 16:44
Default
  #2
Senior Member
 
Awais Ali
Join Date: Feb 2010
Location: Germany
Posts: 125
Rep Power: 8
owayz is on a distinguished road
Send a message via MSN to owayz
Hallo Marian,
Did you get any easy method to perform spatial averaging?
Regards,
awais
owayz is offline   Reply With Quote

Old   October 23, 2012, 06:14
Default
  #3
New Member
 
Marian Fuchs
Join Date: Dec 2010
Location: Berlin, Germany
Posts: 9
Rep Power: 6
Fuchs is on a distinguished road
Hi Awais,

I managed to modify the "postChannel" utility to do the spanwise averaging. Unfortunately, the output is still not optimal. A 3D field is output, which is of course averaged in one particular spatial direction (so that the field can be viewed in paraview like any other field). A header in the output is still missing, the data is currently written as ASCII only. I hadn't had the time to implement it, yet. If you like I can provide you with the source code of my utility and you can add the missing feature.

best regards,
Marian
Fuchs is offline   Reply With Quote

Old   November 12, 2012, 10:48
Default
  #4
Senior Member
 
Awais Ali
Join Date: Feb 2010
Location: Germany
Posts: 125
Rep Power: 8
owayz is on a distinguished road
Send a message via MSN to owayz
Hallo Marian,
Sorry for the late reply. I was trying someother utilities is well. But seems like I will have to work on this thing.
If you could provide me the code, I would like to complete it.
Regards,
Awais
owayz is offline   Reply With Quote

Old   November 15, 2012, 10:23
Default
  #5
New Member
 
Marian Fuchs
Join Date: Dec 2010
Location: Berlin, Germany
Posts: 9
Rep Power: 6
Fuchs is on a distinguished road
Hallo Awais,

sorry for the late reply, I had the last few days off. Here is the source code of my utility. I attached a small test case as well,
a simple channel with 3 cells in the homogeneous direction. To fix the output problem, it is probably best to look first into the
source code file 'collapse.H'. I tested my utility for a flow around a NACA0021 profile (grid had about 1.8 mio. cells and 134 cells
in spanwise direction) and the results looked good, so the basic algorithm which performs the averaging seems to work. Let me know if anything is unclear or if you face problems running the utility. I'd be glad if you could send me the modified source code in case you succeed in fixing the output.

best regards,
Marian
Attached Files
File Type: gz postSpanwiseAverage.tar.gz (12.9 KB, 43 views)
sunliming, kreddy and rajibroy like this.
Fuchs is offline   Reply With Quote

Old   November 29, 2012, 09:33
Default
  #6
Senior Member
 
Awais Ali
Join Date: Feb 2010
Location: Germany
Posts: 125
Rep Power: 8
owayz is on a distinguished road
Send a message via MSN to owayz
Hi Marian,
Thanks for sharing the code. I can definitely see the issues you pointed out.
I just have a small question can we use volScalarFields instead of scalarFields?
Regards,
awais
owayz is offline   Reply With Quote

Old   November 30, 2012, 00:26
Default
  #7
Senior Member
 
Awais Ali
Join Date: Feb 2010
Location: Germany
Posts: 125
Rep Power: 8
owayz is on a distinguished road
Send a message via MSN to owayz
Hi Marian,
I made a small change to write the average Fields in peoper form. It still writes the whole averaged value on all the intenal cells. But the boundary field is zero. but I guess thats OK since we are only interested in averaged value we can check it anywhere in the mesh.
Code:
    volScalarField avgUx
    (
	IOobject
	(
	    "avgUx",
	    runTime.timeName(),
	    mesh,
	    IOobject::NO_READ,
	    IOobject::AUTO_WRITE
	),
        mesh,
        dimensionedScalar("avgUx", dimVelocity, 0.0)
    );
    scalarField spanavgUMeanX
    (
        meshIndexing.collapse(UMean.component(vector::X)())
    );

    avgUx.internalField() = spanavgUMeanX;
    avgUx.write();
Tell me if this looks ok.

regards,
Awais
owayz is offline   Reply With Quote

Old   December 2, 2012, 20:42
Default
  #8
Senior Member
 
Awais Ali
Join Date: Feb 2010
Location: Germany
Posts: 125
Rep Power: 8
owayz is on a distinguished road
Send a message via MSN to owayz
Hi Marian,
Here is the modified utility
Thanks again, it will help me alot.

regards,
Awais
owayz is offline   Reply With Quote

Old   December 2, 2012, 20:45
Default
  #9
Senior Member
 
Awais Ali
Join Date: Feb 2010
Location: Germany
Posts: 125
Rep Power: 8
owayz is on a distinguished road
Send a message via MSN to owayz
Sorry was unable to attach in 1st post.
Attached Files
File Type: gz postSpanwiseAverage.tar.gz (17.2 KB, 71 views)
owayz is offline   Reply With Quote

Old   December 2, 2012, 22:24
Default
  #10
Senior Member
 
Awais Ali
Join Date: Feb 2010
Location: Germany
Posts: 125
Rep Power: 8
owayz is on a distinguished road
Send a message via MSN to owayz
Sorry again. I forgot to write the averaged data. After each calculation we should write avgUx, avgUy, avgUz and avgP.
so it could be done by adding:
Code:
avgUx.write();
And doing the same for Uy , Uz and P as well.
Regards,
awais
owayz is offline   Reply With Quote

Old   December 2, 2012, 22:48
Default
  #11
Senior Member
 
Awais Ali
Join Date: Feb 2010
Location: Germany
Posts: 125
Rep Power: 8
owayz is on a distinguished road
Send a message via MSN to owayz
Only problem is that the values at the boundaries is written zero.
owayz is offline   Reply With Quote

Old   December 4, 2012, 07:28
Default
  #12
New Member
 
Marian Fuchs
Join Date: Dec 2010
Location: Berlin, Germany
Posts: 9
Rep Power: 6
Fuchs is on a distinguished road
Hallo Awais,

thanks for your effort and for sharing the modified code. I guess the boundary value isn't really a problem, but that depends of course on your application and what you're trying to post-process exactly...

best regards,
Marian
Fuchs is offline   Reply With Quote

Old   June 20, 2014, 18:14
Default
  #13
New Member
 
Manjura Maula Md. Nayamatullah
Join Date: May 2013
Posts: 21
Rep Power: 4
mmmn036 is on a distinguished road
Hello,

I would like to use this tool for my case to do the span-wise averaging of fields. But in my case the boundary value are important for post processing.

Did you guys include the boundary value in that utility or give me an idea to include the boundary to that source code?

I would appreciate your help.

Thanks
MMMN
mmmn036 is offline   Reply With Quote

Old   June 24, 2014, 06:07
Default
  #14
New Member
 
Marian Fuchs
Join Date: Dec 2010
Location: Berlin, Germany
Posts: 9
Rep Power: 6
Fuchs is on a distinguished road
Hi Manjura,

which type of boundary condition are you exactly referring to? I've started to work on an updated version of my code some time ago but haven't had the time to finish and test it yet. The new code in fact copies the boundary conditions of the original variable to the time-averaged field, but does not perform any additional operation on the BC's. Plus it now runs in parallel, also the domain should not be devided in spanwise-direction for the utility to work.

I'll upload the new code as soon as its finished, which will be in probably 2 weeks.

best regards,
Marian
mmmn036 likes this.
Fuchs is offline   Reply With Quote

Old   July 3, 2014, 05:27
Default Ohter approach
  #15
New Member
 
Gregory
Join Date: Nov 2010
Location: Dresden
Posts: 14
Rep Power: 6
catapult is on a distinguished road
Hi guys,

I have developed a small OF-routine that averages the UMean in the z-spanwise direction. It uses anoter approach but works well and is fast. Exectution time < 1min for a mesh of about 1.2 Million cells. Good things: the method theoretically works for unstructured mesh (The interpolator needs to be improved though). Hope anyone finds it useful.

Gregory.
Attached Files
File Type: gz avg.tar.gz (2.1 KB, 51 views)
tfuwa, mmmn036 and rajibroy like this.
catapult is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Starting field averaging using libFunctionObject after certain time eelcovv OpenFOAM Programming & Development 22 November 19, 2014 09:53
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
problems after decomposing for running alessio.nz OpenFOAM 5 April 20, 2011 08:44
Averaging field over a spatial direction fs82 OpenFOAM 10 August 12, 2009 10:44
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51


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