42 int nx,
int ny,
int I,
int J,
int ncx,
int ncy)
44 int idx = threadIdx.x + blockIdx.x*blockDim.x;
47 int Ip = (J+idx)*nx + I,
48 Iu = (J+idx)*(nx-1) + (I-1);
51 (lambda[Ip+ncx]-lambda[Ip-1])*dy[J+idx]
55 0.25*(q[Iu+ncx+1] + q[Iu+ncx])*(q[Iu+ncx+1] + q[Iu+ncx])
56 - 0.25*(q[Iu] + q[Iu-1])*(q[Iu] + q[Iu-1])
62 (q[Iu+ncx+1] - q[Iu+ncx])/dx[I+ncx]
63 - (q[Iu] - q[Iu-1])/dx[I-1]
88 int nx,
int ny,
int I,
int J,
int ncx,
int ncy)
90 int idx = threadIdx.x + blockIdx.x*blockDim.x;
93 int Iu = J*(nx-1) + (I-1+idx),
94 Iv = (nx-1)*ny + (J-1)*nx + I+idx;
98 0.25 * ( q[Iu+ncy*(nx-1)]/dy[J+ncy] + q[Iu+(ncy-1)*(nx-1)]/dy[J+ncy-1] )
99 * ( q[Iv+ncy*nx]/dx[I+idx] + q[Iv+ncy*nx-1]/dx[I+idx-1] )
101 0.25 * ( q[Iu]/dy[J] + q[Iu-(nx-1)]/dy[J-1] )
102 * ( q[Iv]/dx[I+idx] + q[Iv-1]/dx[I+idx-1] )
109 (q[Iu+ncy*(nx-1)]/dy[J+ncy] - q[Iu+(ncy-1)*(nx-1)]/dy[J+ncy-1])/2.0/(dy[J+ncy]+dy[J+ncy-1]) +
110 (q[Iv+ncy*nx]/dx[I+idx] - q[Iv+ncy*nx-1]/dx[I+idx-1])/2.0/(dx[I+idx]+dx[I+idx-1])
114 (q[Iu]/dy[J] - q[Iu-(nx-1)]/dy[J-1])/2.0/(dy[J]+dy[J-1]) +
115 (q[Iv]/dx[I+idx] - q[Iv-1]/dx[I+idx-1])/2.0/(dx[I+idx]+dx[I+idx-1])
118 )*0.5*(dx[I+idx]+dx[I+idx-1]);
143 int nx,
int ny,
int I,
int J,
int ncx,
int ncy)
145 int idx = threadIdx.x + blockIdx.x*blockDim.x;
147 if(idx >= (ncx+1)*ncy)
153 int Iu = (J+j)*(nx-1) + (I-1+i);
155 FxU[idx] = - (q[Iu] - qOld[Iu])/dt * 0.5*(dx[I+i]+dx[I-1+i]);
178 int nx,
int ny,
int I,
int J,
int ncx,
int ncy)
180 int idx = threadIdx.x + blockIdx.x*blockDim.x;
183 int Iu = (J+idx)*(nx-1) + (I-1),
184 Iv = (nx-1)*ny + (J-1+idx)*nx + I;
188 0.25 * ( q[Iu+ncx]/dy[J+idx] + q[Iu+ncx-(nx-1)]/dy[J-1+idx] )
189 * ( q[Iv+ncx]/dx[I+ncx] + q[Iv+ncx-1]/dx[I+ncx-1] )
191 0.25 * ( q[Iu]/dy[J+idx] + q[Iu-(nx-1)]/dy[J-1+idx] )
192 * ( q[Iv]/dx[I] + q[Iv-1]/dx[I-1] )
199 (q[Iu+ncx]/dy[J+idx] - q[Iu+ncx-(nx-1)]/dy[J-1+idx])/2.0/(dy[J+idx]+dy[J-1+idx]) +
200 (q[Iv+ncx]/dx[I+ncx] - q[Iv+ncx-1]/dx[I+ncx-1])/2.0/(dx[I+ncx]+dx[I+ncx-1])
204 (q[Iu]/dy[J+idx] - q[Iu-(nx-1)]/dy[J-1+idx])/2.0/(dy[J+idx]+dy[J-1+idx]) +
205 (q[Iv]/dx[I] - q[Iv-1]/dx[I-1])/2.0/(dx[I]+dx[I-1])
208 )*0.5*(dy[J+idx]+dy[J-1+idx]);
232 int nx,
int ny,
int I,
int J,
int ncx,
int ncy)
234 int idx = threadIdx.x + blockIdx.x*blockDim.x;
237 int Ip = J*nx + I+idx,
238 Iv = (nx-1)*ny + (J-1)*nx + I+idx;
241 (lambda[Ip+ncy*nx]-lambda[Ip-nx])*dx[I+idx]
245 0.25*(q[Iv+(ncy+1)*nx] + q[Iv+ncy*nx])*(q[Iv+(ncy+1)*nx] + q[Iv+ncy*nx])
246 - 0.25*(q[Iv] + q[Iv-nx])*(q[Iv] + q[Iv-nx])
252 (q[Iv+(ncy+1)*nx] - q[Iv+ncy*nx])/dy[J+ncy]
253 - (q[Iv] - q[Iv-nx])/dy[J-1]
279 int nx,
int ny,
int I,
int J,
int ncx,
int ncy)
281 int idx = threadIdx.x + blockIdx.x*blockDim.x;
283 if( idx >= ncx*(ncy+1) )
289 int Iv = (J-1+j)*nx + (I+i) + (nx-1)*ny;
291 FyU[idx] = - (q[Iv] - qOld[Iv])/dt * 0.5*(dy[J+j]+dy[J-1+j]);
309 int I = (
BSZ-2)*bx + i,
312 if (I >= nx-1 || J >= ny) {
316 int Gidx_x = J*(nx-1) + I;
328 u[j][i] = q[Gidx_x]/Dy[j][i];
332 int global_check = ( I==0 || I==(nx-2) || J==0 || J==(ny-1) ),
333 block_check = ( i==0 || i==(
BSZ-1) || j==0 || j==(
BSZ-1) );
336 if( !(global_check || block_check) )
338 dTerm = alpha*nu*2.0*( \
339 ( Dx[j][i]*u[j][i+1] - (Dx[j][i]+Dx[j][i+1])*u[j][i] + Dx[j][i+1]*u[j][i-1] ) / ( Dx[j][i]*Dx[j][i+1]*(Dx[j][i]+Dx[j][i+1]) ) \
341 + 4.0*( (Dy[j][i]+Dy[j-1][i])*u[j+1][i] - (Dy[j-1][i] + 2.0*Dy[j][i] + Dy[j+1][i])*u[j][i] + (Dy[j][i]+Dy[j+1][i])*u[j-1][i] ) \
342 /( (Dy[j][i]+Dy[j-1][i]) * (Dy[j-1][i] + 2.0*Dy[j][i] + Dy[j+1][i]) * (Dy[j][i]+Dy[j+1][i]) ) \
345 f[Gidx_x] = ( u[j][i]/dt - dTerm - rn[Gidx_x]/(0.5*(Dx[j][i]+Dx[j][i+1])) ) * (!(tags[Gidx_x]==-1));
__global__ void liftBottomTop(real *FyY, real *q, real *lambda, real nu, real *dx, real *dy, int nx, int ny, int I, int J, int ncx, int ncy)
Calculate lift using a control-volume approach (bottom-top).
double real
Is a float or a double depending on the machine precision.
Declaration of the kernels to calculate the forces acting on a body The method is described in Lai & ...
Contains all the custom-written CUDA kernels.
__global__ void forceY()
Kernel not usable.
__global__ void liftUnsteady(real *FyU, real *q, real *qOld, real *dx, real *dy, real dt, int nx, int ny, int I, int J, int ncx, int ncy)
Calculate lift using a control-volume approach (unsteady).
__global__ void dragLeftRight(real *FxX, real *q, real *lambda, real nu, real *dx, real *dy, int nx, int ny, int I, int J, int ncx, int ncy)
Calculates drag using a control-volume approach (left-right).
__global__ void forceX(real *f, real *q, real *rn, int *tags, int nx, int ny, real *dx, real *dy, real dt, real alpha, real nu)
Kernel not usable.
__global__ void dragBottomTop(real *FxY, real *q, real nu, real *dx, real *dy, int nx, int ny, int I, int J, int ncx, int ncy)
Calculate drag using a control-volume approach (bottom-top).
__global__ void dragUnsteady(real *FxU, real *q, real *qOld, real *dx, real *dy, real dt, int nx, int ny, int I, int J, int ncx, int ncy)
Calculate drag using a control-volume approach (unsteady).
__global__ void liftLeftRight(real *FyX, real *q, real nu, real *dx, real *dy, int nx, int ny, int I, int J, int ncx, int ncy)
Calculate lift using a control-volume approach (left-right).