|
[Sponsors] |
Spanwise averaging of three-dimensional field |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 13, 2012, 12:46 |
Spanwise averaging of three-dimensional field
|
#1 |
New Member
Marian Fuchs
Join Date: Dec 2010
Location: Berlin, Germany
Posts: 9
Rep Power: 16 |
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 |
|
October 12, 2012, 17:44 |
|
#2 |
Senior Member
|
Hallo Marian,
Did you get any easy method to perform spatial averaging? Regards, awais |
|
October 23, 2012, 07:14 |
|
#3 |
New Member
Marian Fuchs
Join Date: Dec 2010
Location: Berlin, Germany
Posts: 9
Rep Power: 16 |
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 |
|
November 12, 2012, 10:48 |
|
#4 |
Senior Member
|
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 |
|
November 15, 2012, 10:23 |
|
#5 |
New Member
Marian Fuchs
Join Date: Dec 2010
Location: Berlin, Germany
Posts: 9
Rep Power: 16 |
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 |
|
November 29, 2012, 09:33 |
|
#6 |
Senior Member
|
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 |
|
November 30, 2012, 00:26 |
|
#7 |
Senior Member
|
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(); regards, Awais |
|
December 2, 2012, 20:42 |
|
#8 |
Senior Member
|
Hi Marian,
Here is the modified utility Thanks again, it will help me alot. regards, Awais |
|
December 2, 2012, 20:45 |
|
#9 |
Senior Member
|
Sorry was unable to attach in 1st post.
|
|
December 2, 2012, 22:24 |
|
#10 |
Senior Member
|
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(); Regards, awais |
|
December 2, 2012, 22:48 |
|
#11 |
Senior Member
|
Only problem is that the values at the boundaries is written zero.
|
|
December 4, 2012, 07:28 |
|
#12 |
New Member
Marian Fuchs
Join Date: Dec 2010
Location: Berlin, Germany
Posts: 9
Rep Power: 16 |
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 |
|
June 20, 2014, 19:14 |
|
#13 |
Member
Manjura Maula Md. Nayamatullah
Join Date: May 2013
Location: San Antonio, Texas, USA
Posts: 42
Rep Power: 13 |
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 |
|
June 24, 2014, 07:07 |
|
#14 |
New Member
Marian Fuchs
Join Date: Dec 2010
Location: Berlin, Germany
Posts: 9
Rep Power: 16 |
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 |
|
July 3, 2014, 06:27 |
Ohter approach
|
#15 |
New Member
Gregory
Join Date: Nov 2010
Location: Dresden
Posts: 14
Rep Power: 16 |
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. |
|
July 22, 2015, 05:24 |
|
#16 | |
Senior Member
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18 |
Quote:
Dear Marian, Could you finish the updated version of your code? Is it possible to share it with us?? Thanks, Syavash |
||
July 22, 2015, 05:39 |
|
#17 | |
Senior Member
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18 |
Quote:
Nice job Gregory! But I think your code may ignore some cells when trying to match x and y coordinates. I have applied your routine to my case, a 3-D channel homogeneous is z direction. I could get a nice smooth field of velocity, but when noting the legend bar, I could see that the velocity range is half of that which should be!! Actually, I have developed a similar utility/code for Ansys Fluent and it also suffers from the same issue. Due to writing precision of the grid generator tool (Gambit and ICEM CFD in my case), not the entire cells aligned in z direction have THE EXACT similar x and y coordinates. So, it is normal that the code ignores some cells and their contributions to the velocity field are neglected. For fixing this problem, I introduced a tolerance factor in my case which somewhat improved span-wise averaging. Can you do the same in your routine? P.S.: Is it possible to include pressure field as well?? Regards, Syavash |
||
November 5, 2015, 23:15 |
|
#18 |
Member
Manjura Maula Md. Nayamatullah
Join Date: May 2013
Location: San Antonio, Texas, USA
Posts: 42
Rep Power: 13 |
Hello Marian,
Do you have the code available for span wise averaging that runs parallel? I would really appreciate if you have the code available and share with us. Thanks MMMN |
|
November 5, 2015, 23:15 |
|
#19 | |
Member
Manjura Maula Md. Nayamatullah
Join Date: May 2013
Location: San Antonio, Texas, USA
Posts: 42
Rep Power: 13 |
Quote:
Do you have the code available for span wise averaging that runs parallel? I would really appreciate if you have the code available and share with us. Thanks MMMN |
||
November 21, 2016, 00:13 |
spanwise averaging in a cellZone
|
#20 |
Member
Pavan
Join Date: Jan 2016
Posts: 53
Rep Power: 10 |
can some one explain how to use the postSpanwiseaverage tool to carryout the averaging in a particular cellZone?
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problems after decomposing for running | alessio.nz | OpenFOAM | 7 | March 5, 2021 05:49 |
Starting field averaging using libFunctionObject after certain time | eelcovv | OpenFOAM Programming & Development | 25 | December 7, 2015 23:28 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
Averaging field over a spatial direction | fs82 | OpenFOAM | 10 | August 12, 2009 11:44 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 07:51 |