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

Averaging a field in parallel during the simulation

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 23, 2013, 11:07
Default Averaging a field in parallel during the simulation
  #1
Member
 
Saba Saeb
Join Date: Dec 2010
Location: Erlangen, Germany
Posts: 32
Rep Power: 6
saba_saeb is on a distinguished road
Hi,

I need to take the average of a field on a boundary during the simulation. I am doing that using the normal approach:

scalar tmp= average(frictionvelocity);

where frictionvelocity is a scalar field. Everything is running like a charm in serial, but the simulation would stop if I run it in parallel. I tried to tackle the problem using this approach:

scalar tmp= average(frictionVelocity);
scalar tauw = returnReduce(tmp, sumOp<scalar>());

But the output is not correct since the calculated averages on every processors are being added together which make tauw that seems incorrect. Any idea would be appreciated.

Tnx,
Saba
saba_saeb is offline   Reply With Quote

Old   July 23, 2013, 11:31
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
Something along these lines might work:

Code:
int numprocs;
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);

tauw /= numprocs;

Info<< tauw << endl;
Ninja edit - this is better:
Code:
label numprocs=Pstream::nProcs();
tauw /= numprocs;
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology

Last edited by akidess; July 23, 2013 at 11:34. Reason: Better version
akidess is offline   Reply With Quote

Old   July 23, 2013, 11:39
Default
  #3
Member
 
Saba Saeb
Join Date: Dec 2010
Location: Erlangen, Germany
Posts: 32
Rep Power: 6
saba_saeb is on a distinguished road
Quote:
Originally Posted by akidess View Post
Something along these lines might work:

Code:
int numprocs;
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);

tauw /= numprocs;

Info<< tauw << endl;
Ninja edit - this is better:
Code:
label numprocs=Pstream::nProcs();
tauw /= numprocs;
Hi Anton,

Tnx for your reply.
That was the first idea that came to my mind, not however division by the total number of processors, but, division by no. of processors in x direction time no. of processors in z direction since friction velocity is just being calculated on the boundary located at the bottom of a channel, in my case. However, this is not still giving me the expected results since friction velocity is not being spread uniformly along the wall!
If anything seems unclear to me, please let me know.

Cheers,
Saba
saba_saeb is offline   Reply With Quote

Old   July 23, 2013, 11:40
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,083
Rep Power: 18
alexeym will become famous soon enough
There is gAverage function.

Explanation and examples can be found for example at - Residuals for convergence of segregated solvers.
alexeym is offline   Reply With Quote

Old   July 23, 2013, 12:13
Default
  #5
Member
 
Saba Saeb
Join Date: Dec 2010
Location: Erlangen, Germany
Posts: 32
Rep Power: 6
saba_saeb is on a distinguished road
Quote:
Originally Posted by alexeym View Post
There is gAverage function.

Explanation and examples can be found for example at - Residuals for convergence of segregated solvers.
Hi Alexey,

gAverage is apparently solving the problem. Tnx for your hint.

Cheers,
Saba
saba_saeb is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
constant variables in all processors , parallel simulation saba_saeb OpenFOAM Programming & Development 0 July 17, 2013 13:07
help with command line in parallel simulation ernest STAR-CCM+ 8 August 17, 2011 05:02
A parallel simulation problem in DPM satum FLUENT 0 October 21, 2008 05:38
How to run parallel simulation on PC with two-CPU? Jimmy FLUENT 1 July 14, 2008 00:46
How to run a parallel simulation? J.Gimbun FLUENT 9 May 24, 2006 05:47


All times are GMT -4. The time now is 23:41.