|
[Sponsors] |
October 2, 2012, 13:44 |
Time averaged fields on a defined time range
|
#1 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,207
Rep Power: 28 |
Hi FOAMers,
Here is my problem : I have transient RANS simulations of a two-phase flow (using VOF method) and I would like to calculate the time averaged fields on a defined time range, let's say from t=50s to t=100s. How can I do that ? In paraView, the temporalStatistics filter achieve this task but only for all time steps and I cannot specify my own time range. In OpenFOAM, I tried to use the fieldAverage utility from the fieldFunctionObjects library, using this code in my controlDict : Code:
fieldAverage1 { type fieldAverage; functionObjectLibs ( "libfieldFunctionObjects.so" ); enabled true; outputControl outputTime; fields ( U { mean on; prime2Mean on; base time; } alpha1 { mean on; prime2Mean on; base time; } ); } But my problem is to use this function on cases already done. Using execFlowFunctionObjects with the -noFlow option, I am able to run it after the end of my simulation, but it seems the mean variables written on each time steps start over and don't use the previous values. For each time step, i have the same "totalTime" values in the "fieldAveragingProperties". Does anybody have already experienced that kind of problem ? Did I miss a trick somewhere ? More generally, wanting an averaged field on a defined time range doesn't sound so exotic... Is there somebody who know how to do that in OpenFOAM or paraView ? Thank you, Yann |
|
October 3, 2012, 02:58 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
I don't know which version of OpenFOAM you are using, but fieldAverage later got some additional options:
- resetOnOutput - timeStart - timeEnd See also: http://www.openfoam.org/mantisbt/view.php?id=290 |
|
October 3, 2012, 11:00 |
|
#3 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,207
Rep Power: 28 |
Thank you Benhard for your reply. I'm using OF 2.1.0 and I wasn't aware of these additional options which are really useful to control run-time post-processing.
I tried to dig into this problem by testing some things on the damBreak case. I just ran it from 0 to 5s and I set a fieldAverage from 2s to the end thanks to the timeStart and timeEnd options. Here is an extract of my controlDict. Code:
application interFoam; startFrom startTime; startTime 0; stopAt endTime; endTime 5; deltaT 0.001; writeControl adjustableRunTime; writeInterval 0.1; runTimeModifiable yes; adjustTimeStep on; functions { fieldAverage1 { type fieldAverage; functionObjectLibs ( "libfieldFunctionObjects.so" ); enabled true; outputControl outputTime; timeStart 2; timeEnd 5; resetOnOutput false; fields ( U { mean on; prime2Mean on; base time; } alpha1 { mean on; prime2Mean on; base time; } ); } } Here is what I have in the fieldAveragingProperties of the last timestep : Code:
U { totalIter 275; totalTime 3.00798; } alpha1 { totalIter 275; totalTime 3.00798; } Now, I run the same simulation without fieldAverage and I try to run it as a post-processing tool after the end of my simulation thanks to this command : Code:
execFlowFunctionObjects -noFlow Code:
U { totalIter 2; totalTime 0.0285714; } alpha1 { totalIter 2; totalTime 0.0285714; } Am I having a wrong use of the execFlowFunctionObjects ? Should I use or don't use some options ? Or is the fieldAverage function unable to work after the simulation run ? |
|
October 3, 2012, 11:36 |
|
#4 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
Hello,
to use functionObjects on cases already finished there is also this: http://www.cfd-online.com/Forums/ope...revisited.html However, this seems quite similar to execFlowFunctionsObjects. |
|
October 4, 2012, 15:01 |
|
#5 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,207
Rep Power: 28 |
Thank you Gerhard.
I've run some tests with your utility and I still have an issue on my averaged fields compared to run-time post-processing with fieldAverage. I run the damBreak case from t=0 to 5s. For the first case, I use fieldAverage for run-time post-processing, starting from 0. Here is what is in the fieldAveragingProperties file of the last time step: Code:
location "5/uniform"; object fieldAveragingProperties; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // U { totalIter 2249; totalTime 5.001; } alpha1 { totalIter 2249; totalTime 5.001; } Now, if I run the same simulation without fieldAverage and if I use the postAverage utility for post-processing, the averaged fields aren't calculated on the whole time range of 5s : Code:
location "5/uniform"; object fieldAveragingProperties; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // U { totalIter 51; totalTime 0.435901; } alpha1 { totalIter 51; totalTime 0.435901; } I don't understand why totalIter is ok and not totalTime. To run the postAverage utility, I defined the fieldAverage function in the controlDict : Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.0.1 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application interFoam; startFrom startTime; startTime 0; stopAt endTime; endTime 5; deltaT 0.001; writeControl adjustableRunTime; writeInterval 0.1; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression uncompressed; timeFormat general; timePrecision 6; runTimeModifiable yes; adjustTimeStep on; maxCo 0.2; maxAlphaCo 0.2; maxDeltaT 1; functions { fieldAverage1 { type fieldAverage; functionObjectLibs ( "libfieldFunctionObjects.so" ); enabled true; outputControl timeStep; timeStart 0.1; timeEnd 5; fields ( U { mean on; prime2Mean on; base time; } alpha1 { mean on; prime2Mean on; base time; } ); } } // ************************************************************************* // Code:
postAverage -noZero Just to be sure : if I run the utility on all time steps, the mean values of the last time step should be the average of all time steps together no ? |
|
October 10, 2012, 19:36 |
|
#6 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,207
Rep Power: 28 |
Hi all,
I finally solved my problem with another solution. As I'm unable to obtain what i want with OpenFOAM utilities, I just wrote a shell script to add underscores to the name of the time steps directories that I don't want to average. So paraFoam just see the time steps I want and I can average them with the temporalStatistics filter. It isn't an elegant way to do it, but it's doing the job so I'll go for that unless somebody has a better idea. Thanks to Bernhard and GerhardHolzinger for their ideas and help. |
|
October 15, 2012, 05:30 |
|
#7 |
Senior Member
Eelco van Vliet
Join Date: Mar 2009
Location: The Netherlands
Posts: 124
Rep Power: 19 |
Hi Yann,
I struggeled with the same issue a while ago and wrote a utility for it. You can donwload it from the tread below. Probably needs some modification for you case (the fields to be averaged need to be hard coded), but that should be doable Regards Eelco http://www.cfd-online.com/Forums/ope...rocessing.html |
|
November 19, 2014, 09:52 |
|
#8 |
Senior Member
|
Hello Everyone
I am beginner in OpenFoam, may be my question looks very busy, I am sorry for that. I am using fieldAverage to get time-averaged of velocity. I get the time-averaged file in respective time step folder but I don't know how can I view this average field using paraview. When I load my case to paraview, it shows only entities which are present in "0" folder. It does not show averaged field i.e. UMean Regards Waqas |
|
August 7, 2019, 05:46 |
fieldAverage in a period of time
|
#9 |
Senior Member
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12 |
Hi foamers,
I wanted to average some fields on a period of time (t=0 to t=10s) with fieldAverage FO. However, it gives me the field average in every time step! e.g., in t=5! So, when the period is not finished, what is this average in t=5s? In addition, I want to average stream function in this period of time which is calculated using "streamFunction" command and is not a common field obtain by solver! What should I do? Thanks |
|
Tags |
fieldaverage, openfoam, paraview, time averaged |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Multiple floating objects | CKH | OpenFOAM Running, Solving & CFD | 14 | February 20, 2019 10:08 |
separate .vtk files + OpenFOAM fields: synchronous time | tomislav_maric | OpenFOAM Post-Processing | 4 | November 21, 2011 10:34 |
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 | bookie56 | OpenFOAM Installation | 8 | August 13, 2011 05:03 |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 13:21 |
Modeling in micron scale using icoFoam | m9819348 | OpenFOAM Running, Solving & CFD | 7 | October 27, 2007 01:36 |