CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Compute mean vorticity field (https://www.cfd-online.com/Forums/openfoam-post-processing/157913-compute-mean-vorticity-field.html)

odellar August 11, 2015 04:55

Compute mean vorticity field
 
I'd like to compute the time averaged vorticity and stream function fields for a case I'm running. If I just wanted the time averaged velocity field, for example, I could put something like:

Code:

fieldAverage1
    {
        type            fieldAverage;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled        true;
        outputControl  outputTime;

        fields
        (
            U
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }

        );
    }

in the controlDict and it would compute during runtime (solving). However vorticity and stream function fields aren't computed during runtime, they must be (to the best of my knowledge) computed using the utilities vorticity and streamFunction, respectively, after solving. How can I then compute the time average of these fields?

Either a way of forcing openFoam to compute the vorticity and stream function fields during solving and calculating the mean at the same time, or waiting till the end to use the utilities to compute those fields and then computing the time average would be fine.

Thanks!

tomf August 12, 2015 04:01

Hi,

Both these utilities can be included as function objects. So they can at least be created during the run. Something like this should be added to the "functions" part of the controlDict, probably a bit more information is needed:

Code:

vorticity
{
    type            vorticity;
    outputControl  timeStep;
    outputInterval  1;
}

I am not sure if they can be averaged. You can try be adding "vorticity" to the fieldAverage part. If it works, the fieldAveraging should be placed after the vorticity. I would assume similar behavior for the streamfunction. However I have not tested this myself.

Regards,
Tom

odellar August 12, 2015 10:25

Thanks Tom, I'm trying this at the moment, but I'm not convinced it's going to work, as streamFunction doesn't appear to be a function you can use in controlDict.. It looks to only work as a post-processing utility.

So still looking for a way of time-averaging fields AFTER I've finished solving if anyone has any ideas...

Thanks

ssss August 12, 2015 12:09

Maybe you can use swak4foam to generate the vorticity field and then use the field average function object to average vorticity.

I might have some code that does what you are searching for, if you are not able of average the vorticity let me know and I will search for the code

odellar August 14, 2015 05:26

Thanks
 
Quote:

Originally Posted by ssss (Post 559309)
Maybe you can use swak4foam to generate the vorticity field and then use the field average function object to average vorticity.

I might have some code that does what you are searching for, if you are not able of average the vorticity let me know and I will search for the code

Thanks SSSS, that would be handy to have a look at please..

ssss August 14, 2015 06:07

So you create a vorticty field with swak4foam, and the average it with a fieldAverage functionObject

Code:

functions
{
vorticity
{
type expressionField;
autowrite true;
dimension [0 0 -1 0 0 0 0];
fieldName "vorticity";
expression "curl(U)";
verbose true;
autowrite true;
outputControl timeStep;
}
        fieldAverage1
      {
                type            fieldAverage;
                functionObjectLibs ( "libfieldFunctionObjects.so" );
                enabled        true;
                outputControl  outputTime;

                fields
                (
                    vorticity
                    {
                    mean on;
                    prime2Mean on;
                    base time;
                    }
              );
        }

}


odellar August 14, 2015 06:13

Excellent this looks most helpful, thanks a lot.

N.B. I think the dimension should read [0 0 -1 0 0 0 0], no? Vorticity's units are s^{-1}?

ssss August 14, 2015 09:12

Quote:

Originally Posted by odellar (Post 559574)
Excellent this looks most helpful, thanks a lot.

N.B. I think the dimension should read [0 0 -1 0 0 0 0], no? Vorticity's units are s^{-1}?

Yes you are right I will change original post. Thank you

Tempest January 9, 2017 09:03

Quote:

Originally Posted by odellar (Post 559056)
I'd like to compute the time averaged vorticity and stream function fields for a case I'm running. If I just wanted the time averaged velocity field, for example, I could put something like:

Code:

fieldAverage1
    {
        type            fieldAverage;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled        true;
        outputControl  outputTime;

        fields
        (
            U
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }

        );
    }

in the controlDict and it would compute during runtime (solving). However vorticity and stream function fields aren't computed during runtime, they must be (to the best of my knowledge) computed using the utilities vorticity and streamFunction, respectively, after solving. How can I then compute the time average of these fields?

Either a way of forcing openFoam to compute the vorticity and stream function fields during solving and calculating the mean at the same time, or waiting till the end to use the utilities to compute those fields and then computing the time average would be fine.

Thanks!

Hey sorry for reviving an old thread, but did you solve your problem. Since, I am currently going through the same conundrum, please tell me if you have figured out how to plot streamFunction after time averaging phi field.


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