CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Volume Average for magnitude U

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   October 17, 2012, 11:46
Default
  #14
Member
 
Simon Arne
Join Date: May 2012
Posts: 42
Rep Power: 14
simpomann is on a distinguished road
Hey,

I am sorry to bring this up again, but I experience problems with the described way of calculating the average mag(U) over a plane.


I have a simple pipe (flow is 12m/s with air, laminar, no turb model yet) and added the following to my controlDict:

Code:
functions
{
    makeMagU {
       type expressionField;
         functionObjectLibs
        (
            "libswakFunctionObjects.so"
        );      autowrite false;
       fieldName magU;
       expression "mag(U)";
    }
    makerho {
       type expressionField;
         functionObjectLibs
        (
            "libswakFunctionObjects.so"
        );      autowrite false;
       fieldName rho;
       expression "1.199";
    }

messung_40d
    {
        type            faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");

        enabled         true;
        outputControl   outputTime;

        // Output to log&file (true) or to file only
        log             true;

        // Output field values as well
        valueOutput     true;  //true;

        // Type of source: patch/faceZone/sampledSurface
        source          sampledSurface;

        sampledSurfaceDict
        {
                type cuttingPlane;
                planeType           pointAndNormal;
                pointAndNormalDict
                {
                        basePoint       (0.185 0 0);  
                        normalVector    (1 0 0);
                }
                source cells; // sample cells or boundaryFaces
                interpolate true;
        }
        // Operation: areaAverage/sum/weightedAverage ...
        operation       areaAverage;

        fields
        (
            p
            U
        magU
        );
    }

messung_48d
    {
        type            faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");

        enabled         true;
        outputControl   outputTime;

        // Output to log&file (true) or to file only
        log             true;

        // Output field values as well
        valueOutput     true;  //true;

        // Type of source: patch/faceZone/sampledSurface
        source          sampledSurface;

        sampledSurfaceDict
        {
                type cuttingPlane;
                planeType           pointAndNormal;
                pointAndNormalDict
                {
                        basePoint       (0.281 0 0);
                        normalVector    (1 0 0);
                }
                source cells; // sample cells or boundaryFaces
                interpolate true;
        }
        // Operation: areaAverage/sum/weightedAverage ...
        operation       areaAverage;

        fields
        (
            p
            U
        magU
        );
    }


}
And I get an output over my plane (cut through the pipe after 40 diameters, flow is straight x-directional):
Code:
# Source : sampledSurface sampledSurface
# Faces  : 204
# Time    sum(magSf)    areaAverage(p)    areaAverage(U)    areaAverage(magU)
100    0.000104042    -0.511471    (14.8039 0.00143989 0.0096608)    14.804
200    0.000104042    -1.07848    (15.1898 -0.002704 0.00862669)    15.1898
300    0.000104042    -1.10052    (15.2711 -0.002448 0.00478738)    15.2711
400    0.000104042    -1.13157    (15.2688 -0.00338944 0.00642759)    15.2688
500    0.000104042    -1.05324    (15.2643 -0.00676656 0.00863005)    15.2643
600    0.000104042    -1.30854    (15.2804 -0.00189827 0.00590263)    15.2804
700    0.000104042    -1.30885    (15.2774 -0.00181508 0.00626128)    15.2774
800    0.000104042    -1.29363    (15.2785 -0.00386213 0.00488485)    15.2785
900    0.000104042    -1.29393    (15.278 -0.00271772 0.00544641)    15.2781
1000    0.000104042    -1.28934    (15.2778 -0.00274002 0.00545235)    15.2781
If I load the case into paraView, slice at the same distance, extract and integrate variables (cell values) I end up with a more reasonable mag(U) average of 12.009.

What did I do wrong here?
I thought my lines to the control dict would just create a field mag(U) out of the calculated U vector field and then place a slice through it and calculate an average.
Is it possible that the SWAK-code leaves out cells with a mag(U) value of 0 for some reason? My mesh is pretty rough, so a high percentage of the cells actually has the wall boundary condition of U = (0 0 0).

I found out that my average values for pressure seem to be perfectly fine (SWAK sampling and manual paraView pp lead to the exact same numbers)!
So its only a mag(U) thing here...

Last edited by simpomann; October 17, 2012 at 12:24.
simpomann is offline   Reply With Quote

 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 17:22
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 06:09
On the damBreak4phaseFine cases paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 21:14
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 11:55
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 14:00


All times are GMT -4. The time now is 08:32.