Fixed a little bug with the object oriented communication in DOmain.h
This commit is contained in:
parent
0e826c22b9
commit
0c8a8fc769
@ -29,26 +29,49 @@ int main(int argc, char **argv)
|
||||
printf("Running two-phase averaging test on %i processors \n",nprocs);
|
||||
|
||||
int npx,npy,npz;
|
||||
int i,j,k;
|
||||
int i,j,k,n;
|
||||
int Nx,Ny,Nz;
|
||||
double Lx,Ly,Lz;
|
||||
Nx=Ny=Nz=40;
|
||||
npx=npy=1;
|
||||
npz=nprocs;
|
||||
npx=npy=npz=2;
|
||||
// npz=nprocs;
|
||||
Lx=Ly=Lz=1.0;
|
||||
int BC=0; // periodic boundary condition
|
||||
|
||||
Domain Dm(Nx,Ny,Nz,rank,npx,npy,npz,Lx,Ly,Lz,BC);
|
||||
|
||||
for (i=0; i<Dm.Nx*Dm.Ny*Dm.Nz; i++) Dm.id[i] = 1;
|
||||
|
||||
Dm.CommInit(MPI_COMM_WORLD);
|
||||
|
||||
TwoPhase Averages(Dm);
|
||||
int timestep=0;
|
||||
|
||||
Nx = Dm.Nx;
|
||||
Ny = Dm.Ny;
|
||||
Nz = Dm.Nz;
|
||||
|
||||
int size_x = npx*(Nx-2);
|
||||
int size_y = npy*(Ny-2);
|
||||
int size_z = npz*(Nz-2);
|
||||
|
||||
int radius = 0.3*min(min(size_y,size_z),size_x);
|
||||
radius = 15;
|
||||
// printf("rank=%i,iproc= %i,jproc=%i,kproc=%i \n",rank,Dm.iproc,Dm.jproc,Dm.kproc);
|
||||
printf("Sphere radius = %i \n",radius);
|
||||
// printf("sendcount_x = %i \n",Dm.sendCount_X);
|
||||
|
||||
// Initializing a simple case
|
||||
double x,y,z,distance;
|
||||
for (k=0; k<Nz; k++){
|
||||
for (j=0; j<Ny; j++){
|
||||
for (i=0; i<Nx; i++){
|
||||
Averages.Phase(i,j,k) = sqrt((1.0*i-0.5*Nx)*(1.0*i-0.5*Nx)+(1.0*j-0.5*Ny)*(1.0*j-0.5*Ny)+(1.0*k-0.5*Nz)*(1.0*k-0.5*Nz))-0.3*Nx;
|
||||
|
||||
x = 1.0*(Dm.iproc*(Nx-2)+i-1)-0.5*size_x;
|
||||
y = 1.0*(Dm.jproc*(Ny-2)+j-1)-0.5*size_y;
|
||||
z = 1.0*(Dm.kproc*(Nz-2)+k-1)-0.5*size_z;
|
||||
distance=sqrt(x*x+y*y+z*z)-1.0*radius;
|
||||
Averages.Phase(i,j,k) = distance;
|
||||
Averages.SDs(i,j,k) = 100.0;
|
||||
Averages.SDn(i,j,k) = Averages.Phase(i,j,k);
|
||||
Averages.Phase_tplus(i,j,k) = Averages.Phase(i,j,k);
|
||||
@ -60,6 +83,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....................................................................
|
||||
// The following only need to be done once
|
||||
Averages.SetupCubes(Dm);
|
||||
@ -73,6 +97,13 @@ int main(int argc, char **argv)
|
||||
Averages.PrintAll(timestep);
|
||||
//....................................................................
|
||||
|
||||
|
||||
if (rank==0){
|
||||
FILE *PHASE;
|
||||
PHASE = fopen("Phase.00000","wb");
|
||||
fwrite(Averages.MeanCurvature.data,8,Nx*Ny*Nz,PHASE);
|
||||
fclose(PHASE);
|
||||
}
|
||||
// ****************************************************
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
return 0;
|
||||
|
@ -287,7 +287,6 @@ int main(int argc, char **argv)
|
||||
// Initialized domain and averaging framework for Two-Phase Flow
|
||||
int BC=pBC;
|
||||
Domain Dm(Nx,Ny,Nz,rank,nprocx,nprocy,nprocz,Lx,Ly,Lz,BC);
|
||||
Dm.CommInit(MPI_COMM_WORLD);
|
||||
TwoPhase Averages(Dm);
|
||||
|
||||
InitializeRanks( rank, nprocx, nprocy, nprocz, iproc, jproc, kproc,
|
||||
@ -295,7 +294,7 @@ int main(int argc, char **argv)
|
||||
rank_xy, rank_XY, rank_xY, rank_Xy, rank_xz, rank_XZ, rank_xZ, rank_Xz,
|
||||
rank_yz, rank_YZ, rank_yZ, rank_Yz );
|
||||
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
|
||||
Nz += 2;
|
||||
Nx = Ny = Nz; // Cubic domain
|
||||
@ -509,6 +508,10 @@ int main(int argc, char **argv)
|
||||
|
||||
#endif
|
||||
|
||||
// Initialize communication structures in averaging domain
|
||||
for (i=0; i<Dm.Nx*Dm.Ny*Dm.Nz; i++) Dm.id[i] = 1;
|
||||
Dm.CommInit(MPI_COMM_WORLD);
|
||||
|
||||
// Set up MPI communication structurese
|
||||
if (rank==0) printf ("Setting up communication control structures \n");
|
||||
//......................................................................................
|
||||
|
Loading…
Reference in New Issue
Block a user