|
[Sponsors] |
how to share a scalar between processors in parallel Run |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 19, 2013, 06:27 |
how to share a scalar between processors in parallel Run
|
#1 |
Senior Member
Join Date: Jun 2011
Posts: 163
Rep Power: 15 |
Hi all
I want to solve the single DOF forced and damped vibration equation for displacement of tip point of a plate(m*d2x/dt2+c*dx/dt+k*x=F) and displacement of other points of plate are explicitly obtained from the first mode of the plate the code in serial run give correct results when I run this code in parallel for calculating displacement of other points of plate only the first processor is used correct x and others processors is used zero instead of x how can I share the x value between all processors ? |
|
July 19, 2013, 14:35 |
|
#2 |
Senior Member
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 18 |
Hi Mechy,
This might not be the perfect way to do it but if you're certain that your value is correct on one processor and zero on the others, you could so a sum and reduce so that your value is identical on all processors. Code:
//Assuming this is the x you mentioned, and it is a scalar scalar x; reduce(x, sumOp<scalar>()); In other words, With i being the processor number, x[i] = sum(x[i]) Again, this will work assuming that x is non-zero and correct on one processor and zero on all others. There is surely a way to handle other situations but this is all I can come up with off the top of my head. You might have to put the Pstream name space on reduce like this: Pstream::reduce(...) Let me know if this doesn't work! Cheers, Kyle edit: change returnReduce to reduce. |
|
July 19, 2013, 17:25 |
|
#3 | |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
Quote:
|
||
July 19, 2013, 17:33 |
Hi Mooney
|
#4 |
Senior Member
Join Date: Jun 2011
Posts: 163
Rep Power: 15 |
Hi Mooney
thanks so much for your reply yes, in this case it works well what shoul I do if the value of x is not equal to zero on non master procesors ? in other words how we can use the value of objects on master processor ? Best Regards |
|
July 19, 2013, 17:36 |
|
#5 | |
Senior Member
Join Date: Jun 2011
Posts: 163
Rep Power: 15 |
Quote:
Hi Daniel can you give me more information Best Regards |
||
July 19, 2013, 17:48 |
|
#6 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
Mechy,
This is where it gets a little more difficult, but you can find information here. I used another function called MPI_Bcast and you can see my example in my GPU library cufflink. MPI_Bcast sends out the value from the master node to all other nodes and you can see some instructions here. The rest...the internet knows . Good Luck! |
|
July 20, 2013, 10:57 |
|
#7 | |
Senior Member
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23 |
Quote:
Code:
label x = 0; if (Pstream::master()) { x = 1; } Pout<< x << endl; Pstream::scatter(x); Pout<< x << endl;
__________________
Laurence R. McGlashan :: Website |
||
July 21, 2013, 23:54 |
|
#8 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
Well that's easy enough!
|
|
July 22, 2013, 07:32 |
|
#9 |
Senior Member
Join Date: Jun 2011
Posts: 163
Rep Power: 15 |
Is it possible to reconstruct pressure or velocity on a boundary in a parallel run and obtain the
pressure on that boundary for example: if during a run the pressure at processor N is shown by PN and they are as follow how we can reconstruct them P0= 20 ( -55.8428 -57.6691 -61.1336 -65.5385 -70.2184 -74.7188 -78.6798 -81.829 -83.9898 -85.0677 123.47 125.28 128.745 133.15 137.831 142.333 146.297 149.452 151.617 152.696 ) P1= 25 ( -85.0475 -83.8217 -81.4402 -77.9027 -73.199 -67.2925 -60.0901 -51.3958 -40.7595 -28.5443 13.0599 23.4403 33.5093 43.5004 53.6818 152.681 151.464 149.081 145.536 140.815 134.877 127.62 118.849 108.006 95.2818 ) P2=0() P3=0() |
|
July 25, 2013, 03:18 |
|
#10 |
Senior Member
Join Date: Jun 2011
Posts: 163
Rep Power: 15 |
Is it possible to reconstruct pressure or velocity on a boundary in a parallel run and obtain the
pressure on that boundary for example: if during a run the pressure at processor N is shown by PN and they are as follow how we can reconstruct them P0= 20 ( -55.8428 -57.6691 -61.1336 -65.5385 -70.2184 -74.7188 -78.6798 -81.829 -83.9898 -85.0677 123.47 125.28 128.745 133.15 137.831 142.333 146.297 149.452 151.617 152.696 ) P1= 25 ( -85.0475 -83.8217 -81.4402 -77.9027 -73.199 -67.2925 -60.0901 -51.3958 -40.7595 -28.5443 13.0599 23.4403 33.5093 43.5004 53.6818 152.681 151.464 149.081 145.536 140.815 134.877 127.62 118.849 108.006 95.2818 ) P2=0() P3=0() |
|
July 25, 2013, 09:52 |
|
#11 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
Mechy,
You posted this question on another thread already http://www.cfd-online.com/Forums/ope...allel-run.html This will probably not get answered any faster doing this, in fact it might have the opposite effect. You might want to refer to the Forum rules, particularly number 6. And for some general guidelines for posts, see http://www.cfd-online.com/Forums/ope...-get-help.html. I would focus this discussion on your other thread. You can then reply to yourself with more information on what you are trying to achieve or what you have tried already and I'm sure people will answer . Good Luck! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 13 | March 24, 2021 08:15 |
dieselFoam problem!! trying to introduce a new heat transfer model | vivek070176 | OpenFOAM Programming & Development | 10 | December 24, 2014 00:48 |
Parallel run - number of processors | danvica | OpenFOAM Running, Solving & CFD | 4 | April 5, 2012 12:57 |
Can't run in parallel | JulytoNovember | OpenFOAM Running, Solving & CFD | 2 | March 31, 2012 10:28 |
SnappyHexMesh OF-1.6-ext crashes on a parallel run | norman1981 | OpenFOAM Bugs | 5 | December 7, 2011 13:48 |