CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (http://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   swak4Foam Warning messages during runtime postprocessing (http://www.cfd-online.com/Forums/openfoam-post-processing/118802-swak4foam-warning-messages-during-runtime-postprocessing.html)

caduqued June 4, 2013 14:41

swak4Foam Warning messages during runtime postprocessing
 
Hi All,

I have setup a simulation with a good set of measures... For this task I am using swak4Foam. The simulation seems to be OK, although I still need to check for coherence of the values. However, something that is baffling me is the good amount of warning messages that are coming out:

Code:

Expression UMeanAtPlane01LeftBranch : --> FOAM Warning :
    From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
    in file ExpressionResult/ExpressionResultI.H at line 324
    The minimum value 0.00897812 and the maximum 5.5276 differ. I will use the average 0.409302
 sum=0.409302 average=0.000113822
Expression pAvgAtPlane01LeftBranch : --> FOAM Warning :
    From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
    in file ExpressionResult/ExpressionResultI.H at line 324
    The minimum value -2.21591e-05 and the maximum 9.08284e-06 differ. I will use the average 1.37541e-07
 sum=0.000494599 average=1.37541e-07
Expression rhoFlowAtPlane01LeftBranch : --> FOAM Warning :
    From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
    in file ExpressionResult/ExpressionResultI.H at line 324
    The minimum value 0.00897812 and the maximum 5.5276 differ. I will use the average 0.409302
 sum=3.04379 average=0.000846439

What does exactly this mean? Should I correct something within the swakExpressions? Here I am attaching those too (in case a big guru wants to jump in... )
Code:

    createPlane01Parent
    {
        type            createSampledSurface;
        outputControl  timeStep;
        outputInterval  10;
        surfaceName    plane01Parent;
        surface
        {
            type            cuttingPlane;
            planeType      pointAndNormal;
            pointAndNormalDict
            {
                basePoint      (0.00000  8.00000  0.00000);
                normalVector    (0.00000  -1.00000  0.00000);
            };
            interpolate    true;
        };
    }

    UMeanAtPlane01Parent
    {
        type            swakExpression;
        valueType      surface;
        surfaceName    plane01Parent;
        verbose        true; 
        variables      "UmeanPlane01P0{internalField}=mag(U);";//*area()/sum(area());";
        expression      "UmeanPlane01P0*area()/sum(area())"; //
        accumulations  (sum average);
    };
   
    pAvgAtPlane01Parent
    {
        type            swakExpression;
        valueType      surface;
        surfaceName    plane01Parent;
        verbose        true; 
        variables      "pAvg{internalField}=p*vol()/sum(vol());";
        expression      "pAvg";
        accumulations  (sum average);
    };

    rhoFlowAtPlane01Parent
    {
        globalScopes    ("thisSimulation");
        // Function generated to get average of rho in a Plane.
        type            swakExpression;
        valueType      surface;
        surfaceName    plane01Parent;
        verbose        true;
        variables      "UmeanPlane01P0{internalField}=mag(U);";//*area()/sum(area());";
        expression      "rhoDensity*UmeanPlane01P0*area()";
        accumulations  (sum average);
    }

and another set of expressions are given by:


Code:

    createPlane01LeftBranch
    {
        type            createSampledSurface;
        outputControl  timeStep;
        outputInterval  10;
        surfaceName    plane01LeftBranch;
        surface
        {
            type            cuttingPlane;
            planeType      pointAndNormal;
            pointAndNormalDict
            {
                basePoint      (-1.6000  -2.771281  0.00000);
                normalVector    (-0.5000  -0.8660254 0.00000);
            };
            interpolate    true;
        };
    }

    UMeanAtPlane01LeftBranch
    {
        type            swakExpression;
        valueType      surface;
        surfaceName    plane01LeftBranch;
        verbose        true; 
        variables      "UmeanPlane01{cellZone'leftBranch}=mag(U);";//*area()/sum(area());";
        expression      "UmeanPlane01*area()/sum(area())"; //
        accumulations  (sum average);
    };
   
    pAvgAtPlane01LeftBranch
    {
        type            swakExpression;
        valueType      surface;
        surfaceName    plane01LeftBranch;
        verbose        true; 
        variables      "pAvg{cellZone'leftBranch}=p*vol()/sum(vol());";
        expression      "pAvg";
        accumulations  (sum average);
    };

    rhoFlowAtPlane01LeftBranch
    {
        globalScopes    ("thisSimulation");
        // Function generated to get average of rho in a Plane.
        type            swakExpression;
        valueType      surface;
        surfaceName    plane01LeftBranch;
        verbose        true;
        variables      "UmeanPlane01{cellZone'leftBranch}=mag(U);";//*area()/sum(area());";
        expression      "rhoDensity*UmeanPlane01*area()";
        accumulations  (sum average);
    }

Any help or hint is greatly appreciated!!!

gschaider June 4, 2013 17:44

Quote:

Originally Posted by caduqued (Post 432010)
Hi All,

I have setup a simulation with a good set of measures... For this task I am using swak4Foam. The simulation seems to be OK, although I still need to check for coherence of the values. However, something that is baffling me is the good amount of warning messages that are coming out:

Code:

Expression UMeanAtPlane01LeftBranch : --> FOAM Warning :
    From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
    in file ExpressionResult/ExpressionResultI.H at line 324
    The minimum value 0.00897812 and the maximum 5.5276 differ. I will use the average 0.409302
 sum=0.409302 average=0.000113822

What does exactly this mean? Should I correct something within the swakExpressions? Here I am attaching those too (in case a big guru wants to jump in... )
Code:

UMeanAtPlane01LeftBranch
    {
        type            swakExpression;
        valueType      surface;
        surfaceName    plane01LeftBranch;
        verbose        true; 
        variables      "UmeanPlane01{cellZone'leftBranch}=mag(U);";//*area()/sum(area());";
        expression      "UmeanPlane01*area()/sum(area())"; //
        accumulations  (sum average);
    };

Any help or hint is greatly appreciated!!!

It took out this one example: what is happening there? You calculate UmeanPlane01 on a cellZone and use it on a surface. Now: what would in your opinion be the proper way to map the values from the cellZone to the surface? (Which is what you'd have to do in that situation) I can't think of any and OpenFOAM doesn't provide such a mapping too. So what swak does it that insists that the expression of remote variable is the same on all cells/faces/points in the remote (for instance because it is a max or a sum) because that is trivially mapped: it's the same constant value on the target. So when it finds that this is not the case (because min!=max) instead of aborting the run or (and that would be worse) silently doing something with the values it calculates the average (in your case of mag(U) ) and uses that as UmeanPlane01 ... but it prints out this warning.

The only exception from this are mapped patches if their "partner" patch is used as a remote because OpenFOAM provides a mapping there.

I'm not quite sure what you're trying to do with this functionObject so I can't give you a recommendation how to fix it

caduqued June 4, 2013 19:24

Quote:

Originally Posted by gschaider (Post 432041)
It took out this one example: what is happening there? You calculate UmeanPlane01 on a cellZone and use it on a surface. Now: what would in your opinion be the proper way to map the values from the cellZone to the surface? (Which is what you'd have to do in that situation) I can't think of any and OpenFOAM doesn't provide such a mapping too. So what swak does it that insists that the expression of remote variable is the same on all cells/faces/points in the remote (for instance because it is a max or a sum) because that is trivially mapped: it's the same constant value on the target. So when it finds that this is not the case (because min!=max) instead of aborting the run or (and that would be worse) silently doing something with the values it calculates the average (in your case of mag(U) ) and uses that as UmeanPlane01 ... but it prints out this warning.

The only exception from this are mapped patches if their "partner" patch is used as a remote because OpenFOAM provides a mapping there.

I'm not quite sure what you're trying to do with this functionObject so I can't give you a recommendation how to fix it


Hi Bernhard,

Thanks for your fast reply and explanation. I am not really an expert in swak4Foam, just a big fan, so maybe a lot of "not-really-well-designed" expressions are already contained in this simple example (I am pretty sure my full set of swak expressions already look like a Frankestein case!!).

Well, what I am trying to do is relatively simple. I just want to extract average pressure and mean velocity (besides some other measures) at some specific points/planes. The problem is that the domain is composed by a set of ducts, not parallel each other. In this case, any plane defined to sample points, within any of the ducts, will intersect sections of the other ducts. Here I am assuming that, then, these averages (or any other measure) will be "contaminated" with (i.e. will take into account) values extracted from other parts of the domain being intersected by the given plane, but that do not correspond to the specific duct I need to analyze. Another small complication is that the planes are not necessarily aligned with any major direction.

In any case, I also have a "back-up" measure: using the probes functionality, but I would really like to have a compact form, as usually provided by swak4Foam. I really would like to have the data almost ready, instead of "postProcessing the postProcessed" data.

Regards,

gschaider June 5, 2013 16:58

Quote:

Originally Posted by caduqued (Post 432044)

Hi Bernhard,

Thanks for your fast reply and explanation. I am not really an expert in swak4Foam, just a big fan, so maybe a lot of "not-really-well-designed" expressions are already contained in this simple example (I am pretty sure my full set of swak expressions already look like a Frankestein case!!).

Well, what I am trying to do is relatively simple. I just want to extract average pressure and mean velocity (besides some other measures) at some specific points/planes. The problem is that the domain is composed by a set of ducts, not parallel each other. In this case, any plane defined to sample points, within any of the ducts, will intersect sections of the other ducts. Here I am assuming that, then, these averages (or any other measure) will be "contaminated" with (i.e. will take into account) values extracted from other parts of the domain being intersected by the given plane, but that do not correspond to the specific duct I need to analyze. Another small complication is that the planes are not necessarily aligned with any major direction.

In any case, I also have a "back-up" measure: using the probes functionality, but I would really like to have a compact form, as usually provided by swak4Foam. I really would like to have the data almost ready, instead of "postProcessing the postProcessed" data.

Regards,

OK. I think you get it. You only want the part of the surface that lies inside the cellZone leftBranch. You can do that with an indicator field that is only 1 in the cellZone (note that there may be required parameters missing or typos ... I'm doing this off the top of my head)
Code:

leftBranchIndicator {
    type expressionField;
    fieldName isLeftBranch;
    expression "zone(leftBranch) ? 1 : 0";
}

then using that indicator field via autoInterpolate you calculate the weighted average
Code:

UMeanAtPlane01LeftBranch
    {
        type            swakExpression;
        valueType      surface;
        surfaceName    plane01LeftBranch;
        verbose        true; 
        variables  (
            "leftArea=sum(isLeftBranch*area());
        );
        expression      "mag(U)*isLeftBranch*area()/leftArea;";
        autoInterpolate true;
        accumulations  (sum);
    };

Of course this is computationally more expensive than having a proper surface (the indicator field has to be computed ... although there are ways to do this only in the beginning... and you sum up 0 on the unneeded parts of the surface).


All times are GMT -4. The time now is 14:56.