diff --git a/analysis/Membrane.cpp b/analysis/Membrane.cpp index 4d355b2a..4618380f 100644 --- a/analysis/Membrane.cpp +++ b/analysis/Membrane.cpp @@ -372,7 +372,7 @@ int Membrane::D3Q19_MapSendRecv(const int Cqx, const int Cqy, const int Cqz, // if (rank ==0) printf("@ Get 3D indices from the send process: i=%d, j=%d, k=%d\n",i,j,k); /* distance to membrane at the send site */ - locdist = Distance(i,j,k); + dist = Distance(i,j,k); // Streaming for the non-local distribution i += Cqx; j += Cqy; k += Cqz; @@ -415,7 +415,7 @@ int Membrane::D3Q19_MapSendRecv(const int Cqx, const int Cqy, const int Cqz, int Membrane::Create(std::shared_ptr Dm, DoubleArray &Distance, IntArray &Map){ int mlink = 0; - int i,j,k,n; + int i,j,k; int idx, neighbor; double dist, locdist; /* go through the neighborlist structure */ @@ -423,7 +423,6 @@ int Membrane::Create(std::shared_ptr Dm, DoubleArray &Distance, IntArra for (k=1;k Dm, DoubleArray &Distance, IntArra for (k=1;k loadInputs( int nprocs ) auto db = std::make_shared(); db->putScalar( "BC", 0 ); db->putVector( "nproc", { 1, 1, 1 } ); - db->putVector( "n", { 5, 5, 5 } ); + db->putVector( "n", { 32, 32, 32 } ); db->putScalar( "nspheres", 1 ); db->putVector( "L", { 1, 1, 1 } ); return db; @@ -42,7 +42,7 @@ int main(int argc, char **argv) int rank = comm.getRank(); if (rank == 0){ printf("********************************************************\n"); - printf("Running unit test: TestMap \n"); + printf("Running unit test: TestMembrane \n"); printf("********************************************************\n"); } @@ -66,7 +66,7 @@ int main(int argc, char **argv) for (i=0;iid[n] = 1; - radius = double(Nx)/6; + radius = double(Nx)/4; distance = sqrt(double((i-0.5*Nx)*(i-0.5*Nx)+ (j-0.5*Ny)*(j-0.5*Ny)+ (k-0.5*Nz)*(k-0.5*Nz)))-radius; if (distance < 0.0 ){ Dm->id[n] = 1; @@ -99,29 +99,64 @@ int main(int argc, char **argv) Np = ScaLBL_Comm->MemoryOptimizedLayoutAA(Map,neighborList,Dm->id.data(),Np,1); comm.barrier(); + double *dist; + dist = new double [19*Np]; + // Check the neighborlist printf("Check neighborlist: exterior %i, first interior %i last interior %i \n",ScaLBL_Comm->LastExterior(),ScaLBL_Comm->FirstInterior(),ScaLBL_Comm->LastInterior()); for (int idx=0; idxLastExterior(); idx++){ for (int q=0; q<18; q++){ int nn = neighborList[q*Np+idx]%Np; if (nn>Np) printf("neighborlist error (exterior) at q=%i, idx=%i \n",q,idx); - + dist[q*Np + idx] = 0.0; } } for (int idx=ScaLBL_Comm->FirstInterior(); idxLastInterior(); idx++){ for (int q=0; q<18; q++){ int nn = neighborList[q*Np+idx]%Np; if (nn>Np) printf("neighborlist error (exterior) at q=%i, idx=%i \n",q,idx); - + dist[q*Np + idx] = 0.0; } } + /* create a membrane data structure */ Membrane M(Dm, neighborList, Np); int MembraneCount = M.Create(Dm, Distance, Map); - - + if (rank==0) printf (" Number of membrane links: %i \n", MembraneCount); + + /* create a tagged array to show where the mebrane is*/ + double *MembraneLinks; + MembraneLinks = new double [Nx*Ny*Nz]; + for (int n=0; n 0.f){ + Dm->id[n] = 127; + } + } + } + } + if (argc > 1) + Dm->AggregateLabels("membrane.raw"); + //......................device distributions................................. int *NeighborList; int *dvcMap;