diff --git a/common/Domain.h b/common/Domain.h index a70181ce..a8284cc4 100755 --- a/common/Domain.h +++ b/common/Domain.h @@ -1127,102 +1127,6 @@ inline void SignedDistance(double *Distance, int nspheres, double *List_cx, doub for (n=0; n> binCount; -// printf("Number of blob sizes: %i \n",binCount); - SizeX = new int [binCount]; - SizeY = new int [binCount]; - SizeZ = new int [binCount]; - for (bin=0; bin> 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]); - } - Dist.close(); - //....................................................................... -// cout << "Generating blocks... " << endl; - // Count for the total number of oil nodes - int count = 0; - // Count the total number of non-solid nodes - int total = 0; - for (i=0;i> binCount; +// printf("Number of blob sizes: %i \n",binCount); + SizeX = new int [binCount]; + SizeY = new int [binCount]; + SizeZ = new int [binCount]; + for (bin=0; bin> 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]); + } + Dist.close(); + //....................................................................... +// cout << "Generating blocks... " << endl; + // Count for the total number of oil nodes + int count = 0; + // Count the total number of non-solid nodes + int total = 0; + for (i=0;i 0.0 && BoundaryCondition==0){ phi_s = -phi_s; das = (phi_s+1.0)*0.5; @@ -446,6 +446,7 @@ int main(int argc, char **argv) if (rank == 0) printf("Resetting phi_s = %f, das = %f, dbs = %f \n", phi_s, das, dbs); FlipID(id,Nx*Ny*Nz); } +*/ // Initialize communication structures in averaging domain for (i=0; i +#include +#include +#include +#include +#include +#include + +inline void GenerateResidual(char *ID, int Nx, int Ny, int Nz, double Saturation) +{ + //....................................................................... + int i,j,k,n,Number,N; + int x,y,z,ii,jj,kk; + int sizeX,sizeY,sizeZ; + int *SizeX, *SizeY, *SizeZ; + +#ifdef NORANDOM + srand(10009); +#else + srand(time(NULL)); +#endif +// float bin; + //....................................................................... + N = Nx*Ny*Nz; + + int bin, binCount; + ifstream Dist("BlobSize.in"); + Dist >> binCount; +// printf("Number of blob sizes: %i \n",binCount); + SizeX = new int [binCount]; + SizeY = new int [binCount]; + SizeZ = new int [binCount]; + for (bin=0; bin> 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]); + } + Dist.close(); + //....................................................................... +// cout << "Generating blocks... " << endl; + // Count for the total number of oil nodes + int count = 0; + // Count the total number of non-solid nodes + int total = 0; + for (i=0;i> 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); + MPI_Bcast(&ny,1,MPI_INT,0,MPI_COMM_WORLD); + MPI_Bcast(&nz,1,MPI_INT,0,MPI_COMM_WORLD); + MPI_Bcast(&nprocx,1,MPI_INT,0,MPI_COMM_WORLD); + MPI_Bcast(&nprocy,1,MPI_INT,0,MPI_COMM_WORLD); + MPI_Bcast(&nprocz,1,MPI_INT,0,MPI_COMM_WORLD); + MPI_Bcast(&nspheres,1,MPI_INT,0,MPI_COMM_WORLD); + MPI_Bcast(&Lx,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_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"); + } + + char LocalRankFilename[40]; + + nx+=2; ny+=2; nz+=2; + int N = nx*ny*nz; + 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); + + for (int k=0; k