Neko 1.99.5
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, &
13 ind_r_d, ind_s_d, ind_t_d, ind_e_d, &
14 n_x_d, n_y_d, n_z_d, h_d, &
15 tau_x_d, tau_y_d, tau_z_d, n_nodes, lx, &
16 kappa, mu_w_d, rho_w_d, g, Pr, z0, z0h_in, bc_type_int, &
17 bc_value, tstep, &
18 Ri_b_diagn, L_ob_diagn, utau_diagn, magu_diagn, ti_diagn, &
19 ts_diagn, q_diagn, h_x_idx, h_y_idx, h_z_idx) &
20 bind(c, name = 'hip_most_compute')
21 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
22 use num_types, only : c_rp
23 implicit none
24 type(c_ptr), value :: u_d, v_d, w_d, temp_d
25 type(c_ptr), value :: ind_r_d, ind_s_d, ind_t_d, ind_e_d
26 type(c_ptr), value :: n_x_d, n_y_d, n_z_d, h_d
27 type(c_ptr), value :: mu_w_d, rho_w_d
28 real(c_rp) :: kappa, z0, z0h_in, bc_value, Pr
29 real(c_rp) :: g(3)
30 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d
31 integer(c_int) :: n_nodes, lx, tstep, bc_type_int
32 type(c_ptr), value :: Ri_b_diagn, L_ob_diagn
33 type(c_ptr), value :: utau_diagn, magu_diagn
34 type(c_ptr), value :: ti_diagn, ts_diagn, q_diagn
35 type(c_ptr), value :: h_x_idx, h_y_idx, h_z_idx
36 end subroutine hip_most_compute
37 end interface
38#elif HAVE_CUDA
39 interface
40 subroutine cuda_most_compute(u_d, v_d, w_d, temp_d, &
41 ind_r_d, ind_s_d, ind_t_d, ind_e_d, &
42 n_x_d, n_y_d, n_z_d, h_d, &
43 tau_x_d, tau_y_d, tau_z_d, n_nodes, lx, &
44 kappa, mu_w_d, rho_w_d, g, Pr, z0, z0h_in, bc_type_int, &
45 bc_value, tstep, &
46 Ri_b_diagn, L_ob_diagn, utau_diagn, magu_diagn, ti_diagn, &
47 ts_diagn, q_diagn, h_x_idx, h_y_idx, h_z_idx) &
48 bind(c, name = 'cuda_most_compute')
49 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
50 use num_types, only : c_rp
51 implicit none
52 type(c_ptr), value :: u_d, v_d, w_d, temp_d
53 type(c_ptr), value :: ind_r_d, ind_s_d, ind_t_d, ind_e_d
54 type(c_ptr), value :: n_x_d, n_y_d, n_z_d, h_d
55 type(c_ptr), value :: mu_w_d, rho_w_d
56 real(c_rp) :: kappa, z0, z0h_in, bc_value, Pr
57 real(c_rp) :: g(3)
58 type(c_ptr), value :: tau_x_d, tau_y_d, tau_z_d
59 integer(c_int) :: n_nodes, lx, tstep, bc_type_int
60 type(c_ptr), value :: Ri_b_diagn, L_ob_diagn
61 type(c_ptr), value :: utau_diagn, magu_diagn
62 type(c_ptr), value :: ti_diagn, ts_diagn, q_diagn
63 type(c_ptr), value :: h_x_idx, h_y_idx, h_z_idx
64 end subroutine cuda_most_compute
65 end interface
66#elif HAVE_OPENCL
67#endif
68 public :: most_compute_device
69
70contains
74 subroutine most_compute_device(u_d, v_d, w_d, temp_d, &
75 ind_r_d, ind_s_d, ind_t_d, ind_e_d, &
76 n_x_d, n_y_d, n_z_d, h_d, tau_x_d, tau_y_d, tau_z_d, &
77 n_nodes, lx, kappa, mu_w_d, rho_w_d, g, Pr, z0, z0h_in, bc_type, &
78 bc_value, tstep, Ri_b_diagn, L_ob_diagn, utau_diagn, &
79 magu_diagn, ti_diagn, ts_diagn, q_diagn, &
80 h_x_idx, h_y_idx, h_z_idx)
81 integer, intent(in) :: n_nodes, lx, tstep
82 type(c_ptr), intent(in) :: u_d, v_d, w_d, temp_d
83 type(c_ptr), intent(in) :: ind_r_d, ind_s_d, ind_t_d, ind_e_d
84 type(c_ptr), intent(in) :: n_x_d, n_y_d, n_z_d, h_d
85 type(c_ptr), intent(inout) :: tau_x_d, tau_y_d, tau_z_d
86 type(c_ptr), intent(in) :: mu_w_d, rho_w_d
87 real(kind=rp), intent(in) :: kappa, z0, z0h_in, bc_value, pr
88 real(kind=rp) :: g(3)
89 character(len=*), intent(in) :: bc_type ! passed as a normal Fortran string
90 integer :: bc_type_int
91 type(c_ptr), value :: ri_b_diagn, l_ob_diagn
92 type(c_ptr), value :: utau_diagn, magu_diagn
93 type(c_ptr), value :: ti_diagn, ts_diagn, q_diagn
94 type(c_ptr), value :: h_x_idx, h_y_idx, h_z_idx
95
96 ! convert bc_type to integer to avoid cross-language passing of strings
97 select case (trim(adjustl(bc_type))) ! (trimmed, lowercase-consistent)
98 case ("neumann")
99 bc_type_int = 0
100 case ("dirichlet")
101 bc_type_int = 1
102 case default
103 call neko_error("Neumann/Dirichlet bc not specified correctly " // &
104 "(most_device)")
105 end select
106
107#if HAVE_HIP
108 call hip_most_compute(u_d, v_d, w_d,temp_d, &
109 ind_r_d, ind_s_d, ind_t_d, ind_e_d, &
110 n_x_d, n_y_d, n_z_d, h_d, &
111 tau_x_d, tau_y_d, tau_z_d, n_nodes, &
112 lx, kappa, mu_w_d, rho_w_d, g, pr, z0, z0h_in, &
113 bc_type_int, bc_value, tstep, ri_b_diagn, &
114 l_ob_diagn, utau_diagn, magu_diagn, ti_diagn, &
115 ts_diagn, q_diagn, h_x_idx, h_y_idx, h_z_idx)
116#elif HAVE_CUDA
117 call cuda_most_compute(u_d, v_d, w_d,temp_d, &
118 ind_r_d, ind_s_d, ind_t_d, ind_e_d, &
119 n_x_d, n_y_d, n_z_d, h_d, &
120 tau_x_d, tau_y_d, tau_z_d, n_nodes, &
121 lx, kappa, mu_w_d, rho_w_d, g, pr, z0, z0h_in, &
122 bc_type_int, bc_value, tstep, ri_b_diagn, &
123 l_ob_diagn, utau_diagn, magu_diagn, ti_diagn, &
124 ts_diagn, q_diagn, h_x_idx, h_y_idx, h_z_idx)
125#elif HAVE_OPENCL
126 call neko_error("OPENCL is not implemented for the MOST wall model")
127#else
128 call neko_error('No device backend configured')
129#endif
130
131 end subroutine most_compute_device
132end module most_device
void cuda_most_compute(void *u_d, void *v_d, void *w_d, void *temp_d, void *ind_r_d, void *ind_s_d, void *ind_t_d, void *ind_e_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, int *lx, 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, void *h_x_idx, void *h_y_idx, void *h_z_idx)
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, ind_r_d, ind_s_d, ind_t_d, ind_e_d, n_x_d, n_y_d, n_z_d, h_d, tau_x_d, tau_y_d, tau_z_d, n_nodes, lx, 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, h_x_idx, h_y_idx, h_z_idx)
Compute the wall shear stress on device using the rough log-law model.
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