// CPU Functions for D3Q7 Lattice Boltzmann Methods extern "C" void ScaLBL_Scalar_Pack(int *list, int count, double *sendbuf, double *Data, int N){ //.................................................................................... // Pack distribution q into the send buffer for the listed lattice sites // dist may be even or odd distributions stored by stream layout //.................................................................................... int idx,n; for (idx=0; idx 0){ value = Den[n]; f_even[n] = 0.3333333333333333*value; f_odd[n] = 0.1111111111111111*value; //double(100*n)+1.f; f_even[N+n] = 0.1111111111111111*value; //double(100*n)+2.f; f_odd[N+n] = 0.1111111111111111*value; //double(100*n)+3.f; f_even[2*N+n] = 0.1111111111111111*value; //double(100*n)+4.f; f_odd[2*N+n] = 0.1111111111111111*value; //double(100*n)+5.f; f_even[3*N+n] = 0.1111111111111111*value; //double(100*n)+6.f; } else{ for(int q=0; q<3; q++){ f_even[q*N+n] = -1.0; f_odd[q*N+n] = -1.0; } f_even[3*N+n] = -1.0; } } } //************************************************************************* extern "C" void ScaLBL_D3Q7_Swap(char *ID, double *disteven, double *distodd, int Nx, int Ny, int Nz) { int i,j,k,n,nn,N; // distributions double f1,f2,f3,f4,f5,f6; N = Nx*Ny*Nz; for (n=0; n 0){ //........................................................................ // Retrieve even distributions from the local node (swap convention) // f0 = disteven[n]; // Does not particupate in streaming f1 = distodd[n]; f3 = distodd[N+n]; f5 = distodd[2*N+n]; //........................................................................ //........................................................................ // Retrieve odd distributions from neighboring nodes (swap convention) //........................................................................ nn = n+1; // neighbor index (pull convention) if (!(i+1 0 ){ // Read the distributions f0 = disteven[n]; f2 = disteven[N+n]; f4 = disteven[2*N+n]; f6 = disteven[3*N+n]; f1 = distodd[n]; f3 = distodd[N+n]; f5 = distodd[2*N+n]; // Compute the density Den[n] = f0+f1+f2+f3+f4+f5+f6; } } }