diff --git a/tests/lbpm_morphdrain_pp.cpp b/tests/lbpm_morphdrain_pp.cpp index 2c2b5e25..2b0cea33 100644 --- a/tests/lbpm_morphdrain_pp.cpp +++ b/tests/lbpm_morphdrain_pp.cpp @@ -53,10 +53,11 @@ int main(int argc, char **argv) MPI_Comm_rank(comm,&rank); MPI_Comm_size(comm,&nprocs); - double Rcrit; - Rcrit=strtod(argv[1],NULL); + //double Rcrit; + double SW=strtod(argv[1],NULL); if (rank==0){ - printf("Critical radius %f (voxels)\n",Rcrit); + //printf("Critical radius %f (voxels)\n",Rcrit); + printf("Target saturation %f \n",SW); } // } @@ -192,7 +193,8 @@ int main(int argc, char **argv) int kproc = Dm.kproc; // Generate the NWP configuration - if (rank==0) printf("Performing morphological drainage with critical radius %f \n", Rcrit); + //if (rank==0) printf("Performing morphological drainage with critical radius %f \n", Rcrit); + if (rank==0) printf("Performing morphological drainage with target saturation %f \n", SW); // GenerateResidual(id,nx,ny,nz,Saturation); // Communication buffers @@ -250,10 +252,11 @@ int main(int argc, char **argv) int Nx = nx; int Ny = ny; int Nz = nz; - float sat = 0.f; + double sw=1.f; int GlobalNumber = 1; - int Window=int(Rcrit); + double radius,Rcrit; + radius = 0.0; // Layer the inlet with NWP if (kproc == 0){ for(j=0; j radius){ + radius=SignDist(i,j,k); + } } } } - int imin,jmin,kmin,imax,jmax,kmax; - while (GlobalNumber != 0){ + MPI_Allreduce(&radius,&Rcrit,1,MPI_DOUBLE,MPI_MAX,comm); + int Window=int(Rcrit); - if (rank==0) printf("GlobalNumber=%i \n",GlobalNumber); - int LocalNumber=0; - for(k=0; k Rcrit){ - // loop over the window and update - imin=max(1,i-Window); - jmin=max(1,j-Window); - kmin=max(1,k-Window); - imax=min(Nx-1,i+Window); - jmax=min(Ny-1,j+Window); - kmax=min(Nz-1,k+Window); - for (kk=kmin; kk SW){ + + // decrease critical radius + Rcrit -= deltaR; + Window=int(Rcrit); + GlobalNumber = 1; + + while (GlobalNumber != 0){ + + if (rank==0) printf("GlobalNumber=%i \n",GlobalNumber); + int LocalNumber=0; + for(k=0; k Rcrit){ + // loop over the window and update + imin=max(1,i-Window); + jmin=max(1,j-Window); + kmin=max(1,k-Window); + imax=min(Nx-1,i+Window); + jmax=min(Ny-1,j+Window); + kmax=min(Nz-1,k+Window); + for (kk=kmin; kk