Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
most_device.F90
Go to the documentation of this file.
1
2
4 use num_types, only : rp, c_rp
5 use, intrinsic :: iso_c_binding, only : c_ptr
6 use utils, only : neko_error
7 implicit none
8 private
9
10#ifdef HAVE_HIP
11 interface
12 subroutine hip_most_compute(u_d, v_d, w_d, temp_d, temp_w_d, &
13 n_x_d, n_y_d, n_z_d, h_d, &
14 tau_x_d, tau_y_d, tau_z_d, n_nodes, &
15 kappa, mu_w_d, rho_w_d, g, Pr, z0, z0h_in, bc_type_int, &
16 bc_value, tstep, &
17 Ri_b_diagn, L_ob_diagn, utau_diagn, magu_diagn, ti_diagn, &
18 ts_diagn, q_diagn) &
19 bind(c, name = 'hip_most_compute')
20 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
21 use num_types, only : c_rp
22 implicit none
23 type(c_ptr), value :: u_d, v_d, w_d, temp_d, temp_w_d
24 type(c_ptr), value :: n_x_d, n_y_d, n_z_d, h_d
25 type(c_ptr), value :: mu_w_d, rho_w_d
26 real(c_rp) :: kappa, z0, z0h_in, bc_value, Pr
27 real(c_rp) :: g(3)
28 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d
29 integer(c_int) :: n_nodes, tstep, bc_type_int
30 type(c_ptr), value :: Ri_b_diagn, L_ob_diagn
31 type(c_ptr), value :: utau_diagn, magu_diagn
32 type(c_ptr), value :: ti_diagn, ts_diagn, q_diagn
33 end subroutine hip_most_compute
34 end interface
35#elif HAVE_CUDA
36 interface
37 subroutine cuda_most_compute(u_d, v_d, w_d, temp_d, temp_w_d, &
38 n_x_d, n_y_d, n_z_d, h_d, &
39 tau_x_d, tau_y_d, tau_z_d, n_nodes, &
40 kappa, mu_w_d, rho_w_d, g, Pr, z0, z0h_in, bc_type_int, &
41 bc_value, tstep, &
42 Ri_b_diagn, L_ob_diagn, utau_diagn, magu_diagn, ti_diagn, &
43 ts_diagn, q_diagn) &
44 bind(c, name = 'cuda_most_compute')
45 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
46 use num_types, only : c_rp
47 implicit none
48 type(c_ptr), value :: u_d, v_d, w_d, temp_d, temp_w_d
49 type(c_ptr), value :: n_x_d, n_y_d, n_z_d, h_d
50 type(c_ptr), value :: mu_w_d, rho_w_d
51 real(c_rp) :: kappa, z0, z0h_in, bc_value, Pr
52 real(c_rp) :: g(3)
53 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d
54 integer(c_int) :: n_nodes, tstep, bc_type_int
55 type(c_ptr), value :: Ri_b_diagn, L_ob_diagn
56 type(c_ptr), value :: utau_diagn, magu_diagn
57 type(c_ptr), value :: ti_diagn, ts_diagn, q_diagn
58 end subroutine cuda_most_compute
59 end interface
60#elif HAVE_OPENCL
61#endif
62 public :: most_compute_device
63
64contains
68 subroutine most_compute_device(u_d, v_d, w_d, temp_d, temp_w_d, &
69 n_x_d, n_y_d, n_z_d, h_d, tau_x_d, tau_y_d, tau_z_d, &
70 n_nodes, kappa, mu_w_d, rho_w_d, g, Pr, z0, z0h_in, bc_type, &
71 bc_value, tstep, Ri_b_diagn, L_ob_diagn, utau_diagn, &
72 magu_diagn, ti_diagn, ts_diagn, q_diagn)
73 integer, intent(in) :: n_nodes, tstep
74 type(c_ptr), intent(in) :: u_d, v_d, w_d, temp_d, temp_w_d
75 type(c_ptr), intent(in) :: n_x_d, n_y_d, n_z_d, h_d
76 type(c_ptr), intent(inout) :: tau_x_d, tau_y_d, tau_z_d
77 type(c_ptr), intent(in) :: mu_w_d, rho_w_d
78 real(kind=rp), intent(in) :: kappa, z0, z0h_in, bc_value, pr
79 real(kind=rp) :: g(3)
80 character(len=*), intent(in) :: bc_type ! passed as a normal Fortran string
81 integer :: bc_type_int
82 type(c_ptr), value :: ri_b_diagn, l_ob_diagn
83 type(c_ptr), value :: utau_diagn, magu_diagn
84 type(c_ptr), value :: ti_diagn, ts_diagn, q_diagn
85
86 ! convert bc_type to integer to avoid cross-language passing of strings
87 select case (trim(adjustl(bc_type))) ! (trimmed, lowercase-consistent)
88 case ("neumann")
89 bc_type_int = 0
90 case ("dirichlet")
91 bc_type_int = 1
92 case default
93 call neko_error("Neumann/Dirichlet bc not specified correctly " // &
94 "(most_device)")
95 end select
96
97#if HAVE_HIP
98 call hip_most_compute(u_d, v_d, w_d, temp_d, temp_w_d, &
99 n_x_d, n_y_d, n_z_d, h_d, &
100 tau_x_d, tau_y_d, tau_z_d, n_nodes, &
101 kappa, mu_w_d, rho_w_d, g, pr, z0, z0h_in, &
102 bc_type_int, bc_value, tstep, ri_b_diagn, &
103 l_ob_diagn, utau_diagn, magu_diagn, ti_diagn, &
104 ts_diagn, q_diagn)
105#elif HAVE_CUDA
106 call cuda_most_compute(u_d, v_d, w_d, temp_d, temp_w_d, &
107 n_x_d, n_y_d, n_z_d, h_d, &
108 tau_x_d, tau_y_d, tau_z_d, n_nodes, &
109 kappa, mu_w_d, rho_w_d, g, pr, z0, z0h_in, &
110 bc_type_int, bc_value, tstep, ri_b_diagn, &
111 l_ob_diagn, utau_diagn, magu_diagn, ti_diagn, &
112 ts_diagn, q_diagn)
113#elif HAVE_OPENCL
114 call neko_error("OPENCL is not implemented for the MOST wall model")
115#else
116 call neko_error('No device backend configured')
117#endif
118
119 end subroutine most_compute_device
120end module most_device
void cuda_most_compute(void *u_d, void *v_d, void *w_d, void *temp_d, void *temp_w_d, void *n_x_d, void *n_y_d, void *n_z_d, void *h_d, void *tau_x_d, void *tau_y_d, void *tau_z_d, int *n_nodes, real *kappa, void *mu_w_d, void *rho_w_d, real *g, real *Pr, real *z0, real *z0h_in, int *bc_type, real *bc_value, int *tstep, void *Ri_b_diagn, void *L_ob_diagn, void *utau_diagn, void *magu_diagn, void *ti_diagn, void *ts_diagn, void *q_diagn)
Definition most.cu:44
Implements the device kernel for the most_t type.
subroutine, public most_compute_device(u_d, v_d, w_d, temp_d, temp_w_d, n_x_d, n_y_d, n_z_d, h_d, tau_x_d, tau_y_d, tau_z_d, n_nodes, kappa, mu_w_d, rho_w_d, g, pr, z0, z0h_in, bc_type, bc_value, tstep, ri_b_diagn, l_ob_diagn, utau_diagn, magu_diagn, ti_diagn, ts_diagn, q_diagn)
Compute the wall shear stress on device using the rough log-law model.
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