Neko 0.9.99
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
device_smagorinsky_nut.F90
Go to the documentation of this file.
1! Copyright (c) 2024, 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!
34 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
35 use num_types, only: rp, c_rp
36 use utils, only: neko_error
38 use mpi_f08, only: mpi_sum, mpi_in_place, mpi_allreduce
39
40 implicit none
41 private
42
43#ifdef HAVE_HIP
44 interface
45 subroutine hip_smagorinsky_nut_compute(s11_d, s22_d, s33_d, &
46 s12_d, s13_d, s23_d, &
47 delta_d, nut_d, mult_d, c_s, n) &
48 bind(c, name = 'hip_smagorinsky_nut_compute')
49 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
50 import c_rp
51 type(c_ptr), value :: s11_d, s22_d, s33_d, &
52 s12_d, s13_d, s23_d, &
53 delta_d, nut_d, mult_d
54 integer(c_int) :: n
55 real(c_rp) :: c_s
56 end subroutine hip_smagorinsky_nut_compute
57 end interface
58#elif HAVE_CUDA
59 interface
60 subroutine cuda_smagorinsky_nut_compute(s11_d, s22_d, s33_d, &
61 s12_d, s13_d, s23_d, &
62 delta_d, nut_d, mult_d, c_s, n) &
63 bind(c, name = 'cuda_smagorinsky_nut_compute')
64 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
65 import c_rp
66 type(c_ptr), value :: s11_d, s22_d, s33_d, &
67 s12_d, s13_d, s23_d, &
68 delta_d, nut_d, mult_d
69 integer(c_int) :: n
70 real(c_rp) :: c_s
71 end subroutine cuda_smagorinsky_nut_compute
72 end interface
73#elif HAVE_OPENCL
74#endif
75
77
78contains
79
81 subroutine device_smagorinsky_nut_compute(s11_d, s22_d, s33_d, &
82 s12_d, s13_d, s23_d, &
83 delta_d, nut_d, mult_d, c_s, n)
84 type(c_ptr) :: s11_d, s22_d, s33_d, &
85 s12_d, s13_d, s23_d, &
86 delta_d, nut_d, mult_d
87 integer :: n
88 real(kind=rp) :: c_s
89#if HAVE_HIP
90 call hip_smagorinsky_nut_compute(s11_d, s22_d, s33_d, &
91 s12_d, s13_d, s23_d, &
92 delta_d, nut_d, mult_d, c_s, n)
93#elif HAVE_CUDA
94 call cuda_smagorinsky_nut_compute(s11_d, s22_d, s33_d, &
95 s12_d, s13_d, s23_d, &
96 delta_d, nut_d, mult_d, c_s, n)
97#elif HAVE_OPENCL
98 call neko_error('opencl backend is not supported for device_smagorinsky_nut')
99#else
100 call neko_error('no device backend configured')
101#endif
102 end subroutine device_smagorinsky_nut_compute
103
104
105end module device_smagorinsky_nut
Definition comm.F90:1
type(mpi_comm) neko_comm
MPI communicator.
Definition comm.F90:16
type(mpi_datatype) mpi_real_precision
MPI type for working precision of REAL types.
Definition comm.F90:23
integer pe_size
MPI size of communicator.
Definition comm.F90:31
subroutine, public device_smagorinsky_nut_compute(s11_d, s22_d, s33_d, s12_d, s13_d, s23_d, delta_d, nut_d, mult_d, c_s, n)
Compute the eddy viscosity field for the Sigma model indevice.
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
void cuda_smagorinsky_nut_compute(void *s11, void *s22, void *s33, void *s12, void *s13, void *s23, void *delta, void *nut, void *mult, real *c_s, int *n)