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/)
-   -   How to sample velocity magnitudes at each time-step (https://www.cfd-online.com/Forums/openfoam-post-processing/113201-how-sample-velocity-magnitudes-each-time-step.html)

HakikiCanakkaleli February 14, 2013 14:11

How to sample velocity magnitudes at each time-step
 
Hi,

Could anyone please tell me how I can sample magnitudes of a velocity flow field which passes through a specified region of cells (rather than the patches) (e.g. an arbitrary cylinder shaped plane in the middle of the computational domain) during run-time and to write those at each time-step?

Many thanks for any reply in advance.

nimasam February 15, 2013 03:00

there are several options:
1- using post processing such as paraview:
-create a mag (U) with calculator
-extract the surface
-integrateVariables for specified Time or all time steps

2-using sampleDict, i guess you can create your sample point

3- using swak4Foam there are lots of Options in that, which youy can extract plane, use a faceSet and so to derive what you want!

HakikiCanakkaleli February 15, 2013 05:36

Thanks very much.

When I tried to use the swak4Foam with faceSet, I receive the error below:

Could you please tell me what it really means

Code:

libs (
      "libOpenFOAM.so"
      "libsimpleSwakFunctionObjects.so"
      "libswakFunctionObjects.so"
      "libgroovyBC.so"
    );

functions
(
  averageVel
    {
        type swakExpression;
        valueType faceSet;
        setName f0;
        accumulations (
            average
        );
        expression "U";
        verbose true;
    }
);



Code:

--> FOAM FATAL ERROR:
Could not find a field name "U" of type vector (neither surfaceVectorField nor volVectorField) autoInterpolate: 0 (try setting 'autoInterpolate' to 'true')


    From function SubsetValueExpressionDriver::getFieldInternalAndInterpolate(const string &name,const Subset &sub)
    in file SubsetValueExpressionDriverI.H at line 275.

Edit: Also, with faceZone, I obtained exactly same error.

nimasam February 15, 2013 07:00

use phi which is U & mesh.Sf

HakikiCanakkaleli February 15, 2013 08:00

Thanks very much!

Could you please tell me whether I can average the magnitudes of the velocity vector components (e.g. Ux) or not as well?

nimasam February 15, 2013 08:14

Code:

surfacePlane
    {
        type swakExpression;
        valueType surface;
        surfaceName testPlane;
        surface {
            type plane;
            basePoint      (0 0 0);
            normalVector    (1 0 0);
            interpolate true; //false
        }
        verbose true;

        expression "U";
        accumulations (
            min
            max
          average

        );
    }


gschaider February 15, 2013 08:15

Quote:

Originally Posted by HakikiCanakkaleli (Post 407980)
Code:

--> FOAM FATAL ERROR:
Could not find a field name "U" of type vector (neither surfaceVectorField nor volVectorField) autoInterpolate: 0 (try setting 'autoInterpolate' to 'true')


    From function SubsetValueExpressionDriver::getFieldInternalAndInterpolate(const string &name,const Subset &sub)
    in file SubsetValueExpressionDriverI.H at line 275.

Edit: Also, with faceZone, I obtained exactly same error.

Could you tell me how I can improve that error message? I was hoping all the relevant information is there.

swak offers for these parsers the possibility to automatically interpolate fields that are defined on cells to the faces ... but you've got to ask it to: I don't believe in forcing extra work on the machine without the user asking for it.

Anyway: simply add a line
Code:

autoInterpolate true;
to the function object and it should be fine

gschaider February 15, 2013 08:16

Quote:

Originally Posted by HakikiCanakkaleli (Post 408023)
Thanks very much!

Could you please tell me whether I can average the magnitudes of the velocity vector components (e.g. Ux) or not as well?

Together with the autoInterpolate described in the other post this should be easy ("mag(U.x)" or so)

HakikiCanakkaleli February 17, 2013 16:05

Thanks very much for this information to both of you.

Quote:

Could you tell me how I can improve that error message? I was hoping all the relevant information is there.
With the below:

Quote:

(try setting 'autoInterpolate' to 'true')
Personally, as a novice, I have thought to myself that I have to change 'autoInterpolate' from 'false' to 'true'; but, I couldn't find wherein I can do it.

Instead, if you would like to change the error message, my unpretencious suggestion would only be, by citing your words:
Code:

simply add a line: autoInterpolate true;
By the way, I made things work with 'cellSet' instead of 'faceSet'. I could not see any fundamental difference between two to extract the velocity magnitudes. If there is some, any additional suggestions would be highly appreciated. Thanks!

immortality April 5, 2013 15:48

what a nice thread!
I have a question now.whats difference between faceSet and faceZone?


All times are GMT -4. The time now is 12:35.