- **Main CFD Forum**
(*https://www.cfd-online.com/Forums/main/*)

- - **Some help for Red black SOR with OpenMP
**
(*https://www.cfd-online.com/Forums/main/10750-some-help-red-black-sor-openmp.html*)

Some help for Red black SOR with OpenMP
Hi everybody, I'm trying to parallelize ( with OpenMP ) a Numerical recipes routine. In fact, this is a Red black SOR algorithm.
But I don't know how to begin... If somone could help me for this first experience... Davoche PS: You can find the algorithm below ************************************************** ph():represent the 3D quantity to solve res(): is the source term omeg : is the relaxation parameter ************************************************** * kjsw=1 do ipass=1,2 isw=kjsw do 14 k=2,n3x do 14 j=2,n2y do 13 i=isw+1,n1z,2 fj=(-(ph(i+1,j,k)+ph(i-1,j,k) +ph(i,j-1,k)+ph(i,j+1,k) +ph(i,j,k+1)+ph(i,j,k-1))+res(i,j,k)) ph(i,j,k)=omeg*(fj/6)+(1.d0-omeg)*ph(i,j,k) 13 continue isw=3-isw 14 continue kjsw=3-kjsw 15 continue |

Re: Some help for Red black SOR with OpenMP
Parallelize the inner loop (there are no data dependencies as far as I can tell). The speed-up you will get will depend upon the size of the maximum index in the loop.
I forget the exact syntax but something like: !$OMP PARALLEL DO (PRIVATE i,fj) . . . !$OMP END PARALLEL DO should be about right. |

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