Neko 1.99.1
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
rough_log_law_cpu.f90
Go to the documentation of this file.
1! Copyright (c) 2025, 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 num_types, only : rp
36 implicit none
37 private
38
40
41contains
44 subroutine rough_log_law_compute_cpu(u, v, w, ind_r, ind_s, ind_t, ind_e, &
45 n_x, n_y, n_z, h, tau_x, tau_y, tau_z, n_nodes, lx, nelv, &
46 kappa, B, z0, tstep)
47 integer, intent(in) :: n_nodes, lx, nelv, tstep
48 real(kind=rp), dimension(lx, lx, lx, nelv), intent(in) :: u, v, w
49 integer, intent(in), dimension(n_nodes) :: ind_r, ind_s, ind_t, ind_e
50 real(kind=rp), dimension(n_nodes), intent(in) :: n_x, n_y, n_z, h
51 real(kind=rp), intent(in) :: kappa, b, z0
52 real(kind=rp), dimension(n_nodes), intent(inout) :: tau_x, tau_y, tau_z
53 integer :: i
54 real(kind=rp) :: ui, vi, wi, magu, utau, normu
55
56 do i=1, n_nodes
57 ! Sample the velocity
58 ui = u(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
59 vi = v(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
60 wi = w(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
61
62 ! Project on tangential direction
63 normu = ui * n_x(i) + vi * n_y(i) + wi * n_z(i)
64
65 ui = ui - normu * n_x(i)
66 vi = vi - normu * n_y(i)
67 wi = wi - normu * n_z(i)
68
69 magu = sqrt(ui**2 + vi**2 + wi**2)
70
71 ! Compute the wall shear stress using the rough log-law
72 if (h(i) > z0) then
73 utau = (magu - b) * kappa / log(h(i) / z0)
74 else
75 utau = 0.0_rp
76 end if
77
78 ! Distribute according to the velocity vector
79 tau_x(i) = -utau**2 * ui / magu
80 tau_y(i) = -utau**2 * vi / magu
81 tau_z(i) = -utau**2 * wi / magu
82 end do
83
84 end subroutine rough_log_law_compute_cpu
85
86end module rough_log_law_cpu
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Implements the CPU kernel for the rough_log_law_t type.
subroutine, public rough_log_law_compute_cpu(u, v, w, ind_r, ind_s, ind_t, ind_e, n_x, n_y, n_z, h, tau_x, tau_y, tau_z, n_nodes, lx, nelv, kappa, b, z0, tstep)
Compute the wall shear stress on CPU using the rough log-law model.