Fixed bug in lbpm_color_simulator.h where the file stream was not provided to fprintf; added extra functionality to morphological preprocessors to print pore size

This commit is contained in:
James E McClure
2016-08-02 15:00:41 -04:00
parent c706bcd0fc
commit 769ba9d4b1
3 changed files with 34 additions and 3 deletions

View File

@@ -369,7 +369,7 @@ void run_analysis( int timestep, int restart_interval,
// Retain the timestep associated with the restart files
if (rank==0){
FILE *Rst = fopen("Restart.txt","w");
fprintf("%i\n",timestep);
fprintf(Rst,"%i\n",timestep);
fclose(Rst);
}
// Write the restart file (using a seperate thread)

View File

@@ -161,7 +161,37 @@ int main(int argc, char **argv)
MPI_Allreduce(&maxdist,&maxdistGlobal,1,MPI_DOUBLE,MPI_MAX,comm);
float porosity=float(totalGlobal)/(nprocx*nprocy*nprocz*(nx-2)*(ny-2)*(nz-2));
if (rank==0) printf("Media Porosity: %f \n",porosity);
if (rank==0) printf("Maximum pore size: %f \n",maxdistGlobal);
if (rank==0) printf("Maximum pore size: %f \n",maxdistGlobal);\
// Get all local pore sizes (local maxima)
sprintf(LocalRankFilename,"PoreSize.%05i",rank);
FILE *PORESIZE=fopen(LocalRankFilename,"r");
for (int k=1; k<nz-1; k++){
for (int j=1; j<ny-1; j++){
for (int i=1; i<nx-1; i++){
n = k*nx*ny+j*nx+i;
if (SignDist(i,j,k) > 0.0){
// Generate a list of all local maxima (each processor -- aggregate these later)
if ( SignDist(i,j,k) > SignDist(i+1,j,k) && SignDist(i,j,k) > SignDist(i-1,j,k) &&
SignDist(i,j,k) > SignDist(i,j+1,k) && SignDist(i,j,k) > SignDist(i,j-1,k) &&
SignDist(i,j,k) > SignDist(i,j,k+1) && SignDist(i,j,k) > SignDist(i,j,k-1) &&
SignDist(i,j,k) > SignDist(i+1,j+1,k) && SignDist(i,j,k) > SignDist(i-1,j+1,k) &&
SignDist(i,j,k) > SignDist(i+1,j-1,k) && SignDist(i,j,k) > SignDist(i-1,j-1,k) &&
SignDist(i,j,k) > SignDist(i+1,j,k+1) && SignDist(i,j,k) > SignDist(i-1,j,k+1) &&
SignDist(i,j,k) > SignDist(i+1,j,k-1) && SignDist(i,j,k) > SignDist(i-1,j,k-1) &&
SignDist(i,j,k) > SignDist(i,j+1,k+1) && SignDist(i,j,k) > SignDist(i,j-1,k+1) &&
SignDist(i,j,k) > SignDist(i,j+1,k-1) && SignDist(i,j,k) > SignDist(i,j-1,k-1) &&
SignDist(i,j,k) > SignDist(i+1,j+1,k+1) && SignDist(i,j,k) > SignDist(i-1,j-1,k-1) &&
SignDist(i,j,k) > SignDist(i+1,j-1,k+1) && SignDist(i,j,k) > SignDist(i-1,j+1,k-1) &&
SignDist(i,j,k) > SignDist(i-1,j+1,k+1) && SignDist(i,j,k) > SignDist(i+1,j-1,k-1) &&
SignDist(i,j,k) > SignDist(i+1,j+1,k-1) && SignDist(i,j,k) > SignDist(i-1,j-1,k+1)){
fprintf(PORESIZE,"%f ", SignDist(i,j,k));
}
}
}
}
}
fclose(PORESIZE);
Dm.CommInit(comm);
int iproc = Dm.iproc;

View File

@@ -266,7 +266,8 @@ int main(int argc, char **argv)
for (jj=jmin; jj<jmax; jj++){
for (ii=imin; ii<imax; ii++){
int nn = kk*nx*ny+jj*nx+ii;
if (id[nn] == 2 && (ii-i)*(ii-i)+(jj-j)*(jj-j)+(kk-k)*(kk-k) < Rcrit*Rcrit){
double dsq = double((ii-i)*(ii-i)+(jj-j)*(jj-j)+(kk-k)*(kk-k));
if (id[nn] == 2 && dsq <= Rcrit*Rcrit){
LocalNumber++;
id[nn]=1;
}