CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   ptot (https://www.cfd-online.com/Forums/openfoam-programming-development/106066-ptot.html)

pepe87 August 17, 2012 05:41

ptot
 
Hello,

i would like to calculate ptot with the help of function objects.
after that i would like to use the function patchmassflowaverage on ptot.
how can i calculate ptot so that the function massflowaverage knows the variable??

Greetz

pepe87 August 17, 2012 09:24

i've found something similar in an earlier post here.
i added in my conrtoldict:

functions
(
compute_ptot
{
type expressionField;
outputControl timeStep;
outputInterval 1;
fieldName ptot;
expression "p + 0.5*magSqr(U)";
autowrite false;
}

massFlow
{
type patchMassFlowAverage;
functionObjectLibs
( "libsimpleFunctionObjects.so");
verbose true;
readFields(ptot);
fields
(U
p
T
ptot
);
patches
(
Fluid_Inlet
Fluid_Outlet
);
factor 1.0;
}

);

but i get an error, that the function type expressionField is unknown.

immortality June 20, 2013 17:10

I hope you could resolve it.probably too late.but maybe help someone in future,
you can use Swak for mass averaging on total p:
Code:

n2_totalPressure
    {
        type swakExpression;
        valueType surface;
        verbose false;
        surfaceName normal_Plane_p0_2;
        surface {
            type plane;
            basePoint      (0.0345 0.002 0);
            normalVector    (1 0 0);
            interpolate true;
        }
      expression "sum((p+.5*rho*magSqr(U))*rho*area())/sum(rho*area())";
        accumulations (
            average
        );
        outputControlMode outputTime;//outputTime is added in 0.2.4 Swak4Foam version
        outputInterval 1;
    }

or OF function objects,like:
Code:

totalP    // user-defined name of function object entry
    {
        type            pressureTools;
        libs            ("libutilityFunctionObjects.so");
        //region          defaultRegion;
        enabled        yes;
        //timeStart      0;
        //timeEnd        10;
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
        calcTotal  yes;
        calcCoeff  no;
        pRef 0;
    }
    readFields
    {
    type        readFields;
    functionObjectLibs ("libfieldFunctionObjects.so");
    fields
    (
        "total(p)"
    );
    }

and:
Code:

totalPressure_left
      {
        $Average_left;
        operation      weightedAverage;
        weightField    rho;
       
        fields
        (
          "total(p)"
        );
      }

that:
Code:

Average_left
    {
        type          faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled on;
        log            no;
        valueOutput    true;
        surfaceFormat  vtk;
        source          patch;
        sourceName      left;
        operation      areaAverage;
        fields
        (
            p
            //phi // surface fields not supported for sampledSurface
            T
            rho
            h
            U
        );
        outputControl timeStep;//outputTime;//
        outputInterval 1; // 5000;
      }

I've added from my case.hope be useful for someone.


All times are GMT -4. The time now is 18:21.