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