fieldAverage function object does not average over all time?
I am running this on my case (2.4.x pimpleDyMFoam with rotating AMI region) using execFlowFunctionObjects:
Code:
fieldAverage1 I noticed that I get this in fieldAveragingProperties file in every time directory: Code:
U |
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?
|
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 |
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! |
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) |
Looks like the "-" operator is not implemented for Foam::instant, so I cannot do "timeI - 1".
|
:confused: 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) Code:
prevTimeI = timeI; |
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. |
4 Attachment(s)
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
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 |
All times are GMT -4. The time now is 04:36. |