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

Averaging in channelFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 30, 2010, 09:10
Default Averaging in channelFoam
  #1
Senior Member
 
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 15
stevenvanharen is on a distinguished road
Dear Foamers,

I am trying to start the averaging after a certain time in my simulation. Acoording to the wiki this should be possible using the keyword "after":http://openfoamwiki.net/index.php/Co...unctionObjects

However, I can not get it to work.

Here is my function in the controlDict file:

functions
{
fieldAverage1
{
type fieldAverage;
functionObjectLibs ( "libfieldFunctionObjects.so" );
cleanRestart true;
enabled true;
outputControl outputTime;
after 5/1.8e-4;//5 non-dimensional time-units for Retau=180

fields
(
U
{
mean on;
prime2Mean on;
base time;
}

p
{
mean on;
prime2Mean on;
base time;
}
);

}
}

I have tried various different syntaxes for the keyword after but every time the program starts to average immidiately. Does anyone have an idea about how to use the keyword "after" correctly?
stevenvanharen is offline   Reply With Quote

Old   September 30, 2010, 14:33
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 stevenvanharen View Post
Dear Foamers,

I am trying to start the averaging after a certain time in my simulation. Acoording to the wiki this should be possible using the keyword "after":http://openfoamwiki.net/index.php/Co...unctionObjects

However, I can not get it to work.

Here is my function in the controlDict file:

functions
{
fieldAverage1
{
type fieldAverage;
functionObjectLibs ( "libfieldFunctionObjects.so" );
cleanRestart true;
enabled true;
outputControl outputTime;
after 5/1.8e-4;//5 non-dimensional time-units for Retau=180

fields
(
U
{
mean on;
prime2Mean on;
base time;
}

p
{
mean on;
prime2Mean on;
base time;
}
);

}
}

I have tried various different syntaxes for the keyword after but every time the program starts to average immidiately. Does anyone have an idea about how to use the keyword "after" correctly?
The fieldAverage-functionObject is NOT part of the simpleFunction-Objects and therefor does things differently (probably ignores "after"). One of the OF-tutorials (can'T remember which) uses it. Have a look there how it is done
gschaider is offline   Reply With Quote

Old   October 1, 2010, 07:53
Default
  #3
Senior Member
 
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 15
stevenvanharen is on a distinguished road
Ok, thanks.

I'm now trying to rebuild the library for fieldAverage so that it can use this functionality.

I will look in the simplefunction objects which function has this feature and rebuild it using that as an example.
stevenvanharen is offline   Reply With Quote

Old   October 4, 2010, 10:05
Default
  #4
Senior Member
 
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 15
stevenvanharen is on a distinguished road
Quote:
Originally Posted by gschaider View Post
The fieldAverage-functionObject is NOT part of the simpleFunction-Objects and therefor does things differently (probably ignores "after"). One of the OF-tutorials (can'T remember which) uses it. Have a look there how it is done
Dear Bernhard,

Ok, I got it working. Mainly thanks to your source-code for simpleFunctionObject.
So thank you for that.

I have another question, how do you control the calling of the member functions from the channelFoam? In the comments you give some information about the calling of "start" and "execute". But for the fieldAverage function the channelFoam calls the "constructor", but also "execute" and "write". How can you manipulate this? For instance add a new member function to the class which is called from the solver?

Testing the "libsampling.so" library it appears that the "execute" function is not called by the solver, but only the "write" function.

Thanks in advance,

Regards,

Steven

Last edited by stevenvanharen; October 5, 2010 at 06:24.
stevenvanharen is offline   Reply With Quote

Old   October 5, 2010, 12:41
Default
  #5
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 stevenvanharen View Post
Dear Bernhard,

Ok, I got it working. Mainly thanks to your source-code for simpleFunctionObject.
So thank you for that.

I have another question, how do you control the calling of the member functions from the channelFoam? In the comments you give some information about the calling of "start" and "execute". But for the fieldAverage function the channelFoam calls the "constructor", but also "execute" and "write". How can you manipulate this? For instance add a new member function to the class which is called from the solver?

Testing the "libsampling.so" library it appears that the "execute" function is not called by the solver, but only the "write" function.

Thanks in advance,

Regards,

Steven
Hi Steve!

Just a pointer for further research:
http://foam.sourceforge.net/doc/Doxy...2ab372ca5c257b
execute of all functionObjects get called whenever the time is increased. write is not in the interface of the functionObject http://foam.sourceforge.net/doc/Doxy...ionObject.html but a speciality of the simpleFunctionObjects

You can add any member function to your subclass, but only those in the standard-interface will be called at special times. So your own methods must be called from one of those. Not much you can do about it without rewritting the Time-class (which I wouldn'T advise)

Bernhard
gschaider is offline   Reply With Quote

Old   October 6, 2010, 08:04
Default
  #6
Senior Member
 
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 15
stevenvanharen is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Hi Steve!

Just a pointer for further research:
http://foam.sourceforge.net/doc/Doxy...2ab372ca5c257b
execute of all functionObjects get called whenever the time is increased. write is not in the interface of the functionObject http://foam.sourceforge.net/doc/Doxy...ionObject.html but a speciality of the simpleFunctionObjects

You can add any member function to your subclass, but only those in the standard-interface will be called at special times. So your own methods must be called from one of those. Not much you can do about it without rewritting the Time-class (which I wouldn'T advise)

Bernhard
Ok, thanks! Indeed found the call to execute in the time class. Now at least I am sure about what is going on.

Thank you very much for your help!

Regards,

Steven
stevenvanharen is offline   Reply With Quote

Reply


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
different between the various averaging huwei CFX 3 February 22, 2015 13:09
When to use mass flow averaging cspectre CFX 2 December 6, 2009 05:30
Averaging LES iko FLUENT 3 July 3, 2008 05:55
Laplacian-weighted averaging Ruben Main CFD Forum 0 August 21, 2005 20:46
Start of averaging in LES fab Main CFD Forum 2 June 16, 2005 04:53


All times are GMT -4. The time now is 15:31.