33 void fillM_u(
int *MRows,
int *MCols,
real *MVals,
int *MinvRows,
int *MinvCols,
real *MinvVals,
int nx,
int ny,
real *dx,
real *dy,
real dt)
35 int I = threadIdx.x + blockIdx.x*blockDim.x;
37 if(I >= (nx-1)*ny)
return;
41 real value = 0.5*(dx[i]+dx[i+1])/dy[j]/dt;
49 MinvVals[I] = 1.0/value;
69 void fillM_v(
int *MRows,
int *MCols,
real *MVals,
int *MinvRows,
int *MinvCols,
real *MinvVals,
int nx,
int ny,
real *dx,
real *dy,
real dt)
71 int I = threadIdx.x + blockIdx.x*blockDim.x;
73 if(I >= nx*(ny-1))
return;
78 real value = 0.5*(dy[j]+dy[j+1])/dx[i]/dt;
80 MRows[I+numU] = I+numU;
81 MCols[I+numU] = I+numU;
82 MVals[I+numU] = value;
84 MinvRows[I+numU] = I+numU;
85 MinvCols[I+numU] = I+numU;
86 MinvVals[I+numU] = 1.0/value;
__global__ void fillM_v(int *MRows, int *MCols, real *MVals, int *MinvRows, int *MinvCols, real *MinvVals, int nx, int ny, real *dx, real *dy, real dt)
Computes an element of the mass matrix and its inverse for a y-velocity node.
double real
Is a float or a double depending on the machine precision.
Contains all the custom-written CUDA kernels.
__global__ void fillM_u(int *MRows, int *MCols, real *MVals, int *MinvRows, int *MinvCols, real *MinvVals, int nx, int ny, real *dx, real *dy, real dt)
Computes an element of the mass matrix and its inverse for a x-velocity node.
Declaration of the kernels to generate the mass matrix and its inverse.