Neko 1.99.1
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
wall_model_device.F90
Go to the documentation of this file.
1! Copyright (c) 2025, 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_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
44 tau_field_d, msk_d, m) &
45 bind(c, name = 'hip_wall_model_compute_mag_field')
46 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
47 implicit none
48 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d, tau_field_d, msk_d
49 integer(c_int) :: m
51 end interface
52#elif HAVE_CUDA
53 interface
54 subroutine cuda_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
55 tau_field_d, msk_d, m) &
56 bind(c, name = 'cuda_wall_model_compute_mag_field')
57 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
58 implicit none
59 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d, tau_field_d, msk_d
60 integer(c_int) :: m
62 end interface
63#elif HAVE_OPENCL
64#endif
66
67contains
71 subroutine wall_model_compute_mag_field_device(tau_x_d, tau_y_d, tau_z_d, &
72 tau_field_d, msk_d, m)
73 type(c_ptr), intent(in) :: tau_x_d, tau_y_d, tau_z_d
74 type(c_ptr), intent(in) :: msk_d
75 type(c_ptr), intent(inout) :: tau_field_d
76 integer, intent(in) :: m
77
78#if HAVE_HIP
79 call hip_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
80 tau_field_d, msk_d, m)
81#elif HAVE_CUDA
82 call cuda_wall_model_compute_mag_field(tau_x_d, tau_y_d, tau_z_d, &
83 tau_field_d, msk_d, m)
84#elif HAVE_OPENCL
85 call neko_error("OPENCL is not implemented for &
86 &wall_model_compute_mag_field")
87#else
88 call neko_error('No device backend configured')
89#endif
90
92end module wall_model_device
integer, parameter, public c_rp
Definition num_types.f90:13
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Utilities.
Definition utils.f90:35
Implements the device kernel for the wall_model_t type.
subroutine, public wall_model_compute_mag_field_device(tau_x_d, tau_y_d, tau_z_d, tau_field_d, msk_d, m)
Compute the wall shear stress's magnitude on device.
void cuda_wall_model_compute_mag_field(void *tau_x_d, void *tau_y_d, void *tau_z_d, void *tau_field_d, void *msk_d, int *m)
Definition wall_model.cu:42