Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
compressible_res_device.F90
Go to the documentation of this file.
1! Copyright (c) 2025-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 field, only : field_t
36 use ax_product, only : ax_t
37 use coefs, only : coef_t
38 use gather_scatter, only : gs_t, gs_op_add
39 use num_types, only : rp, c_rp
41 use utils, only : neko_error
42 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
43 use operators, only : div, grad, opgrad, rotate_cyc
45 use field_list, only : field_list_t
53 use bc_list, only : bc_list_t
54 use time_state, only : time_state_t
55
57 contains
58 procedure, nopass :: step => advance_primitive_variables_device
59 procedure, nopass :: evaluate_rhs => evaluate_rhs_device
61
64 logical, public :: compressible_res_device_add_physical_flux = .false.
69 real(kind=rp), public :: compressible_res_device_gamma = 1.4_rp
70
71#ifdef HAVE_HIP
72 interface
73 subroutine compressible_res_part_visc_hip(rhs_rho_d, rhs_m_x_d, &
74 rhs_m_y_d, rhs_m_z_d, rhs_E_d, visc_rho_d, visc_m_x_d, &
75 visc_m_y_d, visc_m_z_d, visc_E_d, Binv_d, h1_d, n) &
76 bind(c, name = 'compressible_res_part_visc_hip')
77 use, intrinsic :: iso_c_binding
78 implicit none
79 type(c_ptr), value :: rhs_rho_d, rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
80 rhs_e_d, visc_rho_d, visc_m_x_d, visc_m_y_d, visc_m_z_d, &
81 visc_e_d, binv_d, h1_d
82 integer(c_int) :: n
84 end interface
85
86 interface
87 subroutine inviscid_res_part_mx_flux_hip(f_x, f_y, f_z, &
88 m_x, m_y, m_z, rho_field, p, n) &
89 bind(c, name = 'inviscid_res_part_mx_flux_hip')
90 use, intrinsic :: iso_c_binding
91 implicit none
92 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
93 integer(c_int) :: n
95 end interface
96
97 interface
98 subroutine inviscid_res_part_my_flux_hip(f_x, f_y, f_z, &
99 m_x, m_y, m_z, rho_field, p, n) &
100 bind(c, name = 'inviscid_res_part_my_flux_hip')
101 use, intrinsic :: iso_c_binding
102 implicit none
103 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
104 integer(c_int) :: n
105 end subroutine inviscid_res_part_my_flux_hip
106 end interface
107
108 interface
109 subroutine inviscid_res_part_mz_flux_hip(f_x, f_y, f_z, &
110 m_x, m_y, m_z, rho_field, p, n) &
111 bind(c, name = 'inviscid_res_part_mz_flux_hip')
112 use, intrinsic :: iso_c_binding
113 implicit none
114 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
115 integer(c_int) :: n
116 end subroutine inviscid_res_part_mz_flux_hip
117 end interface
118
119 interface
120 subroutine inviscid_res_part_e_flux_hip(f_x, f_y, f_z, &
121 m_x, m_y, m_z, rho_field, p, E, n) &
122 bind(c, name = 'inviscid_res_part_E_flux_hip')
123 use, intrinsic :: iso_c_binding
124 implicit none
125 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p, E
126 integer(c_int) :: n
127 end subroutine inviscid_res_part_e_flux_hip
128 end interface
129
130 interface
131 subroutine compressible_res_part_coef_mult_hip(rhs_rho_field_d, &
132 rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
133 rhs_E_d, mult_d, n) &
134 bind(c, name = 'compressible_res_part_coef_mult_hip')
135 use, intrinsic :: iso_c_binding
136 implicit none
137 type(c_ptr), value :: rhs_rho_field_d, rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
138 rhs_E_d, mult_d
139 integer(c_int) :: n
141 end interface
142
143 interface
144 subroutine compressible_res_part_rk_sum_hip(rho, m_x, m_y, m_z, E, &
145 k_rho_i, k_m_x_i, k_m_y_i, &
146 k_m_z_i, k_E_i, &
147 dt, b_i, n) &
148 bind(c, name = 'compressible_res_part_rk_sum_hip')
149 use, intrinsic :: iso_c_binding
150 import c_rp
151 implicit none
152 type(c_ptr), value :: rho, m_x, m_y, m_z, E, &
153 k_rho_i, k_m_x_i, k_m_y_i, &
154 k_m_z_i, k_E_i
155 real(c_rp) :: dt, b_i
156 integer(c_int) :: n
158 end interface
159#elif HAVE_CUDA
160 interface
161 subroutine compressible_res_part_visc_cuda(rhs_rho_d, rhs_m_x_d, &
162 rhs_m_y_d, rhs_m_z_d, rhs_E_d, visc_rho_d, visc_m_x_d, &
163 visc_m_y_d, visc_m_z_d, visc_E_d, Binv_d, h1_d, n) &
164 bind(c, name = 'compressible_res_part_visc_cuda')
165 use, intrinsic :: iso_c_binding
166 implicit none
167 type(c_ptr), value :: rhs_rho_d, rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
168 rhs_E_d, visc_rho_d, visc_m_x_d, visc_m_y_d, visc_m_z_d, &
169 visc_E_d, Binv_d, h1_d
170 integer(c_int) :: n
172 end interface
173
174 interface
175 subroutine inviscid_res_part_mx_flux_cuda(f_x, f_y, f_z, &
176 m_x, m_y, m_z, rho_field, p, n) &
177 bind(c, name = 'inviscid_res_part_mx_flux_cuda')
178 use, intrinsic :: iso_c_binding
179 implicit none
180 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
181 integer(c_int) :: n
182 end subroutine inviscid_res_part_mx_flux_cuda
183 end interface
184
185 interface
186 subroutine inviscid_res_part_my_flux_cuda(f_x, f_y, f_z, &
187 m_x, m_y, m_z, rho_field, p, n) &
188 bind(c, name = 'inviscid_res_part_my_flux_cuda')
189 use, intrinsic :: iso_c_binding
190 implicit none
191 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
192 integer(c_int) :: n
193 end subroutine inviscid_res_part_my_flux_cuda
194 end interface
195
196 interface
197 subroutine inviscid_res_part_mz_flux_cuda(f_x, f_y, f_z, &
198 m_x, m_y, m_z, rho_field, p, n) &
199 bind(c, name = 'inviscid_res_part_mz_flux_cuda')
200 use, intrinsic :: iso_c_binding
201 implicit none
202 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
203 integer(c_int) :: n
204 end subroutine inviscid_res_part_mz_flux_cuda
205 end interface
206
207 interface
208 subroutine inviscid_res_part_e_flux_cuda(f_x, f_y, f_z, &
209 m_x, m_y, m_z, rho_field, p, E, n) &
210 bind(c, name = 'inviscid_res_part_E_flux_cuda')
211 use, intrinsic :: iso_c_binding
212 implicit none
213 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p, E
214 integer(c_int) :: n
215 end subroutine inviscid_res_part_e_flux_cuda
216 end interface
217
218 interface
219 subroutine compressible_res_part_coef_mult_cuda(rhs_rho_field_d, &
220 rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
221 rhs_E_d, mult_d, n) &
222 bind(c, name = 'compressible_res_part_coef_mult_cuda')
223 use, intrinsic :: iso_c_binding
224 implicit none
225 type(c_ptr), value :: rhs_rho_field_d, rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
226 rhs_E_d, mult_d
227 integer(c_int) :: n
229 end interface
230
231 interface
232 subroutine compressible_res_part_rk_sum_cuda(rho, m_x, m_y, m_z, E, &
233 k_rho_i, k_m_x_i, k_m_y_i, &
234 k_m_z_i, k_E_i, &
235 dt, c, n) &
236 bind(c, name = 'compressible_res_part_rk_sum_cuda')
237 use, intrinsic :: iso_c_binding
238 import c_rp
239 implicit none
240 type(c_ptr), value :: rho, m_x, m_y, m_z, E, &
241 k_rho_i, k_m_x_i, k_m_y_i, &
242 k_m_z_i, k_E_i
243 real(c_rp) :: dt, c
244 integer(c_int) :: n
246 end interface
247#elif HAVE_OPENCL
248 interface
249 subroutine compressible_res_part_visc_opencl(rhs_rho_d, rhs_m_x_d, &
250 rhs_m_y_d, rhs_m_z_d, rhs_E_d, visc_rho_d, visc_m_x_d, &
251 visc_m_y_d, visc_m_z_d, visc_E_d, Binv_d, h1_d, n) &
252 bind(c, name = 'compressible_res_part_visc_opencl')
253 use, intrinsic :: iso_c_binding
254 implicit none
255 type(c_ptr), value :: rhs_rho_d, rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
256 rhs_E_d, visc_rho_d, visc_m_x_d, visc_m_y_d, visc_m_z_d, &
257 visc_E_d, Binv_d, h1_d
258 integer(c_int) :: n
260 end interface
261
262 interface
263 subroutine inviscid_res_part_mx_flux_opencl(f_x, f_y, f_z, &
264 m_x, m_y, m_z, rho_field, p, n) &
265 bind(c, name = 'inviscid_res_part_mx_flux_opencl')
266 use, intrinsic :: iso_c_binding
267 implicit none
268 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
269 integer(c_int) :: n
271 end interface
272
273 interface
274 subroutine inviscid_res_part_my_flux_opencl(f_x, f_y, f_z, &
275 m_x, m_y, m_z, rho_field, p, n) &
276 bind(c, name = 'inviscid_res_part_my_flux_opencl')
277 use, intrinsic :: iso_c_binding
278 implicit none
279 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
280 integer(c_int) :: n
282 end interface
283
284 interface
285 subroutine inviscid_res_part_mz_flux_opencl(f_x, f_y, f_z, &
286 m_x, m_y, m_z, rho_field, p, n) &
287 bind(c, name = 'inviscid_res_part_mz_flux_opencl')
288 use, intrinsic :: iso_c_binding
289 implicit none
290 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
291 integer(c_int) :: n
293 end interface
294
295 interface
296 subroutine inviscid_res_part_e_flux_opencl(f_x, f_y, f_z, &
297 m_x, m_y, m_z, rho_field, p, E, n) &
298 bind(c, name = 'inviscid_res_part_E_flux_opencl')
299 use, intrinsic :: iso_c_binding
300 implicit none
301 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p, E
302 integer(c_int) :: n
303 end subroutine inviscid_res_part_e_flux_opencl
304 end interface
305
306 interface
307 subroutine compressible_res_part_coef_mult_opencl(rhs_rho_field_d, &
308 rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
309 rhs_E_d, mult_d, n) &
310 bind(c, name = 'compressible_res_part_coef_mult_opencl')
311 use, intrinsic :: iso_c_binding
312 implicit none
313 type(c_ptr), value :: rhs_rho_field_d, rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
314 rhs_E_d, mult_d
315 integer(c_int) :: n
317 end interface
318
319 interface
320 subroutine compressible_res_part_rk_sum_opencl(rho, m_x, m_y, m_z, E, &
321 k_rho_i, k_m_x_i, k_m_y_i, &
322 k_m_z_i, k_E_i, &
323 dt, c, n) &
324 bind(c, name = 'compressible_res_part_rk_sum_opencl')
325 use, intrinsic :: iso_c_binding
326 import c_rp
327 implicit none
328 type(c_ptr), value :: rho, m_x, m_y, m_z, E, &
329 k_rho_i, k_m_x_i, k_m_y_i, &
330 k_m_z_i, k_E_i
331 real(c_rp) :: dt, c
332 integer(c_int) :: n
334 end interface
335#elif HAVE_METAL
336 interface
337 subroutine compressible_res_part_visc_metal(rhs_rho_d, rhs_m_x_d, &
338 rhs_m_y_d, rhs_m_z_d, rhs_E_d, visc_rho_d, visc_m_x_d, &
339 visc_m_y_d, visc_m_z_d, visc_E_d, Binv_d, h1_d, n) &
340 bind(c, name = 'compressible_res_part_visc_metal')
341 use, intrinsic :: iso_c_binding
342 implicit none
343 type(c_ptr), value :: rhs_rho_d, rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
344 rhs_E_d, visc_rho_d, visc_m_x_d, visc_m_y_d, visc_m_z_d, &
345 visc_E_d, Binv_d, h1_d
346 integer(c_int) :: n
347 end subroutine compressible_res_part_visc_metal
348 end interface
349
350 interface
351 subroutine inviscid_res_part_mx_flux_metal(f_x, f_y, f_z, &
352 m_x, m_y, m_z, rho_field, p, n) &
353 bind(c, name = 'inviscid_res_part_mx_flux_metal')
354 use, intrinsic :: iso_c_binding
355 implicit none
356 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
357 integer(c_int) :: n
358 end subroutine inviscid_res_part_mx_flux_metal
359 end interface
360
361 interface
362 subroutine inviscid_res_part_my_flux_metal(f_x, f_y, f_z, &
363 m_x, m_y, m_z, rho_field, p, n) &
364 bind(c, name = 'inviscid_res_part_my_flux_metal')
365 use, intrinsic :: iso_c_binding
366 implicit none
367 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
368 integer(c_int) :: n
369 end subroutine inviscid_res_part_my_flux_metal
370 end interface
371
372 interface
373 subroutine inviscid_res_part_mz_flux_metal(f_x, f_y, f_z, &
374 m_x, m_y, m_z, rho_field, p, n) &
375 bind(c, name = 'inviscid_res_part_mz_flux_metal')
376 use, intrinsic :: iso_c_binding
377 implicit none
378 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p
379 integer(c_int) :: n
380 end subroutine inviscid_res_part_mz_flux_metal
381 end interface
382
383 interface
384 subroutine inviscid_res_part_e_flux_metal(f_x, f_y, f_z, &
385 m_x, m_y, m_z, rho_field, p, E, n) &
386 bind(c, name = 'inviscid_res_part_E_flux_metal')
387 use, intrinsic :: iso_c_binding
388 implicit none
389 type(c_ptr), value :: f_x, f_y, f_z, m_x, m_y, m_z, rho_field, p, E
390 integer(c_int) :: n
391 end subroutine inviscid_res_part_e_flux_metal
392 end interface
393
394 interface
395 subroutine compressible_res_part_coef_mult_metal(rhs_rho_field_d, &
396 rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
397 rhs_E_d, mult_d, n) &
398 bind(c, name = 'compressible_res_part_coef_mult_metal')
399 use, intrinsic :: iso_c_binding
400 implicit none
401 type(c_ptr), value :: rhs_rho_field_d, rhs_m_x_d, rhs_m_y_d, rhs_m_z_d, &
402 rhs_E_d, mult_d
403 integer(c_int) :: n
404 end subroutine compressible_res_part_coef_mult_metal
405 end interface
406
407 interface
408 subroutine compressible_res_part_rk_sum_metal(rho, m_x, m_y, m_z, E, &
409 k_rho_i, k_m_x_i, k_m_y_i, &
410 k_m_z_i, k_E_i, &
411 dt, c, n) &
412 bind(c, name = 'compressible_res_part_rk_sum_metal')
413 use, intrinsic :: iso_c_binding
414 import c_rp
415 implicit none
416 type(c_ptr), value :: rho, m_x, m_y, m_z, E, &
417 k_rho_i, k_m_x_i, k_m_y_i, &
418 k_m_z_i, k_E_i
419 real(c_rp) :: dt, c
420 integer(c_int) :: n
421 end subroutine compressible_res_part_rk_sum_metal
422 end interface
423#endif
424
425contains
427 m_x, m_y, m_z, E, p, u, v, w, Ax, &
428 Ax_stress, coef, gs, artificial_visc, mu, kappa, bcs_vel, time, &
429 rk_scheme, dt)
430 type(field_t), intent(inout) :: rho_field, m_x, m_y, m_z, E
431 type(field_t), intent(in) :: p, u, v, w, artificial_visc, mu, kappa
432 class(ax_t), intent(inout) :: Ax, Ax_stress
433 type(coef_t), intent(inout) :: coef
434 type(gs_t), intent(inout) :: gs
435 type(bc_list_t), intent(inout) :: bcs_vel
436 type(time_state_t), intent(in) :: time
437 class(runge_kutta_time_scheme_t), intent(in) :: rk_scheme
438 real(kind=rp), intent(in) :: dt
439 integer :: n, s, i, j, k
440 real(kind=rp) :: t, c
441 type(field_t), pointer :: k_rho_1, k_rho_2, k_rho_3, k_rho_4, &
442 k_m_x_1, k_m_x_2, k_m_x_3, k_m_x_4, &
443 k_m_y_1, k_m_y_2, k_m_y_3, k_m_y_4, &
444 k_m_z_1, k_m_z_2, k_m_z_3, k_m_z_4, &
445 k_e_1, k_e_2, k_e_3, k_e_4, &
446 temp_rho, temp_m_x, temp_m_y, temp_m_z, temp_e, &
447 temp_p, temp_u, temp_v, temp_w, temp_ruvw
448 integer :: temp_indices(30)
449 type(field_list_t) :: k_rho, k_m_x, k_m_y, k_m_z, k_E
450
451 n = p%dof%size()
452 s = rk_scheme%order
453 call neko_scratch_registry%request_field(k_rho_1, temp_indices(1), .true.)
454 call neko_scratch_registry%request_field(k_rho_2, temp_indices(2), .true.)
455 call neko_scratch_registry%request_field(k_rho_3, temp_indices(3), .true.)
456 call neko_scratch_registry%request_field(k_rho_4, temp_indices(4), .true.)
457 call neko_scratch_registry%request_field(k_m_x_1, temp_indices(5), .true.)
458 call neko_scratch_registry%request_field(k_m_x_2, temp_indices(6), .true.)
459 call neko_scratch_registry%request_field(k_m_x_3, temp_indices(7), .true.)
460 call neko_scratch_registry%request_field(k_m_x_4, temp_indices(8), .true.)
461 call neko_scratch_registry%request_field(k_m_y_1, temp_indices(9), .true.)
462 call neko_scratch_registry%request_field(k_m_y_2, temp_indices(10), .true.)
463 call neko_scratch_registry%request_field(k_m_y_3, temp_indices(11), .true.)
464 call neko_scratch_registry%request_field(k_m_y_4, temp_indices(12), .true.)
465 call neko_scratch_registry%request_field(k_m_z_1, temp_indices(13), .true.)
466 call neko_scratch_registry%request_field(k_m_z_2, temp_indices(14), .true.)
467 call neko_scratch_registry%request_field(k_m_z_3, temp_indices(15), .true.)
468 call neko_scratch_registry%request_field(k_m_z_4, temp_indices(16), .true.)
469 call neko_scratch_registry%request_field(k_e_1, temp_indices(17), .true.)
470 call neko_scratch_registry%request_field(k_e_2, temp_indices(18), .true.)
471 call neko_scratch_registry%request_field(k_e_3, temp_indices(19), .true.)
472 call neko_scratch_registry%request_field(k_e_4, temp_indices(20), .true.)
473 call neko_scratch_registry%request_field(temp_rho, temp_indices(21), &
474 .false.)
475 call neko_scratch_registry%request_field(temp_m_x, temp_indices(22), &
476 .false.)
477 call neko_scratch_registry%request_field(temp_m_y, temp_indices(23), &
478 .false.)
479 call neko_scratch_registry%request_field(temp_m_z, temp_indices(24), &
480 .false.)
481 call neko_scratch_registry%request_field(temp_e, temp_indices(25), .false.)
482 call neko_scratch_registry%request_field(temp_p, temp_indices(26), .false.)
483 call neko_scratch_registry%request_field(temp_u, temp_indices(27), .false.)
484 call neko_scratch_registry%request_field(temp_v, temp_indices(28), .false.)
485 call neko_scratch_registry%request_field(temp_w, temp_indices(29), .false.)
486 call neko_scratch_registry%request_field(temp_ruvw, temp_indices(30), &
487 .false.)
488
489 call k_rho%init(4)
490 call k_rho%assign(1, k_rho_1)
491 call k_rho%assign(2, k_rho_2)
492 call k_rho%assign(3, k_rho_3)
493 call k_rho%assign(4, k_rho_4)
494 call k_m_x%init(4)
495 call k_m_x%assign(1, k_m_x_1)
496 call k_m_x%assign(2, k_m_x_2)
497 call k_m_x%assign(3, k_m_x_3)
498 call k_m_x%assign(4, k_m_x_4)
499 call k_m_y%init(4)
500 call k_m_y%assign(1, k_m_y_1)
501 call k_m_y%assign(2, k_m_y_2)
502 call k_m_y%assign(3, k_m_y_3)
503 call k_m_y%assign(4, k_m_y_4)
504 call k_m_z%init(4)
505 call k_m_z%assign(1, k_m_z_1)
506 call k_m_z%assign(2, k_m_z_2)
507 call k_m_z%assign(3, k_m_z_3)
508 call k_m_z%assign(4, k_m_z_4)
509 call k_e%init(4)
510 call k_e%assign(1, k_e_1)
511 call k_e%assign(2, k_e_2)
512 call k_e%assign(3, k_e_3)
513 call k_e%assign(4, k_e_4)
514
515 ! Runge-Kutta stages
516 do i = 1, s
517 call device_copy(temp_rho%x_d, rho_field%x_d, n)
518 call device_copy(temp_m_x%x_d, m_x%x_d, n)
519 call device_copy(temp_m_y%x_d, m_y%x_d, n)
520 call device_copy(temp_m_z%x_d, m_z%x_d, n)
521 call device_copy(temp_e%x_d, e%x_d, n)
522
523 do j = 1, i-1
524#ifdef HAVE_HIP
525 call compressible_res_part_rk_sum_hip(temp_rho%x_d, temp_m_x%x_d, &
526 temp_m_y%x_d, temp_m_z%x_d, temp_e%x_d, &
527 k_rho%items(j)%ptr%x_d, k_m_x%items(j)%ptr%x_d, &
528 k_m_y%items(j)%ptr%x_d, &
529 k_m_z%items(j)%ptr%x_d, k_e%items(j)%ptr%x_d, &
530 dt, rk_scheme%coeffs_A(i, j), n)
531#elif HAVE_CUDA
532 call compressible_res_part_rk_sum_cuda(temp_rho%x_d, temp_m_x%x_d, &
533 temp_m_y%x_d, temp_m_z%x_d, temp_e%x_d, &
534 k_rho%items(j)%ptr%x_d, k_m_x%items(j)%ptr%x_d, &
535 k_m_y%items(j)%ptr%x_d, &
536 k_m_z%items(j)%ptr%x_d, k_e%items(j)%ptr%x_d, &
537 dt, rk_scheme%coeffs_A(i, j), n)
538#elif HAVE_OPENCL
539 call compressible_res_part_rk_sum_opencl(temp_rho%x_d, temp_m_x%x_d, &
540 temp_m_y%x_d, temp_m_z%x_d, temp_e%x_d, &
541 k_rho%items(j)%ptr%x_d, k_m_x%items(j)%ptr%x_d, &
542 k_m_y%items(j)%ptr%x_d, &
543 k_m_z%items(j)%ptr%x_d, k_e%items(j)%ptr%x_d, &
544 dt, rk_scheme%coeffs_A(i, j), n)
545#elif HAVE_METAL
546 call compressible_res_part_rk_sum_metal(temp_rho%x_d, &
547 temp_m_x%x_d, temp_m_y%x_d, temp_m_z%x_d, temp_e%x_d, &
548 k_rho%items(j)%ptr%x_d, k_m_x%items(j)%ptr%x_d, &
549 k_m_y%items(j)%ptr%x_d, &
550 k_m_z%items(j)%ptr%x_d, k_e%items(j)%ptr%x_d, &
551 dt, rk_scheme%coeffs_A(i, j), n)
552#endif
553 end do
554
555 ! Compute f(U) = rhs(U) with primitive variables from the RK stage state.
556 call compressible_ops_device_update_uvw(temp_u%x_d, temp_v%x_d, &
557 temp_w%x_d, temp_m_x%x_d, temp_m_y%x_d, temp_m_z%x_d, &
558 temp_rho%x_d, n)
560 call bcs_vel%apply_vector(temp_u%x, temp_v%x, temp_w%x, n, time, &
561 strong = .true.)
562 end if
564 temp_m_y%x_d, temp_m_z%x_d, temp_p%x_d, temp_ruvw%x_d, &
565 temp_u%x_d, temp_v%x_d, temp_w%x_d, temp_e%x_d, &
566 temp_rho%x_d, compressible_res_device_gamma, n)
567
568 call evaluate_rhs_device(k_rho%items(i)%ptr, k_m_x%items(i)%ptr, &
569 k_m_y%items(i)%ptr, k_m_z%items(i)%ptr, k_e%items(i)%ptr, &
570 temp_rho, temp_m_x, temp_m_y, temp_m_z, temp_e, &
571 temp_p, temp_u, temp_v, temp_w, ax, &
572 ax_stress, coef, gs, artificial_visc, mu, kappa)
573 end do
574
575 ! Update the solution
576 do i = 1, s
577#ifdef HAVE_HIP
578 call compressible_res_part_rk_sum_hip(rho_field%x_d, &
579 m_x%x_d, m_y%x_d, m_z%x_d, e%x_d, &
580 k_rho%items(i)%ptr%x_d, k_m_x%items(i)%ptr%x_d, &
581 k_m_y%items(i)%ptr%x_d, &
582 k_m_z%items(i)%ptr%x_d, k_e%items(i)%ptr%x_d, &
583 dt, rk_scheme%coeffs_b(i), n)
584#elif HAVE_CUDA
585 call compressible_res_part_rk_sum_cuda(rho_field%x_d, &
586 m_x%x_d, m_y%x_d, m_z%x_d, e%x_d, &
587 k_rho%items(i)%ptr%x_d, k_m_x%items(i)%ptr%x_d, &
588 k_m_y%items(i)%ptr%x_d, &
589 k_m_z%items(i)%ptr%x_d, k_e%items(i)%ptr%x_d, &
590 dt, rk_scheme%coeffs_b(i), n)
591#elif HAVE_OPENCL
592 call compressible_res_part_rk_sum_opencl(rho_field%x_d, &
593 m_x%x_d, m_y%x_d, m_z%x_d, e%x_d, &
594 k_rho%items(i)%ptr%x_d, k_m_x%items(i)%ptr%x_d, &
595 k_m_y%items(i)%ptr%x_d, &
596 k_m_z%items(i)%ptr%x_d, k_e%items(i)%ptr%x_d, &
597 dt, rk_scheme%coeffs_b(i), n)
598#elif HAVE_METAL
599 call compressible_res_part_rk_sum_metal(rho_field%x_d, &
600 m_x%x_d, m_y%x_d, m_z%x_d, e%x_d, &
601 k_rho%items(i)%ptr%x_d, k_m_x%items(i)%ptr%x_d, &
602 k_m_y%items(i)%ptr%x_d, &
603 k_m_z%items(i)%ptr%x_d, k_e%items(i)%ptr%x_d, &
604 dt, rk_scheme%coeffs_b(i), n)
605#endif
606 end do
607
608 call neko_scratch_registry%relinquish_field(temp_indices)
610
611 subroutine evaluate_rhs_device(rhs_rho_field, rhs_m_x, rhs_m_y, &
612 rhs_m_z, rhs_E, rho_field, &
613 m_x, m_y, m_z, E, p, u, v, w, Ax, &
614 Ax_stress, coef, gs, artificial_visc, mu, kappa)
615 type(field_t), intent(inout) :: rhs_rho_field, rhs_m_x, rhs_m_y, &
616 rhs_m_z, rhs_E
617 type(field_t), intent(inout) :: rho_field, m_x, m_y, m_z, E
618 type(field_t), intent(in) :: p, u, v, w, artificial_visc, mu, kappa
619 class(ax_t), intent(inout) :: Ax, Ax_stress
620 type(coef_t), intent(inout) :: coef
621 type(gs_t), intent(inout) :: gs
622 integer :: n, i
623 type(field_t), pointer :: temp, f_x, f_y, f_z, &
624 visc_rho, visc_m_x, visc_m_y, visc_m_z, visc_E
625 integer :: temp_indices(8)
626
627 n = coef%dof%size()
628 call neko_scratch_registry%request_field(f_x, temp_indices(1), .false.)
629 call neko_scratch_registry%request_field(f_y, temp_indices(2), .false.)
630 call neko_scratch_registry%request_field(f_z, temp_indices(3), .false.)
631
633 call div(rhs_rho_field%x_d, m_x%x_d, m_y%x_d, m_z%x_d, coef)
634
636 ! m_x
637#ifdef HAVE_HIP
638 call inviscid_res_part_mx_flux_hip(f_x%x_d, f_y%x_d, f_z%x_d, &
639 m_x%x_d, m_y%x_d, m_z%x_d, rho_field%x_d, p%x_d, n)
640#elif HAVE_CUDA
641 call inviscid_res_part_mx_flux_cuda(f_x%x_d, f_y%x_d, f_z%x_d, &
642 m_x%x_d, m_y%x_d, m_z%x_d, rho_field%x_d, p%x_d, n)
643#elif HAVE_OPENCL
644 call inviscid_res_part_mx_flux_opencl(f_x%x_d, f_y%x_d, f_z%x_d, &
645 m_x%x_d, m_y%x_d, m_z%x_d, rho_field%x_d, p%x_d, n)
646#elif HAVE_METAL
647 call inviscid_res_part_mx_flux_metal(f_x%x_d, f_y%x_d, f_z%x_d, &
648 m_x%x_d, m_y%x_d, m_z%x_d, rho_field%x_d, p%x_d, n)
649#endif
650 call div(rhs_m_x%x_d, f_x%x_d, f_y%x_d, f_z%x_d, coef)
651 ! m_y
652#ifdef HAVE_HIP
653 call inviscid_res_part_my_flux_hip(f_x%x_d, f_y%x_d, f_z%x_d, &
654 m_x%x_d, m_y%x_d, m_z%x_d, &
655 rho_field%x_d, p%x_d, n)
656#elif HAVE_CUDA
657 call inviscid_res_part_my_flux_cuda(f_x%x_d, f_y%x_d, f_z%x_d, &
658 m_x%x_d, m_y%x_d, m_z%x_d, &
659 rho_field%x_d, p%x_d, n)
660#elif HAVE_OPENCL
661 call inviscid_res_part_my_flux_opencl(f_x%x_d, f_y%x_d, f_z%x_d, &
662 m_x%x_d, m_y%x_d, m_z%x_d, &
663 rho_field%x_d, p%x_d, n)
664#elif HAVE_METAL
665 call inviscid_res_part_my_flux_metal(f_x%x_d, f_y%x_d, f_z%x_d, &
666 m_x%x_d, m_y%x_d, m_z%x_d, &
667 rho_field%x_d, p%x_d, n)
668#endif
669 call div(rhs_m_y%x_d, f_x%x_d, f_y%x_d, f_z%x_d, coef)
670 ! m_z
671#ifdef HAVE_HIP
672 call inviscid_res_part_mz_flux_hip(f_x%x_d, f_y%x_d, f_z%x_d, &
673 m_x%x_d, m_y%x_d, m_z%x_d, &
674 rho_field%x_d, p%x_d, n)
675#elif HAVE_CUDA
676 call inviscid_res_part_mz_flux_cuda(f_x%x_d, f_y%x_d, f_z%x_d, &
677 m_x%x_d, m_y%x_d, m_z%x_d, &
678 rho_field%x_d, p%x_d, n)
679#elif HAVE_OPENCL
680 call inviscid_res_part_mz_flux_opencl(f_x%x_d, f_y%x_d, f_z%x_d, &
681 m_x%x_d, m_y%x_d, m_z%x_d, &
682 rho_field%x_d, p%x_d, n)
683#elif HAVE_METAL
684 call inviscid_res_part_mz_flux_metal(f_x%x_d, f_y%x_d, f_z%x_d, &
685 m_x%x_d, m_y%x_d, m_z%x_d, &
686 rho_field%x_d, p%x_d, n)
687#endif
688 call div(rhs_m_z%x_d, f_x%x_d, f_y%x_d, f_z%x_d, coef)
689
691 ! Inviscid energy flux for both NS and monolithic paths.
692 ! Viscous energy diffusion is handled entirely by Ax(E) below.
693#ifdef HAVE_HIP
694 call inviscid_res_part_e_flux_hip(f_x%x_d, f_y%x_d, f_z%x_d, &
695 m_x%x_d, m_y%x_d, m_z%x_d, &
696 rho_field%x_d, p%x_d, e%x_d, n)
697#elif HAVE_CUDA
698 call inviscid_res_part_e_flux_cuda(f_x%x_d, f_y%x_d, f_z%x_d, &
699 m_x%x_d, m_y%x_d, m_z%x_d, &
700 rho_field%x_d, p%x_d, e%x_d, n)
701#elif HAVE_OPENCL
702 call inviscid_res_part_e_flux_opencl(f_x%x_d, f_y%x_d, f_z%x_d, &
703 m_x%x_d, m_y%x_d, m_z%x_d, &
704 rho_field%x_d, p%x_d, e%x_d, n)
705#elif HAVE_METAL
706 call inviscid_res_part_e_flux_metal(f_x%x_d, f_y%x_d, f_z%x_d, &
707 m_x%x_d, m_y%x_d, m_z%x_d, &
708 rho_field%x_d, p%x_d, e%x_d, n)
709#endif
710 call div(rhs_e%x_d, f_x%x_d, f_y%x_d, f_z%x_d, coef)
711
712 call gs%op(rhs_rho_field, gs_op_add, glb_cmd_event)
713 call rotate_cyc(rhs_m_x%x_d, rhs_m_y%x_d, rhs_m_z%x_d, 1, coef)
715 call gs%op(rhs_m_x%x, rhs_m_y%x, rhs_m_z%x, n, gs_op_add, glb_cmd_event)
716 call rotate_cyc(rhs_m_x%x_d, rhs_m_y%x_d, rhs_m_z%x_d, 0, coef)
718 call gs%op(rhs_e, gs_op_add, glb_cmd_event)
719
720#ifdef HAVE_HIP
721 call compressible_res_part_coef_mult_hip(rhs_rho_field%x_d, rhs_m_x%x_d, &
722 rhs_m_y%x_d, rhs_m_z%x_d, &
723 rhs_e%x_d, coef%mult_d, n)
724#elif HAVE_CUDA
725 call compressible_res_part_coef_mult_cuda(rhs_rho_field%x_d, rhs_m_x%x_d, &
726 rhs_m_y%x_d, rhs_m_z%x_d, &
727 rhs_e%x_d, coef%mult_d, n)
728#elif HAVE_OPENCL
729 call compressible_res_part_coef_mult_opencl(rhs_rho_field%x_d, &
730 rhs_m_x%x_d, rhs_m_y%x_d, rhs_m_z%x_d, &
731 rhs_e%x_d, coef%mult_d, n)
732#elif HAVE_METAL
733 call compressible_res_part_coef_mult_metal(rhs_rho_field%x_d, rhs_m_x%x_d, &
734 rhs_m_y%x_d, rhs_m_z%x_d, &
735 rhs_e%x_d, coef%mult_d, n)
736#endif
737
738 call neko_scratch_registry%request_field(visc_rho, temp_indices(4), .false.)
739 call neko_scratch_registry%request_field(visc_m_x, temp_indices(5), .false.)
740 call neko_scratch_registry%request_field(visc_m_y, temp_indices(6), .false.)
741 call neko_scratch_registry%request_field(visc_m_z, temp_indices(7), .false.)
742 call neko_scratch_registry%request_field(visc_e, temp_indices(8), .false.)
743
744 coef%ifh2 = .false.
745
746 ! Density, momentum and energy are all stabilized by the same
747 ! artificial viscosity. The momentum components share the operator,
748 ! so they use the fused vector apply (one kernel launch, geometric
749 ! factors and h1 are loaded once for all three components).
750 call device_copy(coef%h1_d, artificial_visc%x_d, n)
751 call ax%compute(visc_rho%x, rho_field%x, coef, p%msh, p%Xh)
752 call ax%compute_vector(visc_m_x%x, visc_m_y%x, visc_m_z%x, &
753 m_x%x, m_y%x, m_z%x, coef, p%msh, p%Xh)
754 call ax%compute(visc_e%x, e%x, coef, p%msh, p%Xh)
755
757 call add_navier_stokes_flux_device(visc_m_x, visc_m_y, visc_m_z, &
758 visc_e, rho_field, p, u, v, w, mu, kappa, ax, ax_stress, coef)
759 end if
760
762
763 call gs%op(visc_rho, gs_op_add, glb_cmd_event)
764 call rotate_cyc(visc_m_x%x_d, visc_m_y%x_d, visc_m_z%x_d, 1, coef)
766 call gs%op(visc_m_x%x, visc_m_y%x, visc_m_z%x, n, gs_op_add, glb_cmd_event)
767 call rotate_cyc(visc_m_x%x_d, visc_m_y%x_d, visc_m_z%x_d, 0, coef)
769 call gs%op(visc_e, gs_op_add, glb_cmd_event)
770
771 ! Apply artificial viscosity - the coefficient is already in the Laplacian
772 ! rhs = -rhs - Binv * visc_lap, and reset h1 to 1
773#ifdef HAVE_HIP
774 call compressible_res_part_visc_hip(rhs_rho_field%x_d, rhs_m_x%x_d, &
775 rhs_m_y%x_d, rhs_m_z%x_d, rhs_e%x_d, visc_rho%x_d, visc_m_x%x_d, &
776 visc_m_y%x_d, visc_m_z%x_d, visc_e%x_d, coef%Binv_d, coef%h1_d, n)
777#elif HAVE_CUDA
778 call compressible_res_part_visc_cuda(rhs_rho_field%x_d, rhs_m_x%x_d, &
779 rhs_m_y%x_d, rhs_m_z%x_d, rhs_e%x_d, visc_rho%x_d, visc_m_x%x_d, &
780 visc_m_y%x_d, visc_m_z%x_d, visc_e%x_d, coef%Binv_d, coef%h1_d, n)
781#elif HAVE_OPENCL
782 call compressible_res_part_visc_opencl(rhs_rho_field%x_d, rhs_m_x%x_d, &
783 rhs_m_y%x_d, rhs_m_z%x_d, rhs_e%x_d, visc_rho%x_d, visc_m_x%x_d, &
784 visc_m_y%x_d, visc_m_z%x_d, visc_e%x_d, coef%Binv_d, coef%h1_d, n)
785#elif HAVE_METAL
786 call compressible_res_part_visc_metal(rhs_rho_field%x_d, rhs_m_x%x_d, &
787 rhs_m_y%x_d, rhs_m_z%x_d, rhs_e%x_d, visc_rho%x_d, visc_m_x%x_d, &
788 visc_m_y%x_d, visc_m_z%x_d, visc_e%x_d, coef%Binv_d, coef%h1_d, n)
789#endif
790
792
793 call neko_scratch_registry%relinquish_field(temp_indices)
794
795 end subroutine evaluate_rhs_device
796
812 subroutine add_navier_stokes_flux_device(visc_m_x, visc_m_y, visc_m_z, &
813 visc_E, rho_field, p, u, v, w, mu, kappa, Ax, Ax_stress, coef)
814 type(field_t), intent(inout) :: visc_m_x, visc_m_y, visc_m_z, visc_E
815 type(field_t), intent(in) :: rho_field
816 type(field_t), intent(in) :: p, u, v, w, mu, kappa
817 class(ax_t), intent(inout) :: Ax, Ax_stress
818 type(coef_t), intent(inout) :: coef
819 type(field_t), pointer :: dudx, dudy, dudz, dvdx, dvdy, dvdz, &
820 dwdx, dwdy, dwdz, f_x, f_y, f_z, div_flux, dissipation
821 integer :: temp_indices(14)
822 integer :: n
823
824 n = coef%dof%size()
825
826 call neko_scratch_registry%request_field(dudx, temp_indices(1), .false.)
827 call neko_scratch_registry%request_field(dudy, temp_indices(2), .false.)
828 call neko_scratch_registry%request_field(dudz, temp_indices(3), .false.)
829 call neko_scratch_registry%request_field(dvdx, temp_indices(4), .false.)
830 call neko_scratch_registry%request_field(dvdy, temp_indices(5), .false.)
831 call neko_scratch_registry%request_field(dvdz, temp_indices(6), .false.)
832 call neko_scratch_registry%request_field(dwdx, temp_indices(7), .false.)
833 call neko_scratch_registry%request_field(dwdy, temp_indices(8), .false.)
834 call neko_scratch_registry%request_field(dwdz, temp_indices(9), .false.)
835 call neko_scratch_registry%request_field(f_x, temp_indices(10), .false.)
836 call neko_scratch_registry%request_field(f_y, temp_indices(11), .false.)
837 call neko_scratch_registry%request_field(f_z, temp_indices(12), .false.)
838 call neko_scratch_registry%request_field(div_flux, temp_indices(13), &
839 .false.)
840 call neko_scratch_registry%request_field(dissipation, temp_indices(14), &
841 .false.)
842
843 call grad(dudx%x_d, dudy%x_d, dudz%x_d, u%x_d, coef)
844 call grad(dvdx%x_d, dvdy%x_d, dvdz%x_d, v%x_d, coef)
845 call grad(dwdx%x_d, dwdy%x_d, dwdz%x_d, w%x_d, coef)
846
847 call compressible_ops_device_ns_flux_prepare(div_flux%x_d, &
848 dissipation%x_d, coef%h1_d, dudx%x_d, dudy%x_d, dudz%x_d, &
849 dvdx%x_d, dvdy%x_d, dvdz%x_d, dwdx%x_d, dwdy%x_d, dwdz%x_d, &
850 mu%x_d, n)
851
852 call ax_stress%compute_vector(f_x%x, f_y%x, f_z%x, u%x, v%x, w%x, &
853 coef, p%msh, p%Xh)
854 call opgrad(dudx%x, dudy%x, dudz%x, div_flux%x, coef)
856 visc_m_y%x_d, visc_m_z%x_d, visc_e%x_d, f_x%x_d, f_y%x_d, &
857 f_z%x_d, dudx%x_d, dudy%x_d, dudz%x_d, u%x_d, v%x_d, w%x_d, &
858 coef%B_d, dissipation%x_d, n)
859
860 call compressible_ops_device_ns_flux_temperature(div_flux%x_d, coef%h1_d, &
861 p%x_d, rho_field%x_d, kappa%x_d, compressible_res_device_gamma, n)
862 call ax%compute(dudx%x, div_flux%x, coef, p%msh, p%Xh)
863 call device_add2(visc_e%x_d, dudx%x_d, n)
864
865 call neko_scratch_registry%relinquish_field(temp_indices)
866
867 end subroutine add_navier_stokes_flux_device
868
void compressible_res_part_visc_opencl(void *rhs_rho, void *rhs_m_x, void *rhs_m_y, void *rhs_m_z, void *rhs_E, void *visc_rho, void *visc_m_x, void *visc_m_y, void *visc_m_z, void *visc_E, void *Binv, void *h1, int *n)
void inviscid_res_part_mz_flux_opencl(void *f_x, void *f_y, void *f_z, void *m_x, void *m_y, void *m_z, void *rho_field, void *p, int *n)
void inviscid_res_part_my_flux_opencl(void *f_x, void *f_y, void *f_z, void *m_x, void *m_y, void *m_z, void *rho_field, void *p, int *n)
void compressible_res_part_rk_sum_opencl(void *rho, void *m_x, void *m_y, void *m_z, void *E, void *k_rho_i, void *k_m_x_i, void *k_m_y_i, void *k_m_z_i, void *k_E_i, real *dt, real *c, int *n)
void compressible_res_part_coef_mult_opencl(void *rhs_rho, void *rhs_m_x, void *rhs_m_y, void *rhs_m_z, void *rhs_E, void *mult, int *n)
void inviscid_res_part_mx_flux_opencl(void *f_x, void *f_y, void *f_z, void *m_x, void *m_y, void *m_z, void *rho_field, void *p, int *n)
void inviscid_res_part_my_flux_cuda(void *f_x, void *f_y, void *f_z, void *m_x, void *m_y, void *m_z, void *rho_field, void *p, int *n)
void compressible_res_part_coef_mult_cuda(void *rhs_rho, void *rhs_m_x, void *rhs_m_y, void *rhs_m_z, void *rhs_E, void *mult, int *n)
void compressible_res_part_visc_cuda(void *rhs_rho, void *rhs_m_x, void *rhs_m_y, void *rhs_m_z, void *rhs_E, void *visc_rho, void *visc_m_x, void *visc_m_y, void *visc_m_z, void *visc_E, void *Binv, void *h1, int *n)
void compressible_res_part_rk_sum_cuda(void *rho, void *m_x, void *m_y, void *m_z, void *E, void *k_rho_i, void *k_m_x_i, void *k_m_y_i, void *k_m_z_i, void *k_E_i, real *dt, real *c, int *n)
void inviscid_res_part_mz_flux_cuda(void *f_x, void *f_y, void *f_z, void *m_x, void *m_y, void *m_z, void *rho_field, void *p, int *n)
void inviscid_res_part_mx_flux_cuda(void *f_x, void *f_y, void *f_z, void *m_x, void *m_y, void *m_z, void *rho_field, void *p, int *n)
Compute the divergence of a vector field.
Definition operators.f90:86
Compute the gradient of a scalar field, multiplied by the mass matrix.
Definition operators.f90:92
Apply cyclic boundary condition to a vector field.
Defines a Matrix-vector product.
Definition ax.f90:34
Defines a list of bc_t.
Definition bc_list.f90:34
Coefficients.
Definition coef.f90:34
Device implementation of compressible flow operations.
subroutine, public compressible_ops_device_update_uvw(u_d, v_d, w_d, m_x_d, m_y_d, m_z_d, rho_d, n)
Update u,v,w fields.
subroutine, public compressible_ops_device_ns_flux_prepare(div_flux_d, dissipation_d, h1_d, dudx_d, dudy_d, dudz_d, dvdx_d, dvdy_d, dvdz_d, dwdx_d, dwdy_d, dwdz_d, mu_d, n)
Prepare physical Navier-Stokes flux work arrays.
subroutine, public compressible_ops_device_ns_flux_finalize(visc_m_x_d, visc_m_y_d, visc_m_z_d, visc_e_d, f_x_d, f_y_d, f_z_d, opgrad_x_d, opgrad_y_d, opgrad_z_d, u_d, v_d, w_d, b_d, dissipation_d, n)
Finish physical Navier-Stokes flux assembly.
subroutine, public compressible_ops_device_update_mxyz_p_ruvw(m_x_d, m_y_d, m_z_d, p_d, ruvw_d, u_d, v_d, w_d, e_d, rho_d, gamma, n)
Update m_x, m_y, m_z, p, ruvw, fields.
subroutine, public compressible_ops_device_ns_flux_temperature(div_flux_d, h1_d, p_d, rho_d, kappa_d, gamma, n)
Prepare temperature and conductivity coefficient for energy flux.
logical, public compressible_res_device_add_physical_flux
Whether physical Navier-Stokes fluxes are active for the current step. Set by compressible_rhs_set_ph...
subroutine advance_primitive_variables_device(rho_field, m_x, m_y, m_z, e, p, u, v, w, ax, ax_stress, coef, gs, artificial_visc, mu, kappa, bcs_vel, time, rk_scheme, dt)
real(kind=rp), public compressible_res_device_gamma
Module variable to store thermodynamic parameter set by factory.
subroutine evaluate_rhs_device(rhs_rho_field, rhs_m_x, rhs_m_y, rhs_m_z, rhs_e, rho_field, m_x, m_y, m_z, e, p, u, v, w, ax, ax_stress, coef, gs, artificial_visc, mu, kappa)
logical, public compressible_res_device_add_physical_stress
Whether physical viscous stress is active for the current step. Set by compressible_rhs_set_physical_...
subroutine add_navier_stokes_flux_device(visc_m_x, visc_m_y, visc_m_z, visc_e, rho_field, p, u, v, w, mu, kappa, ax, ax_stress, coef)
Add the physical Navier-Stokes flux contribution to the viscous residual.
subroutine, public device_add2(a_d, b_d, n, strm)
Vector addition .
subroutine, public device_copy(a_d, b_d, n, strm)
Copy a vector .
Device abstraction, common interface for various accelerators.
Definition device.F90:34
subroutine, public device_event_sync(event)
Synchronize an event.
Definition device.F90:1667
type(c_ptr), bind(C), public glb_cmd_event
Event for the global command queue.
Definition device.F90:63
Defines a field.
Definition field.f90:34
Gather-scatter.
integer, parameter, public c_rp
Definition num_types.f90:15
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:14
Operators.
Definition operators.f90:34
subroutine, public opgrad(ux, uy, uz, u, coef, es, ee)
Compute the weak gradient of a scalar field, i.e. the gradient multiplied by the mass matrix.
Defines a registry for storing and requesting temporary objects This can be used when you have a func...
type(scratch_registry_t), target, public neko_scratch_registry
Global scratch registry.
Module with things related to the simulation time.
Utilities.
Definition utils.f90:35
Base type for a matrix-vector product providing .
Definition ax.f90:43
A list of allocatable `bc_t`. Follows the standard interface of lists.
Definition bc_list.f90:49
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:135
field_list_t, To be able to group fields together
Gather-scatter kernel.
A struct that contains all info about the time, expand as needed.