Neko 1.99.1
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
rough_log_law.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!
33!
36 use field, only: field_t
37 use num_types, only : rp
38 use json_module, only : json_file
39 use coefs, only : coef_t
41 use wall_model, only : wall_model_t
47 implicit none
48 private
49
54 type, public, extends(wall_model_t) :: rough_log_law_t
55
57 real(kind=rp) :: kappa = 0.41_rp
59 real(kind=rp) :: b = 0.0_rp
61 real(kind=rp) :: z0 = 0.0_rp
62 contains
64 procedure, pass(this) :: init => rough_log_law_init
67 procedure, pass(this) :: partial_init => rough_log_law_partial_init
69 procedure, pass(this) :: finalize => rough_log_law_finalize
71 procedure, pass(this) :: init_from_components => &
74 procedure, pass(this) :: free => rough_log_law_free
76 procedure, pass(this) :: compute => rough_log_law_compute
77 end type rough_log_law_t
78
79contains
87 subroutine rough_log_law_init(this, scheme_name, coef, msk, facet, &
88 h_index, json)
89 class(rough_log_law_t), intent(inout) :: this
90 character(len=*), intent(in) :: scheme_name
91 type(coef_t), intent(in) :: coef
92 integer, intent(in) :: msk(:)
93 integer, intent(in) :: facet(:)
94 integer, intent(in) :: h_index
95 type(json_file), intent(inout) :: json
96 real(kind=rp) :: kappa, b, z0
97
98 call json_get_or_default(json, "kappa", kappa, 0.41_rp)
99 call json_get(json, "B", b)
100 call json_get(json, "z0", z0)
101
102 call this%init_from_components(scheme_name, coef, msk, facet, h_index, &
103 kappa, b, z0)
104 end subroutine rough_log_law_init
105
109 subroutine rough_log_law_partial_init(this, coef, json)
110 class(rough_log_law_t), intent(inout) :: this
111 type(coef_t), intent(in) :: coef
112 type(json_file), intent(inout) :: json
113
114 call this%partial_init_base(coef, json)
115 call json_get_or_default(json, "kappa", this%kappa, 0.41_rp)
116 call json_get(json, "B", this%B)
117 call json_get(json, "z0", this%z0)
118
119 end subroutine rough_log_law_partial_init
120
124 subroutine rough_log_law_finalize(this, msk, facet)
125 class(rough_log_law_t), intent(inout) :: this
126 integer, intent(in) :: msk(:)
127 integer, intent(in) :: facet(:)
128
129 call this%finalize_base(msk, facet)
130
131 end subroutine rough_log_law_finalize
132
142 subroutine rough_log_law_init_from_components(this, scheme_name, coef, msk, &
143 facet, h_index, kappa, B, z0)
144 class(rough_log_law_t), intent(inout) :: this
145 character(len=*), intent(in) :: scheme_name
146 type(coef_t), intent(in) :: coef
147 integer, intent(in) :: msk(:)
148 integer, intent(in) :: facet(:)
149 integer, intent(in) :: h_index
150 real(kind=rp), intent(in) :: kappa
151 real(kind=rp), intent(in) :: b
152 real(kind=rp), intent(in) :: z0
153
154 call this%init_base(scheme_name, coef, msk, facet, h_index)
155
156 this%kappa = kappa
157 this%B = b
158 this%z0 = z0
159
161
163 subroutine rough_log_law_free(this)
164 class(rough_log_law_t), intent(inout) :: this
165
166 call this%free_base()
167
168 end subroutine rough_log_law_free
169
173 subroutine rough_log_law_compute(this, t, tstep)
174 class(rough_log_law_t), intent(inout) :: this
175 real(kind=rp), intent(in) :: t
176 integer, intent(in) :: tstep
177 type(field_t), pointer :: u
178 type(field_t), pointer :: v
179 type(field_t), pointer :: w
180 integer :: i
181 real(kind=rp) :: ui, vi, wi, magu, utau, normu
182
183 u => neko_field_registry%get_field("u")
184 v => neko_field_registry%get_field("v")
185 w => neko_field_registry%get_field("w")
186
187 if (neko_bcknd_device .eq. 1) then
188 call rough_log_law_compute_device(u%x_d, v%x_d, w%x_d, this%ind_r_d, &
189 this%ind_s_d, this%ind_t_d, this%ind_e_d, &
190 this%n_x%x_d, this%n_y%x_d, this%n_z%x_d, &
191 this%h%x_d, this%tau_x%x_d, this%tau_y%x_d, &
192 this%tau_z%x_d, this%n_nodes, u%Xh%lx, this%kappa, &
193 this%B, this%z0, tstep)
194 else
195 call rough_log_law_compute_cpu(u%x, v%x, w%x, this%ind_r, this%ind_s, &
196 this%ind_t, this%ind_e, this%n_x%x, this%n_y%x, this%n_z%x, &
197 this%h%x, this%tau_x%x, this%tau_y%x, this%tau_z%x, &
198 this%n_nodes, u%Xh%lx, u%msh%nelv, this%kappa, &
199 this%B, this%z0, tstep)
200 end if
201
202 end subroutine rough_log_law_compute
203
204
205end module rough_log_law
__global__ void rough_log_law_compute(const T *__restrict__ u_d, const T *__restrict__ v_d, const T *__restrict__ w_d, const int *__restrict__ ind_r_d, const int *__restrict__ ind_s_d, const int *__restrict__ ind_t_d, const int *__restrict__ ind_e_d, const T *__restrict__ n_x_d, const T *__restrict__ n_y_d, const T *__restrict__ n_z_d, const T *__restrict__ h_d, T *__restrict__ tau_x_d, T *__restrict__ tau_y_d, T *__restrict__ tau_z_d, const int n_nodes, const int lx, const T kappa, const T B, const T z0)
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
Coefficients.
Definition coef.f90:34
Defines a registry for storing solution fields.
type(field_registry_t), target, public neko_field_registry
Global field registry.
Defines a field.
Definition field.f90:34
Utilities for retrieving parameters from the case files.
Build configurations.
integer, parameter neko_bcknd_device
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.
Implements the device kernel for the rough_log_law_t type.
subroutine, public rough_log_law_compute_device(u_d, v_d, w_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, b, z0, tstep)
Compute the wall shear stress on device using the rough log-law model.
Implements rough_log_law_t.
subroutine rough_log_law_init_from_components(this, scheme_name, coef, msk, facet, h_index, kappa, b, z0)
Constructor from components.
subroutine rough_log_law_finalize(this, msk, facet)
Finalize the construction using the mask and facet arrays of the bc.
subroutine rough_log_law_init(this, scheme_name, coef, msk, facet, h_index, json)
Constructor from JSON.
subroutine rough_log_law_partial_init(this, coef, json)
Constructor from JSON.
subroutine rough_log_law_free(this)
Destructor for the rough_log_law_t (base) class.
Defines a registry for storing and requesting temporary fields This can be used when you have a funct...
type(scratch_registry_t), target, public neko_scratch_registry
Global scratch registry.
Implements wall_model_t.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:55
Wall model based on the log-law for a rough wall. The formula defining the law is ....
Base abstract type for wall-stress models for wall-modelled LES.