Added transition zone for periodic BC in test/lbpm_segmented_decomp
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
* will output distance functions for phases
|
* will output distance functions for phases
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@@ -63,6 +62,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
// Computational domain
|
// Computational domain
|
||||||
|
//.................................................
|
||||||
MPI_Bcast(&nx,1,MPI_INT,0,MPI_COMM_WORLD);
|
MPI_Bcast(&nx,1,MPI_INT,0,MPI_COMM_WORLD);
|
||||||
MPI_Bcast(&ny,1,MPI_INT,0,MPI_COMM_WORLD);
|
MPI_Bcast(&ny,1,MPI_INT,0,MPI_COMM_WORLD);
|
||||||
MPI_Bcast(&nz,1,MPI_INT,0,MPI_COMM_WORLD);
|
MPI_Bcast(&nz,1,MPI_INT,0,MPI_COMM_WORLD);
|
||||||
@@ -74,6 +74,13 @@ int main(int argc, char **argv)
|
|||||||
MPI_Bcast(&Ly,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
|
MPI_Bcast(&Ly,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
|
||||||
MPI_Bcast(&Lz,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
|
MPI_Bcast(&Lz,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
|
||||||
//.................................................
|
//.................................................
|
||||||
|
MPI_Bcast(&Ny,1,MPI_INT,0,MPI_COMM_WORLD);
|
||||||
|
MPI_Bcast(&Ny,1,MPI_INT,0,MPI_COMM_WORLD);
|
||||||
|
MPI_Bcast(&Nz,1,MPI_INT,0,MPI_COMM_WORLD);
|
||||||
|
MPI_Bcast(&xStart,1,MPI_INT,0,MPI_COMM_WORLD);
|
||||||
|
MPI_Bcast(&yStart,1,MPI_INT,0,MPI_COMM_WORLD);
|
||||||
|
MPI_Bcast(&zStart,1,MPI_INT,0,MPI_COMM_WORLD);
|
||||||
|
//.................................................
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
|
|
||||||
// Check that the number of processors >= the number of ranks
|
// Check that the number of processors >= the number of ranks
|
||||||
@@ -111,6 +118,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
Dm.CommInit(MPI_COMM_WORLD);
|
Dm.CommInit(MPI_COMM_WORLD);
|
||||||
|
|
||||||
|
// number of sites to use for periodic boundary condition transition zone
|
||||||
|
int z_transition_size = nprocz*nz - Nz - zStart;
|
||||||
|
|
||||||
// Set up the sub-domains
|
// Set up the sub-domains
|
||||||
if (rank==0){
|
if (rank==0){
|
||||||
printf("Distributing subdomains across %i processors \n",nprocs);
|
printf("Distributing subdomains across %i processors \n",nprocs);
|
||||||
@@ -130,7 +140,10 @@ int main(int argc, char **argv)
|
|||||||
for (i=0;i<nx+2;i++){
|
for (i=0;i<nx+2;i++){
|
||||||
int x = xStart + ip*nx + i-1;
|
int x = xStart + ip*nx + i-1;
|
||||||
int y = yStart + jp*ny + j-1;
|
int y = yStart + jp*ny + j-1;
|
||||||
int z = zStart + kp*nz + k-1;
|
// int z = zStart + kp*nz + k-1;
|
||||||
|
int z = zStart + kp*nz + k-1 - z_transition_size/2;
|
||||||
|
if (z<0) z=0;
|
||||||
|
if (!(z<Nz)) z=Nz-1;
|
||||||
int nlocal = k*(nx+2)*(ny+2) + j*(nx+2) + i;
|
int nlocal = k*(nx+2)*(ny+2) + j*(nx+2) + i;
|
||||||
int nglobal = z*Nx*Ny+y*Nx+x;
|
int nglobal = z*Nx*Ny+y*Nx+x;
|
||||||
tmp[nlocal] = SegData[nglobal];
|
tmp[nlocal] = SegData[nglobal];
|
||||||
|
|||||||
Reference in New Issue
Block a user