Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
cai_sagaut_model_ii_device.F90
Go to the documentation of this file.
1! Copyright (c) 2026, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
35 use num_types, only : rp, c_rp
36 use, intrinsic :: iso_c_binding, only : c_ptr
37 use utils, only : neko_error
38 implicit none
39 private
40
41#ifdef HAVE_HIP
42 interface
43 subroutine hip_cai_sagaut_model_ii_compute(u_d, v_d, w_d, n_x_d, &
44 n_y_d, n_z_d, nu_d, rho_w_d, h_d, tau_x_d, tau_y_d, tau_z_d, &
45 n_nodes, kappa, B, p, s) &
46 bind(c, name = 'hip_cai_sagaut_model_ii_compute')
47 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
48 use num_types, only : c_rp
49 implicit none
50 type(c_ptr), value :: u_d, v_d, w_d, rho_w_d
51 type(c_ptr), value :: n_x_d, n_y_d, n_z_d, h_d, nu_d
52 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d
53 real(c_rp) :: kappa, B, p, s
54 integer(c_int) :: n_nodes
56 end interface
57#elif HAVE_CUDA
58 interface
59 subroutine cuda_cai_sagaut_model_ii_compute(u_d, v_d, w_d, n_x_d, &
60 n_y_d, n_z_d, nu_d, rho_w_d, h_d, tau_x_d, tau_y_d, tau_z_d, &
61 n_nodes, kappa, B, p, s) &
62 bind(c, name = 'cuda_cai_sagaut_model_ii_compute')
63 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
64 use num_types, only : c_rp
65 implicit none
66 type(c_ptr), value :: u_d, v_d, w_d, rho_w_d
67 type(c_ptr), value :: n_x_d, n_y_d, n_z_d, h_d, nu_d
68 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d
69 real(c_rp) :: kappa, B, p, s
70 integer(c_int) :: n_nodes
72 end interface
73#elif HAVE_OPENCL
74 interface
75 subroutine opencl_cai_sagaut_model_ii_compute(u_d, v_d, w_d, n_x_d, &
76 n_y_d, n_z_d, nu_d, rho_w_d, h_d, tau_x_d, tau_y_d, tau_z_d, &
77 n_nodes, kappa, B, p, s) &
78 bind(c, name = 'opencl_cai_sagaut_model_ii_compute')
79 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
80 use num_types, only : c_rp
81 implicit none
82 type(c_ptr), value :: u_d, v_d, w_d, rho_w_d
83 type(c_ptr), value :: n_x_d, n_y_d, n_z_d, h_d, nu_d
84 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d
85 real(c_rp) :: kappa, B, p, s
86 integer(c_int) :: n_nodes
88 end interface
89#elif HAVE_METAL
90 interface
91 subroutine metal_cai_sagaut_model_ii_compute(u_d, v_d, w_d, n_x_d, &
92 n_y_d, n_z_d, nu_d, rho_w_d, h_d, tau_x_d, tau_y_d, tau_z_d, &
93 n_nodes, kappa, B, p, s) &
94 bind(c, name = 'metal_cai_sagaut_model_ii_compute')
95 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
96 use num_types, only : c_rp
97 implicit none
98 type(c_ptr), value :: u_d, v_d, w_d, rho_w_d
99 type(c_ptr), value :: n_x_d, n_y_d, n_z_d, h_d, nu_d
100 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d
101 real(c_rp) :: kappa, B, p, s
102 integer(c_int) :: n_nodes
103 end subroutine metal_cai_sagaut_model_ii_compute
104 end interface
105#endif
107
108contains
131 subroutine cai_sagaut_model_ii_compute_device(u_d, v_d, w_d, n_x_d, &
132 n_y_d, n_z_d, nu_d, rho_w_d, h_d, tau_x_d, tau_y_d, tau_z_d, &
133 n_nodes, kappa, B, p, s)
134 integer, intent(in) :: n_nodes
135 type(c_ptr), intent(in) :: u_d, v_d, w_d, rho_w_d
136 type(c_ptr), intent(in) :: n_x_d, n_y_d, n_z_d, h_d, nu_d
137 type(c_ptr), intent(inout) :: tau_x_d, tau_y_d, tau_z_d
138 real(kind=rp), intent(in) :: kappa, b, p, s
139
140#if HAVE_HIP
141 call hip_cai_sagaut_model_ii_compute(u_d, v_d, w_d, n_x_d, n_y_d, &
142 n_z_d, nu_d, rho_w_d, h_d, tau_x_d, tau_y_d, tau_z_d, n_nodes, &
143 kappa, b, p, s)
144#elif HAVE_CUDA
145 call cuda_cai_sagaut_model_ii_compute(u_d, v_d, w_d, n_x_d, n_y_d, &
146 n_z_d, nu_d, rho_w_d, h_d, tau_x_d, tau_y_d, tau_z_d, n_nodes, &
147 kappa, b, p, s)
148#elif HAVE_OPENCL
149 call opencl_cai_sagaut_model_ii_compute(u_d, v_d, w_d, n_x_d, n_y_d, &
150 n_z_d, nu_d, rho_w_d, h_d, tau_x_d, tau_y_d, tau_z_d, n_nodes, &
151 kappa, b, p, s)
152#elif HAVE_METAL
153 call metal_cai_sagaut_model_ii_compute(u_d, v_d, w_d, n_x_d, n_y_d, &
154 n_z_d, nu_d, rho_w_d, h_d, tau_x_d, tau_y_d, tau_z_d, n_nodes, &
155 kappa, b, p, s)
156#else
157 call neko_error('No device backend configured')
158#endif
void opencl_cai_sagaut_model_ii_compute(void *u_d, void *v_d, void *w_d, void *n_x_d, void *n_y_d, void *n_z_d, void *nu_d, void *rho_w_d, void *h_d, void *tau_x_d, void *tau_y_d, void *tau_z_d, int *n_nodes, real *kappa, real *B, real *p, real *s)
void cuda_cai_sagaut_model_ii_compute(void *u_d, void *v_d, void *w_d, void *n_x_d, void *n_y_d, void *n_z_d, void *nu_d, void *rho_w_d, void *h_d, void *tau_x_d, void *tau_y_d, void *tau_z_d, int *n_nodes, real *kappa, real *B, real *p, real *s)
Device dispatch for cai_sagaut_model_ii_t.
subroutine, public cai_sagaut_model_ii_compute_device(u_d, v_d, w_d, n_x_d, n_y_d, n_z_d, nu_d, rho_w_d, h_d, tau_x_d, tau_y_d, tau_z_d, n_nodes, kappa, b, p, s)
Evaluate the device wall-model kernel for Model-II.
integer, parameter, public c_rp
Definition num_types.f90:15
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:14
Utilities.
Definition utils.f90:35