Debugging TestMassConservationD3Q7

This commit is contained in:
James E McClure 2015-06-24 20:02:16 -04:00
parent 55e5845da0
commit 357133fe29
2 changed files with 12 additions and 6 deletions

View File

@ -1169,9 +1169,9 @@ __global__ void dvc_MassColorCollideD3Q7(char *ID, double *A_even, double *A_od
b1 -= beta*delta; b1 -= beta*delta;
b2 += beta*delta; b2 += beta*delta;
} }
A_odd[n] = a1; A_odd[n] = a1;
A_even[N+n] = a2; A_even[N+n] = a2;
B_odd[n] = b1; B_odd[n] = b1;
B_even[N+n] = b2; B_even[N+n] = b2;
//............................................... //...............................................
// q = 2 // q = 2
@ -1187,9 +1187,9 @@ __global__ void dvc_MassColorCollideD3Q7(char *ID, double *A_even, double *A_od
b1 -= beta*delta; b1 -= beta*delta;
b2 += beta*delta; b2 += beta*delta;
} }
A_odd[N+n] = a1; A_odd[N+n] = a1;
A_even[2*N+n] = a2; A_even[2*N+n] = a2;
B_odd[N+n] = b1; B_odd[N+n] = b1;
B_even[2*N+n] = b2; B_even[2*N+n] = b2;
//............................................... //...............................................
// q = 4 // q = 4
@ -1377,15 +1377,19 @@ __global__ void dvc_ComputePhi(char *ID, double *Phi, double *Den, int N)
double Na,Nb; double Na,Nb;
//................................................................... //...................................................................
// Update Phi // Update Phi
char id;
int S = N/NBLOCKS/NTHREADS + 1; int S = N/NBLOCKS/NTHREADS + 1;
for (int s=0; s<S; s++){ for (int s=0; s<S; s++){
//........Get 1-D index for this thread.................... //........Get 1-D index for this thread....................
n = S*blockIdx.x*blockDim.x + s*blockDim.x + threadIdx.x; n = S*blockIdx.x*blockDim.x + s*blockDim.x + threadIdx.x;
if (n<N && ID[n] > 0){ if (n<N){
id=ID[n];
if (id != 0){
// Get the density value (Streaming already performed) // Get the density value (Streaming already performed)
Na = Den[n]; Na = Den[n];
Nb = Den[N+n]; Nb = Den[N+n];
Phi[n] = (Na-Nb)/(Na+Nb); Phi[n] = (Na-Nb)/(Na+Nb);
}
} }
} }
//................................................................... //...................................................................

View File

@ -168,8 +168,9 @@ __global__ void dvc_ComputeDensityD3Q7(char *ID, double *disteven, double *dist
for (int s=0; s<S; s++){ for (int s=0; s<S; s++){
//........Get 1-D index for this thread.................... //........Get 1-D index for this thread....................
n = S*blockIdx.x*blockDim.x + s*blockDim.x + threadIdx.x; n = S*blockIdx.x*blockDim.x + s*blockDim.x + threadIdx.x;
if (n<N){
id = ID[n]; id = ID[n];
if (n<N && id > 0 ){ if ( id != 0 ){
// Read the distributions // Read the distributions
f0 = disteven[n]; f0 = disteven[n];
f2 = disteven[N+n]; f2 = disteven[N+n];
@ -180,6 +181,7 @@ __global__ void dvc_ComputeDensityD3Q7(char *ID, double *disteven, double *dist
f5 = distodd[2*N+n]; f5 = distodd[2*N+n];
// Compute the density // Compute the density
Den[n] = f0+f1+f2+f3+f4+f5+f6; Den[n] = f0+f1+f2+f3+f4+f5+f6;
}
} }
} }
} }