Cleaning up lbpm_segmented_pp, remove comments, re-indent,etc.

This commit is contained in:
James E McClure 2016-11-16 16:14:56 -05:00
parent 4fb098c8c0
commit 84d9fed6e7

View File

@ -114,6 +114,7 @@ inline double Eikonal(DoubleArray &Distance, char *ID, Domain &Dm, int timesteps
Dyp = Distance(i,j+1,k) - Distance(i,j,k) + 0.5*Dyyp;
Dzp = Distance(i,j,k+1) - Distance(i,j,k) + 0.5*Dzzp;
Dxm = Distance(i,j,k) - Distance(i-1,j,k) + 0.5*Dxxm;
Dym = Distance(i,j,k) - Distance(i,j-1,k) + 0.5*Dyym;
Dzm = Distance(i,j,k) - Distance(i,j,k-1) + 0.5*Dzzm;
@ -336,113 +337,6 @@ int main(int argc, char **argv)
fwrite(Averages.SDs.data(),8,Averages.SDs.length(),DIST);
fclose(DIST);
/* // Solve for the position of the non-wetting phase
for (k=0;k<nz;k++){
for (j=0;j<ny;j++){
for (i=0;i<nx;i++){
n = k*nx*ny+j*nx+i;
// Initialize the non-wetting phase
if (Dm.id[n] == 1) id[n] = 1;
else id[n] = 0;
}
}
}
// Initialize the signed distance function
for (k=0;k<nz;k++){
for (j=0;j<ny;j++){
for (i=0;i<nx;i++){
n=k*nx*ny+j*nx+i;
// Initialize distance to +/- 1
Averages.Phase(i,j,k) = 2.0*id[n]-1.0;
}
}
}
MeanFilter(Averages.Phase);
if (rank==0) printf("Initialized non-wetting phase -- Converting to Signed Distance function \n");
SSO(Averages.Phase,id,Dm,100);
for (k=0;k<nz;k++){
for (j=0;j<ny;j++){
for (i=0;i<nx;i++){
n=k*nx*ny+j*nx+i;
Averages.Phase(i,j,k) -= 1.0;
// Initialize distance to +/- 1
// Dilation of the non-wetting phase
Averages.SDn(i,j,k) = -Averages.Phase(i,j,k);
Averages.Phase(i,j,k) = Averages.SDn(i,j,k);
Averages.Phase_tplus(i,j,k) = Averages.SDn(i,j,k);
Averages.Phase_tminus(i,j,k) = Averages.SDn(i,j,k);
Averages.DelPhi(i,j,k) = 0.0;
Averages.Press(i,j,k) = 0.0;
Averages.Vel_x(i,j,k) = 0.0;
Averages.Vel_y(i,j,k) = 0.0;
Averages.Vel_z(i,j,k) = 0.0;
if (Averages.SDs(i,j,k) > 0.0){
if (Averages.Phase(i,j,k) > 0.0){
Dm.id[n] = 2;
}
else{
Dm.id[n] = 1;
}
}
else{
Dm.id[n] = 0;
}
}
}
}
// Create the MeshDataStruct
fillHalo<double> fillData(Dm.Comm,Dm.rank_info,Nx-2,Ny-2,Nz-2,1,1,1,0,1);
std::vector<IO::MeshDataStruct> meshData(1);
meshData[0].meshName = "domain";
meshData[0].mesh = std::shared_ptr<IO::DomainMesh>( new IO::DomainMesh(Dm.rank_info,Nx-2,Ny-2,Nz-2,Lx,Ly,Lz) );
std::shared_ptr<IO::Variable> PhaseVar( new IO::Variable() );
std::shared_ptr<IO::Variable> SolidVar( new IO::Variable() );
std::shared_ptr<IO::Variable> BlobIDVar( new IO::Variable() );
PhaseVar->name = "Fluid";
PhaseVar->type = IO::VolumeVariable;
PhaseVar->dim = 1;
PhaseVar->data.resize(Nx-2,Ny-2,Nz-2);
meshData[0].vars.push_back(PhaseVar);
SolidVar->name = "Solid";
SolidVar->type = IO::VolumeVariable;
SolidVar->dim = 1;
SolidVar->data.resize(Nx-2,Ny-2,Nz-2);
meshData[0].vars.push_back(SignDistVar);
BlobIDVar->name = "BlobID";
BlobIDVar->type = IO::VolumeVariable;
BlobIDVar->dim = 1;
BlobIDVar->data.resize(Nx-2,Ny-2,Nz-2);
meshData[0].vars.push_back(BlobIDVar);
fillData.copy(Averages.SDn,PhaseVar->data);
fillData.copy(Averages.SDs,SolidVar->data);
fillData.copy(Averages.Label_NWP,BlobIDVar->data);
IO::writeData( 0, meshData, 2, comm );
// sprintf(LocalRankFilename,"Phase.%05i",rank);
// FILE *PHASE = fopen(LocalRankFilename,"wb");
// fwrite(Averages.Phase.get(),8,Averages.Phase.length(),PHASE);
// fclose(PHASE);
double beta = 0.95;
if (rank==0) printf("initializing the system \n");
Averages.UpdateSolid();
Averages.UpdateMeshValues();
Dm.CommunicateMeshHalo(Averages.Phase);
Dm.CommunicateMeshHalo(Averages.SDn);
Dm.CommunicateMeshHalo(Averages.SDs);
int timestep=5;
Averages.Initialize();
if (rank==0) printf("computing phase components \n");
Averages.ComponentAverages();
if (rank==0) printf("sorting phase components \n");
Averages.SortBlobs();
Averages.PrintComponents(timestep);
*/
}
MPI_Barrier(comm);
MPI_Finalize();