Neko  0.8.99
A portable framework for high-order spectral element flow simulations
vel_res_update_kernel.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2022, The Neko Authors
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions
7  are met:
8 
9  * Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11 
12  * Redistributions in binary form must reproduce the above
13  copyright notice, this list of conditions and the following
14  disclaimer in the documentation and/or other materials provided
15  with the distribution.
16 
17  * Neither the name of the authors nor the names of its
18  contributors may be used to endorse or promote products derived
19  from this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  POSSIBILITY OF SUCH DAMAGE.
33 */
34 
35 #ifndef __FLUID_VEL_RES_UPDATE_KERNEL__
36 #define __FLUID_VEL_RES_UPDATE_KERNEL__
37 
38 template< typename T >
39 __global__ void vel_res_update_kernel(T * __restrict__ u_res,
40  T * __restrict__ v_res,
41  T * __restrict__ w_res,
42  const T * __restrict__ ta1,
43  const T * __restrict__ ta2,
44  const T * __restrict__ ta3,
45  const T * __restrict__ f_u,
46  const T * __restrict__ f_v,
47  const T * __restrict__ f_w,
48  const int n) {
49 
50  const int idx = blockIdx.x * blockDim.x + threadIdx.x;
51  const int str = blockDim.x * gridDim.x;
52 
53  for (int i = idx; i < n; i += str) {
54  u_res[i] = (-u_res[i]) - ta1[i] + f_u[i];
55  v_res[i] = (-v_res[i]) - ta2[i] + f_v[i];
56  w_res[i] = (-w_res[i]) - ta3[i] + f_w[i];
57  }
58 
59 }
60 
61 #endif // __FLUID_VEL_RES_UPDATE_KERNEL__
const int i
__global__ void vel_res_update_kernel(T *__restrict__ u_res, T *__restrict__ v_res, T *__restrict__ w_res, const T *__restrict__ ta1, const T *__restrict__ ta2, const T *__restrict__ ta3, const T *__restrict__ f_u, const T *__restrict__ f_v, const T *__restrict__ f_w, const int n)