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

fields and factors in simpleFunctionObjects

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 17, 2012, 10:29
Default fields and factors in simpleFunctionObjects
  #1
New Member
 
Join Date: Jan 2012
Posts: 22
Rep Power: 14
BigPapi34 is on a distinguished road
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
BigPapi34 is offline   Reply With Quote

Old   May 21, 2012, 17:18
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by BigPapi34 View Post
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
gschaider is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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



All times are GMT -4. The time now is 05:17.