|
[Sponsors] |
fieldAverage function object does not average over all time? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 16, 2015, 12:25 |
fieldAverage function object does not average over all time?
|
#1 |
Senior Member
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13 |
I am running this on my case (2.4.x pimpleDyMFoam with rotating AMI region) using execFlowFunctionObjects:
Code:
fieldAverage1 { type fieldAverage; functionObjectLibs ("libfieldFunctionObjects.so"); enabled true; outputControl timeStep; outputInterval 1; resetOnRestart false; resetOnOutput false; fields ( U { mean on; prime2Mean on; base time; } ); } I noticed that I get this in fieldAveragingProperties file in every time directory: Code:
U { totalIter 2; totalTime 0.004; } |
|
July 18, 2015, 11:51 |
|
#2 |
Senior Member
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13 |
I reported a bug on the OpenFOAM Mantis, and apparently this is a known issue with moving meshes. Anyone have any idea how to fix up execFlowFunctionObjects to make it work?
|
|
July 19, 2015, 14:06 |
|
#3 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Greetings Pete,
I see that you've got 2 reports on this topic:
In addition, do you mean that the average results for a dynamic mesh are acceptable for doing an analysis? I ask this because there are regions in the mesh that probably stop existing on a specific location in 2 different time snapshots, which makes it somewhat impossible to do an actual average of the field On the other hand, are you trying to do an average only on the static region? I ask all of this because from what I can remember, the averaging mechanism needs to access the previous fields in time, which are usually created by the function object itself. But the "execFlowFunctionObjects" was designed for pretty much loading each time snapshot individually, which essentially "breaks the flow". Therefore, if you can describe the exact averaging operation you want to perform, it might be easier to create a new application that helps you do this, hence my previous questions. Best regards, Bruno
__________________
|
|
July 19, 2015, 14:17 |
|
#4 |
Senior Member
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13 |
Hi Bruno,
The two bug reports are somewhat different since the second one applies to static meshes as well. I don't think the second bug will affect the results, though, since my cases are written at a constant interval. I do want to average over a specified amount of time directories, compute some mean gradients in the static region (wrote a custom coded functionObject for this), then plane-average these (using funkyDoCalc). I was trying to avoid re-running the case since it had to be done on a cluster. I don't think the results would be terribly affected by the "downsampling" from only using written directories for computing statistics. I got the averaging to mimic what happens if you use fieldAverage at run-time by commenting out the part that reloads the functionObjects if the mesh changes, so that gets me somewhere, but writing every time step (one of my notes on the second bug) is going to take up a lot of disk space, though I may be able to afford it. Thanks! |
|
July 19, 2015, 15:05 |
|
#5 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
So... the missing detail is that you need a new function object based on "fieldAverage" that uses the actual time step taken between 2 time snapshots.
From what I can see, in the file "src/postProcessing/functionObjects/field/fieldAverage/fieldAverage.C", you need to replace all occurrences of this: Code:
obr_.time().deltaTValue() OK, it's easier to do this in the "applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C" code, where after this line: Code:
runTime.setTime(timeDirs[timeI], timeI); Code:
if(timeI>0) { runTime.setDeltaT(timeDirs[timeI]-timeDirs[timeI-1]); } |
|
July 19, 2015, 15:27 |
|
#7 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Well... then after this:
Code:
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); Code:
Foam::instant prevTimeI = timeDirs.start(); Code:
Foam::instant prevTimeI = timeDirs[0]; Code:
if(timeI>0) { runTime.setDeltaT(timeDirs[timeI]-timeDirs[prevTimeI]); } Code:
prevTimeI = timeI; |
|
July 19, 2015, 21:04 |
|
#8 |
Senior Member
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13 |
That didn't quite work, but I got things going by creating a new Time object for the previous time: https://github.com/petebachant/OpenF...5ddee3dfb676e8
However, the outputControl of the fieldAverage is still not working correctly when used in post-processing. I may be able to deal with this so long as I don't run out of disk space. |
|
August 16, 2015, 18:16 |
|
#9 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Hi Pete,
I was curious about this and this on my to-do list. From the look of the commits you have on your repository, it seemed that you had this mostly working. As far as I can figure out, I think I've got it working, along with a test case. Attached are the following files:
Code:
foamRunTutorials rm */*Mean rm */uniform/fieldAveragingProperties execFlowFunctionObjectsMod -noFlow -time '0.00075,0.00175,0.00275,0.00375,0.00475,0.00575,0.00675,0.00775,0.00875'
Adding this hack to OpenFOAM itself is too cumbersome and probably a pain to maintain in the future. Nonetheless, I'll leave a reference to this on the bug tracker: http://www.openfoam.org/mantisbt/view.php?id=1789 Best regards, Bruno
__________________
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
same geometry,structured and unstructured mesh,different behaviour. | sharonyue | OpenFOAM Running, Solving & CFD | 13 | January 2, 2013 22:40 |
Compile problem | ivanyao | OpenFOAM Running, Solving & CFD | 1 | October 12, 2012 09:31 |
plot over time | fferroni | OpenFOAM Post-Processing | 7 | June 8, 2012 07:56 |
[blockMesh] error message with modeling a cube with a hold at the center | hsingtzu | OpenFOAM Meshing & Mesh Conversion | 2 | March 14, 2012 09:56 |
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 | bookie56 | OpenFOAM Installation | 8 | August 13, 2011 04:03 |