diff --git a/tests/lbpm_random_pp.cpp b/tests/lbpm_random_pp.cpp index e565f494..c44bece9 100644 --- a/tests/lbpm_random_pp.cpp +++ b/tests/lbpm_random_pp.cpp @@ -20,6 +20,34 @@ inline void FlipID(char *ID, int N) } } +//************************************************************************* +// Implementation of Two-Phase Immiscible LBM using CUDA +//************************************************************************* +inline void PackID(int *list, int count, char *sendbuf, char *ID){ + // Fill in the phase ID values from neighboring processors + // This packs up the values that need to be sent from one processor to another + int idx,n; + + for (idx=0; idx> nprocx; - domain >> nprocy; - domain >> nprocz; - domain >> nx; - domain >> ny; - domain >> nz; - domain >> nspheres; - domain >> Lx; - domain >> Ly; - domain >> Lz; + if (rank==0){ + ifstream domain("Domain.in"); + domain >> nprocx; + domain >> nprocy; + domain >> nprocz; + domain >> nx; + domain >> ny; + domain >> nz; + domain >> nspheres; + domain >> Lx; + domain >> Ly; + domain >> Lz; - } + } MPI_Barrier(MPI_COMM_WORLD); // Computational domain MPI_Bcast(&nx,1,MPI_INT,0,MPI_COMM_WORLD); @@ -83,60 +111,72 @@ int main(int argc, char **argv) //................................................. MPI_Barrier(MPI_COMM_WORLD); - // Check that the number of processors >= the number of ranks - if ( rank==0 ) { - printf("Number of MPI ranks required: %i \n", nprocx*nprocy*nprocz); - printf("Number of MPI ranks used: %i \n", nprocs); - printf("Full domain size: %i x %i x %i \n",nx*nprocx,ny*nprocy,nz*nprocz); - } - if ( nprocs < nprocx*nprocy*nprocz ){ - ERROR("Insufficient number of processors"); - } + // Check that the number of processors >= the number of ranks + if ( rank==0 ) { + printf("Number of MPI ranks required: %i \n", nprocx*nprocy*nprocz); + printf("Number of MPI ranks used: %i \n", nprocs); + printf("Full domain size: %i x %i x %i \n",nx*nprocx,ny*nprocy,nz*nprocz); + } + if ( nprocs < nprocx*nprocy*nprocz ){ + ERROR("Insufficient number of processors"); + } char LocalRankFilename[40]; int BoundaryCondition=0; Domain Dm(nx,ny,nz,rank,nprocx,nprocy,nprocz,Lx,Ly,Lz,BoundaryCondition); + for nx+=2; ny+=2; nz+=2; int N = nx*ny*nz; - char *id; - id = new char[N]; + char *id; + id = new char[N]; - DoubleArray SignDist(nx,ny,nz); - // Read the signed distance from file - sprintf(LocalRankFilename,"SignDist.%05i",rank); - FILE *DIST = fopen(LocalRankFilename,"rb"); - fread(SignDist.get(),8,N,DIST); - fclose(DIST); + // Define communication sub-domain -- everywhere + for (int k=0; k> binCount; int *SizeX, *SizeY, *SizeZ; -// printf("Number of blob sizes: %i \n",binCount); + // printf("Number of blob sizes: %i \n",binCount); SizeX = new int [binCount]; SizeY = new int [binCount]; SizeZ = new int [binCount]; @@ -144,7 +184,7 @@ int main(int argc, char **argv) Dist >> SizeX[bin]; Dist >> SizeY[bin]; Dist >> SizeZ[bin]; - // printf("Blob %i dimension: %i x %i x %i \n",bin, SizeX[bin], SizeY[bin], SizeZ[bin]); + // printf("Blob %i dimension: %i x %i x %i \n",bin, SizeX[bin], SizeY[bin], SizeZ[bin]); } Dist.close(); @@ -219,7 +259,7 @@ int main(int argc, char **argv) for (int k=1; k