Neko 1.99.6
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
compressible_ops_update.cu
Go to the documentation of this file.
1/*
2 Copyright (c) 2025, 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 <stdio.h>
36#include <stdlib.h>
37#include <cuda.h>
38#include <cuda_runtime.h>
39#include <cublas.h>
41#include <device/cuda/check.h>
43
44extern "C" {
45
46void cuda_update_uvw(void *u, void *v, void *w,
47 void *m_x, void *m_y, void *m_z,
48 void *rho, int *n) {
49
50 const dim3 nthrds(1024, 1, 1);
51 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
52 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
53
55 <<<nblcks, nthrds, 0, stream>>>((real *) u, (real *) v, (real *) w,
56 (real *) m_x, (real *) m_y, (real *) m_z,
57 (real *) rho, *n);
58
60
61}
62
63void cuda_update_mxyz_p_ruvw(void *m_x, void *m_y, void *m_z,
64 void *p, void *ruvw,
65 void *u, void *v, void *w, void *E,
66 void *rho, real *gamma, int *n) {
67
68 const dim3 nthrds(1024, 1, 1);
69 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
70 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
71
73 <<<nblcks, nthrds, 0, stream>>>((real *) m_x, (real *) m_y, (real *) m_z,
74 (real *) p, (real *) ruvw,
75 (real *) u, (real *) v, (real *) w,
76 (real *) E, (real *) rho, *gamma, *n);
77
79
80}
81
82void cuda_update_e(void *E, void *p, void *ruvw,
83 real *gamma, int *n) {
84
85 const dim3 nthrds(1024, 1, 1);
86 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
87 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
88
90 <<<nblcks, nthrds, 0, stream>>>((real *) E, (real *) p, (real *) ruvw,
91 *gamma, *n);
92
94
95}
96
97void cuda_update_temperature(void *T, void *p, void *rho,
98 real *gamma, int *n) {
99
100 const dim3 nthrds(1024, 1, 1);
101 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
102 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
103
105 <<<nblcks, nthrds, 0, stream>>>((real *) T, (real *) p, (real *) rho,
106 *gamma, *n);
107
109
110}
111
113 void *dudx, void *dudy, void *dudz,
114 void *dvdx, void *dvdy, void *dvdz,
115 void *dwdx, void *dwdy, void *dwdz,
116 void *mu, int *n) {
117
118 const dim3 nthrds(1024, 1, 1);
119 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
120 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
121
123 <<<nblcks, nthrds, 0, stream>>>((real *) div_flux,
124 (real *) dissipation, (real *) h1,
125 (real *) dudx, (real *) dudy,
126 (real *) dudz, (real *) dvdx,
127 (real *) dvdy, (real *) dvdz,
128 (real *) dwdx, (real *) dwdy,
129 (real *) dwdz, (real *) mu, *n);
130
132
133}
134
136 void *visc_E, void *f_x, void *f_y, void *f_z,
137 void *opgrad_x, void *opgrad_y, void *opgrad_z,
138 void *u, void *v, void *w, void *B,
139 void *dissipation, int *n) {
140
141 const dim3 nthrds(1024, 1, 1);
142 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
143 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
144
146 <<<nblcks, nthrds, 0, stream>>>((real *) visc_m_x,
147 (real *) visc_m_y,
148 (real *) visc_m_z, (real *) visc_E,
149 (real *) f_x, (real *) f_y,
150 (real *) f_z, (real *) opgrad_x,
151 (real *) opgrad_y, (real *) opgrad_z,
152 (real *) u, (real *) v, (real *) w,
153 (real *) B, (real *) dissipation, *n);
154
156
157}
158
159void cuda_ns_flux_temperature(void *div_flux, void *h1, void *p, void *rho,
160 void *kappa, real *gamma, int *n) {
161
162 const dim3 nthrds(1024, 1, 1);
163 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
164 const cudaStream_t stream = (cudaStream_t) glb_cmd_queue;
165
167 <<<nblcks, nthrds, 0, stream>>>((real *) div_flux, (real *) h1,
168 (real *) p, (real *) rho,
169 (real *) kappa, *gamma, *n);
170
172
173}
174
175}
void cuda_ns_flux_prepare(void *div_flux, void *dissipation, void *h1, void *dudx, void *dudy, void *dudz, void *dvdx, void *dvdy, void *dvdz, void *dwdx, void *dwdy, void *dwdz, void *mu, int *n)
void cuda_ns_flux_finalize(void *visc_m_x, void *visc_m_y, void *visc_m_z, void *visc_E, void *f_x, void *f_y, void *f_z, void *opgrad_x, void *opgrad_y, void *opgrad_z, void *u, void *v, void *w, void *B, void *dissipation, int *n)
void cuda_update_uvw(void *u, void *v, void *w, void *m_x, void *m_y, void *m_z, void *rho, int *n)
void cuda_update_temperature(void *T, void *p, void *rho, real *gamma, int *n)
void cuda_ns_flux_temperature(void *div_flux, void *h1, void *p, void *rho, void *kappa, real *gamma, int *n)
void cuda_update_mxyz_p_ruvw(void *m_x, void *m_y, void *m_z, void *p, void *ruvw, void *u, void *v, void *w, void *E, void *rho, real *gamma, int *n)
void cuda_update_e(void *E, void *p, void *ruvw, real *gamma, int *n)
__global__ void ale_add_kinematics_kernel(const int n, T *__restrict__ wx, T *__restrict__ wy, T *__restrict__ wz, const T *__restrict__ x_ref, const T *__restrict__ y_ref, const T *__restrict__ z_ref, const T *__restrict__ phi, const T *__restrict__ x, const T *__restrict__ y, const T *__restrict__ z, const kinematics_params_t kin_params)
__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
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ h1
#define CUDA_CHECK(err)
Definition check.h:6
double real