Neko 0.9.99
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
dynamic_smagorinsky_nut.cu
Go to the documentation of this file.
1/*
2 Copyright (c) 2024, 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#include <string.h>
36#include <stdlib.h>
37#include <stdio.h>
39#include <device/cuda/check.h>
41
42extern "C" {
43 #include <common/neko_log.h>
44}
45
46extern "C" {
47 void cuda_s_abs_compute(void *s_abs, void *s11, void *s22, void *s33,
48 void *s12, void *s13, void *s23,
49 void *mult, int * n){
50
51 const dim3 nthrds(1024, 1, 1);
52 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
53 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
54
56 <<<nblcks, nthrds, 0, stream>>>((real *) s_abs,
57 (real *) s11, (real *) s22, (real *) s33,
58 (real *) s12, (real *) s13, (real *) s23,
59 (real *) mult, * n);
61 }
62
63 void cuda_lij_compute_part1(void *l11, void *l22, void *l33,
64 void *l12, void *l13, void *l23,
65 void *u, void *v, void *w,
66 void *fu, void *fv, void *fw,
67 void *fuu, void *fvv, void *fww,
68 void *fuv, void *fuw, void *fvw,
69 int * n){
70
71 const dim3 nthrds(1024, 1, 1);
72 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
73 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
74
76 <<<nblcks, nthrds, 0, stream>>>((real *) l11, (real *) l22, (real *) l33,
77 (real *) l12, (real *) l13, (real *) l23,
78 (real *) u, (real *) v, (real *) w,
79 (real *) fu, (real *) fv, (real *) fw,
80 (real *) fuu, (real *) fvv, (real *) fww,
81 (real *) fuv, (real *) fuw, (real *) fvw,
82 * n);
84 }
85
86 void cuda_lij_compute_part2(void *l11, void *l22, void *l33,
87 void *l12, void *l13, void *l23,
88 void *fuu, void *fvv, void *fww,
89 void *fuv, void *fuw, void *fvw,
90 int * n){
91
92 const dim3 nthrds(1024, 1, 1);
93 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
94 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
95
97 <<<nblcks, nthrds, 0, stream>>>((real *) l11, (real *) l22, (real *) l33,
98 (real *) l12, (real *) l13, (real *) l23,
99 (real *) fuu, (real *) fvv, (real *) fww,
100 (real *) fuv, (real *) fuw, (real *) fvw,
101 * n);
103 }
104
105 void cuda_mij_compute_part1(void *m11, void *m22, void *m33,
106 void *m12, void *m13, void *m23,
107 void *s_abs, void *s11, void *s22, void *s33,
108 void *s12, void *s13, void *s23,
109 void *fs_abs, void *fs11, void *fs22, void *fs33,
110 void *fs12, void *fs13, void *fs23,
111 void *fsabss11, void *fsabss22, void *fsabss33,
112 void *fsabss12, void *fsabss13, void *fsabss23,
113 real * delta_ratio2, int * n){
114
115 const dim3 nthrds(1024, 1, 1);
116 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
117 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
118
120 <<<nblcks, nthrds, 0, stream>>>((real *) m11, (real *) m22, (real *) m33,
121 (real *) m12, (real *) m13, (real *) m23,
122 (real *) s_abs, (real *) s11, (real *) s22,
123 (real *) s33, (real *) s12, (real *) s13, (real *) s23,
124 (real *) fs_abs, (real *) fs11, (real *) fs22,
125 (real *) fs33, (real *) fs12, (real *) fs13, (real *) fs23,
126 (real *) fsabss11, (real *) fsabss22, (real *) fsabss33,
127 (real *) fsabss12, (real *) fsabss13, (real *) fsabss23,
128 * delta_ratio2, * n);
130 }
131
132 void cuda_mij_nut_compute_part2(void *m11, void *m22, void *m33,
133 void *m12, void *m13, void *m23,
134 void *l11, void *l22, void *l33,
135 void *l12, void *l13, void *l23,
136 void *fsabss11, void *fsabss22, void *fsabss33,
137 void *fsabss12, void *fsabss13, void *fsabss23,
138 void *num, void *den, void *c_dyn, void *delta,
139 void *s_abs, void *nut,
140 real * alpha, int * n){
141
142 const dim3 nthrds(1024, 1, 1);
143 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
144 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
145
147 <<<nblcks, nthrds, 0, stream>>>((real *) m11, (real *) m22, (real *) m33,
148 (real *) m12, (real *) m13, (real *) m23,
149 (real *) l11, (real *) l22, (real *) l33,
150 (real *) l12, (real *) l13, (real *) l23,
151 (real *) fsabss11, (real *) fsabss22, (real *) fsabss33,
152 (real *) fsabss12, (real *) fsabss13, (real *) fsabss23,
153 (real *) num, (real *) den, (real *) c_dyn,
154 (real *) delta, (real *) s_abs, (real *) nut,
155 * alpha, * n);
157 }
158}
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ w
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ u
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ v
#define CUDA_CHECK(err)
Definition check.h:6
__global__ void dirichlet_apply_scalar_kernel(const int *__restrict__ msk, T *__restrict__ x, const T g, const int m)
double real
void cuda_mij_compute_part1(void *m11, void *m22, void *m33, void *m12, void *m13, void *m23, void *s_abs, void *s11, void *s22, void *s33, void *s12, void *s13, void *s23, void *fs_abs, void *fs11, void *fs22, void *fs33, void *fs12, void *fs13, void *fs23, void *fsabss11, void *fsabss22, void *fsabss33, void *fsabss12, void *fsabss13, void *fsabss23, real *delta_ratio2, int *n)
void cuda_s_abs_compute(void *s_abs, void *s11, void *s22, void *s33, void *s12, void *s13, void *s23, void *mult, int *n)
void cuda_lij_compute_part1(void *l11, void *l22, void *l33, void *l12, void *l13, void *l23, void *u, void *v, void *w, void *fu, void *fv, void *fw, void *fuu, void *fvv, void *fww, void *fuv, void *fuw, void *fvw, int *n)
void cuda_mij_nut_compute_part2(void *m11, void *m22, void *m33, void *m12, void *m13, void *m23, void *l11, void *l22, void *l33, void *l12, void *l13, void *l23, void *fsabss11, void *fsabss22, void *fsabss33, void *fsabss12, void *fsabss13, void *fsabss23, void *num, void *den, void *c_dyn, void *delta, void *s_abs, void *nut, real *alpha, int *n)
void cuda_lij_compute_part2(void *l11, void *l22, void *l33, void *l12, void *l13, void *l23, void *fuu, void *fvv, void *fww, void *fuv, void *fuw, void *fvw, int *n)