|
[Sponsors] |
Averaging a field in parallel during the simulation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 23, 2013, 12:07 |
Averaging a field in parallel during the simulation
|
#1 |
Member
Saba Saeb
Join Date: Dec 2010
Location: Erlangen, Germany
Posts: 32
Rep Power: 16 |
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 |
|
July 23, 2013, 12:31 |
|
#2 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30 |
Something along these lines might work:
Code:
int numprocs; MPI_Comm_size(MPI_COMM_WORLD, &numprocs); tauw /= numprocs; Info<< tauw << endl; 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. Last edited by akidess; July 23, 2013 at 12:34. Reason: Better version |
|
July 23, 2013, 12:39 |
|
#3 | |
Member
Saba Saeb
Join Date: Dec 2010
Location: Erlangen, Germany
Posts: 32
Rep Power: 16 |
Quote:
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 |
||
July 23, 2013, 12:40 |
|
#4 |
Senior Member
|
There is gAverage function.
Explanation and examples can be found for example at - http://www.cfd-online.com/Forums/ope...tml#post202817. |
|
July 23, 2013, 13:13 |
|
#5 | |
Member
Saba Saeb
Join Date: Dec 2010
Location: Erlangen, Germany
Posts: 32
Rep Power: 16 |
Quote:
gAverage is apparently solving the problem. Tnx for your hint. Cheers, Saba |
||
|
|
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 14:07 |
help with command line in parallel simulation | ernest | STAR-CCM+ | 8 | August 17, 2011 06:02 |
A parallel simulation problem in DPM | satum | FLUENT | 0 | October 21, 2008 06:38 |
How to run parallel simulation on PC with two-CPU? | Jimmy | FLUENT | 1 | July 14, 2008 01:46 |
How to run a parallel simulation? | J.Gimbun | FLUENT | 9 | May 24, 2006 06:47 |