Neko 1.99.3
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
cai_sagaut_model_ii_cpu.f90
Go to the documentation of this file.
1! Copyright (c) 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 num_types, only : rp
36 use math, only : lambert_w0, neko_eps
37 implicit none
38 private
39
41
42contains
67 subroutine cai_sagaut_model_ii_compute_cpu(u, v, w, ind_r, ind_s, ind_t, &
68 ind_e, n_x, n_y, n_z, nu, rho_w, h, tau_x, tau_y, tau_z, n_nodes, &
69 lx, nelv, kappa, B, p, s)
70 integer, intent(in) :: n_nodes, lx, nelv
71 real(kind=rp), dimension(lx, lx, lx, nelv), intent(in) :: u, v, w
72 real(kind=rp), dimension(n_nodes), intent(in) :: rho_w
73 integer, intent(in), dimension(n_nodes) :: ind_r, ind_s, ind_t, ind_e
74 real(kind=rp), dimension(n_nodes), intent(in) :: n_x, n_y, n_z, h, nu
75 real(kind=rp), dimension(n_nodes), intent(out) :: tau_x, tau_y, tau_z
76 real(kind=rp), intent(in) :: kappa, b, p, s
77 integer :: i
78 real(kind=rp) :: ui, vi, wi, magu, utau, normu, rho
79 real(kind=rp) :: rey, e_const, blend, up, warg
80
81 e_const = exp(kappa * b)
82
83 do i = 1, n_nodes
84 ui = u(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
85 vi = v(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
86 wi = w(ind_r(i), ind_s(i), ind_t(i), ind_e(i))
87 rho = rho_w(i)
88
89 normu = ui * n_x(i) + vi * n_y(i) + wi * n_z(i)
90
91 ui = ui - normu * n_x(i)
92 vi = vi - normu * n_y(i)
93 wi = wi - normu * n_z(i)
94
95 magu = sqrt(ui**2 + vi**2 + wi**2)
96
97 if (magu < neko_eps) then
98 tau_x(i) = 0.0_rp
99 tau_y(i) = 0.0_rp
100 tau_z(i) = 0.0_rp
101 cycle
102 end if
103
104 rey = magu * h(i) / nu(i)
105 blend = exp(-((rey / s) ** p))
106 warg = kappa * e_const * rey
107 up = blend * sqrt(rey) + (1.0_rp - blend) * lambert_w0(warg, 1) / kappa
108 utau = magu / (up + neko_eps)
109
110 tau_x(i) = -rho * utau**2 * ui / (magu + neko_eps)
111 tau_y(i) = -rho * utau**2 * vi / (magu + neko_eps)
112 tau_z(i) = -rho * utau**2 * wi / (magu + neko_eps)
113 end do
115
CPU backend for cai_sagaut_model_ii_t.
subroutine, public cai_sagaut_model_ii_compute_cpu(u, v, w, ind_r, ind_s, ind_t, ind_e, n_x, n_y, n_z, nu, rho_w, h, tau_x, tau_y, tau_z, n_nodes, lx, nelv, kappa, b, p, s)
Evaluate wall shear stresses with the CPU Model-II kernel.
Definition math.f90:60
real(kind=rp), parameter, public neko_eps
Machine epsilon .
Definition math.f90:70
pure real(kind=rp) function, public lambert_w0(x, niter)
Approximate the principal real branch of the Lambert W function for non-negative real x.
Definition math.f90:212
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12