7 #include <cusp/io/matrix_market.h> 8 #include <cusp/blas/blas.h> 17 template <
typename memoryType>
28 template <
typename memoryType>
34 const int N_u = (nx-1)*ny;
39 cusp::coo_matrix<int, real, host_memory> QTHost(nx*ny, (nx-1)*ny+nx*(ny-1), 4*nx*ny-2*(nx+ny));
40 cusp::blas::fill(QTHost.row_indices, -1);
41 cusp::blas::fill(QTHost.column_indices, -1);
42 cusp::blas::fill(QTHost.values, 0.0);
45 for(
int j=0; j<ny; j++)
47 for(
int i=0; i<nx; i++)
52 int I = j*(nx-1)+(i-1);
55 QTHost.row_indices[idx] = row;
56 QTHost.column_indices[idx] = I;
57 QTHost.values[idx] = 1.0;
64 start = (idx>4)? idx-4 : 0;
65 for(
int l=start; l<idx && !flag; l++)
75 QTHost.row_indices[idx] = row;
87 QTHost.row_indices[idx] = row;
88 QTHost.column_indices[idx] = I;
89 QTHost.values[idx] = -1.0;
96 start = (idx>4)? idx-4 : 0;
97 for(
int l=start; l<idx && !flag; l++)
107 QTHost.row_indices[idx] = row;
116 int I = (j-1)*nx+i+N_u;
119 QTHost.row_indices[idx] = row;
120 QTHost.column_indices[idx] = I;
121 QTHost.values[idx] = 1.0;
128 start = (idx>4)? idx-4 : 0;
129 for(
int l=start; l<idx && !flag; l++)
139 QTHost.row_indices[idx] = row;
151 QTHost.row_indices[idx] = row;
152 QTHost.column_indices[idx] = I;
153 QTHost.values[idx] = -1.0;
160 start = (idx>4)? idx-4 : 0;
161 for(
int l=start; l<idx && !flag; l++)
171 QTHost.row_indices[idx] = row;
Second-order fully-discrete direct forcing method.
A fully discrete formulation of the direct forcing method.
std::map< std::string, componentParameter > parameterDB
Map from a string to a componentParameter.
Stores information about the computational grid.
virtual void generateQT()
Compute the modified divergence operator.
Definition of the class DFImprovedSolver.
DFImprovedSolver(parameterDB *pDB=NULL, domain *dInfo=NULL)
Constructor – get simulation parameters and grid.
Solves the Navier-Stokes equations in a rectangular domain.
Declaration of the kernels to generate gradient matrix and interpolation matrix.
virtual void generateQT()