Functinoing lbpm_random_pp works on CPU version / Eos

This commit is contained in:
James E McClure
2015-06-20 00:57:46 -04:00
parent c456fc2d2e
commit dbad55ed03
2 changed files with 14 additions and 12 deletions

View File

@@ -1571,7 +1571,7 @@ int main(int argc, char **argv)
// Timestep completed! // Timestep completed!
timestep++; timestep++;
//................................................................... //...................................................................
if (timestep%5000 == 995){ if (timestep%100 == 95){
//........................................................................... //...........................................................................
// Copy the phase indicator field for the earlier timestep // Copy the phase indicator field for the earlier timestep
DeviceBarrier(); DeviceBarrier();
@@ -1579,7 +1579,7 @@ int main(int argc, char **argv)
// Averages.ColorToSignedDistance(beta,Averages.Phase,Averages.Phase_tplus); // Averages.ColorToSignedDistance(beta,Averages.Phase,Averages.Phase_tplus);
//........................................................................... //...........................................................................
} }
if (timestep%5000 == 0){ if (timestep%100 == 0){
//........................................................................... //...........................................................................
// Copy the data for for the analysis timestep // Copy the data for for the analysis timestep
//........................................................................... //...........................................................................
@@ -1594,7 +1594,7 @@ int main(int argc, char **argv)
CopyToHost(Averages.Vel_z.get(),&Velocity[2*N],N*sizeof(double)); CopyToHost(Averages.Vel_z.get(),&Velocity[2*N],N*sizeof(double));
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
} }
if (timestep%5000 == 5){ if (timestep%100 == 5){
//........................................................................... //...........................................................................
// Copy the phase indicator field for the later timestep // Copy the phase indicator field for the later timestep
DeviceBarrier(); DeviceBarrier();

View File

@@ -118,9 +118,11 @@ int main(int argc, char **argv)
int InitialWetting; int InitialWetting;
double Saturation; double Saturation;
if (argc == 3){ // if (argc == 3){
sscanf(argv[1],"%lf",&Saturation); //sscanf(argv[1],"%lf",&Saturation);
sscanf(argv[2],"%d",&InitialWetting); //sscanf(argv[2],"%d",&InitialWetting);
Saturation=strtod(argv[1],NULL);
InitialWetting=atoi(argv[2]);
if (rank==0){ if (rank==0){
printf("Initializing wetting phase saturation of %f \n",Saturation); printf("Initializing wetting phase saturation of %f \n",Saturation);
if (InitialWetting == 1) if (InitialWetting == 1)
@@ -128,7 +130,7 @@ int main(int argc, char **argv)
else else
printf("Begin from connected non-wetting phase \n"); printf("Begin from connected non-wetting phase \n");
} }
} // }
if (InitialWetting == 1) Saturation=1.0-Saturation; if (InitialWetting == 1) Saturation=1.0-Saturation;
//....................................................................... //.......................................................................
@@ -136,7 +138,6 @@ int main(int argc, char **argv)
//....................................................................... //.......................................................................
int nprocx, nprocy, nprocz, nx, ny, nz, nspheres; int nprocx, nprocy, nprocz, nx, ny, nz, nspheres;
double Lx, Ly, Lz; double Lx, Ly, Lz;
int Nx,Ny,Nz;
int i,j,k,n; int i,j,k,n;
int BC=0; int BC=0;
@@ -196,21 +197,22 @@ int main(int argc, char **argv)
for (int k=0; k<nz; k++){ for (int k=0; k<nz; k++){
for (int j=0; j<ny; j++){ for (int j=0; j<ny; j++){
for (int i=0; i<nx; i++){ for (int i=0; i<nx; i++){
n = k*nx*ny+j*nx+i;
if (SignDist(i,j,k) < 0.0) id[n] = 0; if (SignDist(i,j,k) < 0.0) id[n] = 0;
else id[n] = 2; else id[n] = 2;
} }
} }
} }
// Generate the residual NWP // Generate the residual NWP
if (rank==0) printf("Initializing with NWP saturation = %f \n",Saturation); if (rank==0) printf("Initializing with NWP saturation = %f \n",Saturation);
GenerateResidual(id,Nx,Ny,Nz,Saturation); GenerateResidual(id,nx,ny,nz,Saturation);
if (InitialWetting == 1) FlipID(id,Nx*Ny*Nz); if (InitialWetting == 1) FlipID(id,nx*ny*nz);
sprintf(LocalRankFilename,"ID.%05i",rank); sprintf(LocalRankFilename,"ID.%05i",rank);
FILE *ID = fopen(LocalRankFilename,"wb"); FILE *ID = fopen(LocalRankFilename,"wb");
fread(id,1,N,ID); fwrite(id,1,N,ID);
fclose(ID); fclose(ID);
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);