Streamlined lbpm_morph_pp, takes input radius, reads initial ID from ID.xxxxx, performs morphological drainage

This commit is contained in:
James E McClure
2017-08-18 14:28:37 -04:00
parent dbf3389b2d
commit 2dd34e336d
2 changed files with 7 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
#for var in ${LOADEDMODULES//:/ }; do if [ " ${var///*/}" != " modules" ]; then module unload " ${var///*/}" > /dev/null 2>&1; fi; done
source $MODULESHOME/init/bash
module unload PrgEnv-intel
module unload PrgEnv-intel
module load PrgEnv-gnu
module unload gcc
module load gcc/5.3.0

View File

@@ -234,8 +234,9 @@ int main(int argc, char **argv)
int Nz = nz;
double GlobalNumber = 1.f;
double count,countGlobal,totalGlobal;
double count,countGlobal,totalGlobal,count_wet_global;
count = 0.f;
double count_wet= 0.f;
for (int k=0; k<nz; k++){
for (int j=0; j<ny; j++){
for (int i=0; i<nx; i++){
@@ -243,18 +244,19 @@ int main(int argc, char **argv)
if (SignDist(i,j,k) < 0.0) id[n] = 0;
else{
// initially saturated with wetting phase
id[n] = 2;
//id[n] = 2;
count+=1.0;
if (id[n] == 2) count_wet+=1.0;
}
}
}
}
// total Global is the number of nodes in the pore-space
MPI_Allreduce(&count,&totalGlobal,1,MPI_DOUBLE,MPI_SUM,comm);
MPI_Allreduce(&count_wet,&count_wet_global,1,MPI_DOUBLE,MPI_SUM,comm);
double porosity=totalGlobal/(double(nprocx*nprocy*nprocz)*double(nx-2)*double(ny-2)*double(nz-2));
if (rank==0) printf("Media Porosity: %f \n",porosity);
if (rank==0) printf("Initial saturation: %f \n",count_wet_global/totalGlobal);
if (rank==0) printf("Starting morhpological drainage with critical radius = %f \n",Rcrit);
int imin,jmin,kmin,imax,jmax,kmax;