Cleaning up Color/D3Q7 .cu/.cpp
This commit is contained in:
parent
2822c8e2b3
commit
ade1e8fb69
@ -978,7 +978,7 @@ extern "C" void ColorCollideOpt( char *ID, double *disteven, double *distodd, do
|
||||
// PERFORM RELAXATION PROCESS
|
||||
//........................................................................
|
||||
//..........Toelke, Fruediger et. al. 2006...............
|
||||
if (C == 0.0) nx = ny = nz = 1.0;
|
||||
if (C == 0.0) nx = ny = nz = 0.0;
|
||||
m1 = m1 + rlx_setA*((19*(jx*jx+jy*jy+jz*jz)/rho - 11*rho) -alpha*C - m1);
|
||||
m2 = m2 + rlx_setA*((3*rho - 5.5*(jx*jx+jy*jy+jz*jz)/rho)- m2);
|
||||
m4 = m4 + rlx_setB*((-0.6666666666666666*jx)- m4);
|
||||
|
@ -111,7 +111,7 @@ extern "C" void SwapD3Q7(char *ID, double *disteven, double *distodd, int Nx, in
|
||||
if (!(i+1<Nx)) nn -= Nx; // periodic BC along the x-boundary
|
||||
//if (i+1<Nx){
|
||||
f2 = disteven[N+nn]; // pull neighbor for distribution 2
|
||||
if (!(f2 < 0)){
|
||||
if (!(f2 < 0.0)){
|
||||
distodd[n] = f2;
|
||||
disteven[N+nn] = f1;
|
||||
}
|
||||
@ -121,7 +121,7 @@ extern "C" void SwapD3Q7(char *ID, double *disteven, double *distodd, int Nx, in
|
||||
if (!(j+1<Ny)) nn -= Nx*Ny; // Perioidic BC along the y-boundary
|
||||
//if (j+1<Ny){
|
||||
f4 = disteven[2*N+nn]; // pull neighbor for distribution 4
|
||||
if (!(f4 < 0)){
|
||||
if (!(f4 < 0.0)){
|
||||
distodd[N+n] = f4;
|
||||
disteven[2*N+nn] = f3;
|
||||
// }
|
||||
@ -131,7 +131,7 @@ extern "C" void SwapD3Q7(char *ID, double *disteven, double *distodd, int Nx, in
|
||||
if (!(k+1<Nz)) nn -= Nx*Ny*Nz; // Perioidic BC along the z-boundary
|
||||
//if (k+1<Nz){
|
||||
f6 = disteven[3*N+nn]; // pull neighbor for distribution 6
|
||||
if (!(f6 < 0)){
|
||||
if (!(f6 < 0.0)){
|
||||
distodd[2*N+n] = f6;
|
||||
disteven[3*N+nn] = f5;
|
||||
// }
|
||||
|
@ -965,7 +965,7 @@ __global__ void dvc_ColorCollideOpt( char *ID, double *disteven, double *distod
|
||||
// PERFORM RELAXATION PROCESS
|
||||
//........................................................................
|
||||
//..........Toelke, Fruediger et. al. 2006...............
|
||||
if (C == 0.0) nx = ny = nz = 1.0;
|
||||
if (C == 0.0) nx = ny = nz = 0.0;
|
||||
m1 = m1 + rlx_setA*((19*(jx*jx+jy*jy+jz*jz)/rho - 11*rho) -alpha*C - m1);
|
||||
m2 = m2 + rlx_setA*((3*rho - 5.5*(jx*jx+jy*jy+jz*jz)/rho)- m2);
|
||||
m4 = m4 + rlx_setB*((-0.6666666666666666*jx)- m4);
|
||||
@ -1079,10 +1079,9 @@ __global__ void dvc_ColorCollideOpt( char *ID, double *disteven, double *distod
|
||||
distodd[7*N+n] = f15;
|
||||
distodd[8*N+n] = f17;
|
||||
//...Store the Velocity..........................
|
||||
if (!(rho>0.0)){ jx=jy=jz=0.0; rho=1.0;}
|
||||
Velocity[n] = jx/rho;
|
||||
Velocity[N+n] = jy/rho;
|
||||
Velocity[2*N+n] = jz/rho;
|
||||
Velocity[n] = jx;
|
||||
Velocity[N+n] = jy;
|
||||
Velocity[2*N+n] = jz;
|
||||
//***************************************************************
|
||||
|
||||
}// check if n is in the solid
|
||||
|
@ -64,14 +64,14 @@ __global__ void dvc_InitD3Q7(char *ID, double *f_even, double *f_odd, double *De
|
||||
int n,N;
|
||||
N = Nx*Ny*Nz;
|
||||
double value;
|
||||
|
||||
char id;
|
||||
int S = N/NBLOCKS/NTHREADS + 1;
|
||||
for (int s=0; s<S; s++){
|
||||
//........Get 1-D index for this thread....................
|
||||
n = S*blockIdx.x*blockDim.x + s*blockDim.x + threadIdx.x;
|
||||
if (n<N){
|
||||
|
||||
if (ID[n] != 0){
|
||||
id = ID[n]
|
||||
if (id > 0){
|
||||
value = Den[n];
|
||||
f_even[n] = 0.3333333333333333*value;
|
||||
f_odd[n] = 0.1111111111111111*value; //double(100*n)+1.f;
|
||||
|
Loading…
Reference in New Issue
Block a user