cuIBM
A GPU-based Immersed Boundary Method code
generateRN.inl
Go to the documentation of this file.
1 
9 
10 #define BSZ 16
11 
12 
18 template <typename memoryType>
20 {
21 }
22 
23 
29 template <>
31 {
32  real gamma = intgSchm.gamma[subStep],
33  zeta = intgSchm.zeta[subStep],
34  alpha = intgSchm.alphaExplicit[subStep],
35  nu = (*paramDB)["flow"]["nu"].get<real>();
36  // if first time-step: use Euler explicit for convective terms
37  if (timeStep == (*paramDB)["simulation"]["startStep"].get<int>())
38  {
39  gamma = 1.0;
40  zeta = 0.0;
41  }
42 
43  // raw pointers for cup arrays
44  real *H_r = thrust::raw_pointer_cast(&H[0]),
45  *q_r = thrust::raw_pointer_cast(&q[0]),
46  *rn_r = thrust::raw_pointer_cast(&rn[0]),
47  *dxD = thrust::raw_pointer_cast(&(domInfo->dxD[0])),
48  *dyD = thrust::raw_pointer_cast(&(domInfo->dyD[0]));
49 
50  real *xminus = thrust::raw_pointer_cast(&(bc[XMINUS][0])),
51  *xplus = thrust::raw_pointer_cast(&(bc[XPLUS][0])),
52  *yminus = thrust::raw_pointer_cast(&(bc[YMINUS][0])),
53  *yplus = thrust::raw_pointer_cast(&(bc[YPLUS][0]));
54 
55  int nx = domInfo->nx,
56  ny = domInfo->ny;
57 
58  real dt = (*paramDB)["simulation"]["dt"].get<real>();
59 
60  //const int blockEdge = 16;
61 
62  dim3 dimGridx( int( (nx-1-0.5)/(BSZ-2) ) + 1, int( (ny-0.5)/(BSZ-2) ) + 1 ),
63  dimGridy( int( (nx-0.5)/(BSZ-2) ) + 1, int( (ny-1-0.5)/(BSZ-2) ) + 1 );
64  dim3 dimBlock(BSZ, BSZ);
65 
66  // call the kernel
67 
68  // convection terms for the interior points
69  kernels::convectionTermU <<<dimGridx, dimBlock>>> (rn_r, H_r, q_r, nx, ny, dxD, dyD, dt, gamma, zeta, alpha, nu);
70  kernels::convectionTermV <<<dimGridy, dimBlock>>> (rn_r, H_r, q_r, nx, ny, dxD, dyD, dt, gamma, zeta, alpha, nu);
71 
72  dim3 dimGridbc(int((nx+ny-0.5)/(BSZ*BSZ))+1, 1);
73  dim3 dimBlockbc(BSZ*BSZ, 1);
74 
75  // calculate convection terms for the rows adjoining the top and bottom boundaries
76  kernels::convectionTermUBottomTop <<<dimGridbc, dimBlockbc>>> (rn_r, H_r, q_r, nx, ny, dxD, dyD, dt, gamma, zeta, alpha, nu, yminus, yplus, xminus, xplus);
77  kernels::convectionTermVBottomTop <<<dimGridbc, dimBlockbc>>> (rn_r, H_r, q_r, nx, ny, dxD, dyD, dt, gamma, zeta, alpha, nu, yminus, yplus);
78 
79  // calculate convection terms for the columns adjoining the left and right boundaries
80  kernels::convectionTermULeftRight <<<dimGridbc, dimBlockbc>>> (rn_r, H_r, q_r, nx, ny, dxD, dyD, dt, gamma, zeta, alpha, nu, xminus, xplus);
81  kernels::convectionTermVLeftRight <<<dimGridbc, dimBlockbc>>> (rn_r, H_r, q_r, nx, ny, dxD, dyD, dt, gamma, zeta, alpha, nu, yminus, yplus, xminus, xplus);
82 } // calculateExplicitQTerms
83 
84 
88 template <typename memoryType>
90 {
91  logger.startTimer("generateRN");
92 
93  calculateExplicitQTerms();
94  calculateExplicitLambdaTerms();
95 
96  logger.stopTimer("generateRN");
97 } // generateRN
Declaration of the kernels to generate the explicit terms of the momentum equation.
double real
Is a float or a double depending on the machine precision.
Definition: types.h:116
virtual void calculateExplicitLambdaTerms()
Doing nothing. Used in methods that use the explicit pressure term in the intermediate velocity solve...
Definition: generateRN.inl:19
void calculateExplicitQTerms()
right boundary
Definition: types.h:50
bottom boundary
Definition: types.h:51
void generateRN()
Generates explicit terms of the momentum equation.
Definition: generateRN.inl:89
left boundary
Definition: types.h:49
top boundary
Definition: types.h:52
#define BSZ
Definition: generateRN.inl:10