CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   fields and factors in simpleFunctionObjects (http://www.cfd-online.com/Forums/openfoam-programming-development/101936-fields-factors-simplefunctionobjects.html)

BigPapi34 May 17, 2012 10:29

fields and factors in simpleFunctionObjects
 
Hi,

I have a specific question regarding simpleFunctionObjects. Here is an extract from my controlDict file:

p
{
type patchAverage;
functionObjectLibs
(
"libsimpleFunctionObjects.so"
);
verbose true;
patches
(
outlet
);
fields (p);
}

What I would like to know is whether there is a way of multiplying the (p) fields by a factor in order to log a different value and print it to the screen. Is this possible?

On a further note, is there a method of taking the values from the 'outlet' patch above and adding/subtracting the value for the inlet patch (which I have as a different item), printing this to screen and the log file?

Any information would be greatly appreciated.

Thanks

gschaider May 21, 2012 17:18

Quote:

Originally Posted by BigPapi34 (Post 361673)
Hi,

I have a specific question regarding simpleFunctionObjects. Here is an extract from my controlDict file:

p
{
type patchAverage;
functionObjectLibs
(
"libsimpleFunctionObjects.so"
);
verbose true;
patches
(
outlet
);
fields (p);
}

What I would like to know is whether there is a way of multiplying the (p) fields by a factor in order to log a different value and print it to the screen. Is this possible?

On a further note, is there a method of taking the values from the 'outlet' patch above and adding/subtracting the value for the inlet patch (which I have as a different item), printing this to screen and the log file?

Any information would be greatly appreciated.

Thanks

Multiplication by a factor is supported and even documented: http://openfoamwiki.net/index.php/Co...to_controlDict (but I'm not 100% sure whether patchAverage supports it)

Concerning your second question: not with the pure simpleFunctionObjects but with swak4Foam (of which the simpleFunctionObjects are now a part) which has a function object patchExpression (which builds on simpleFunctionObjects) that allows calculation of expressions on patches. An example for a pressure difference would be:
Code:

   
pressureDiff {
        type patchExpression;
        patches (
            inlet
        );
        variables (
            "pOut{patch'outlet}=sum(p*area())/sum(area());"
        );
        accumulations (
            average
        );
        expression "p-pOut";
        verbose true;
    }

BTW: if patchAverage doesn't allow multiplication with a factor then of course patchExpression might be the solution too


All times are GMT -4. The time now is 01:24.