Neko 1.99.3
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
42 use registry, only : neko_registry
47 use logger, only : log_size, neko_log
48 implicit none
49 private
50
55 type, public, extends(wall_model_t) :: rough_log_law_t
56
58 real(kind=rp) :: kappa = 0.41_rp
60 real(kind=rp) :: b = 0.0_rp
62 real(kind=rp) :: z0 = 0.0_rp
63 contains
65 procedure, pass(this) :: init => rough_log_law_init
68 procedure, pass(this) :: partial_init => rough_log_law_partial_init
70 procedure, pass(this) :: finalize => rough_log_law_finalize
72 procedure, pass(this) :: init_from_components => &
75 procedure, pass(this) :: free => rough_log_law_free
77 procedure, pass(this) :: compute => rough_log_law_compute
78 end type rough_log_law_t
79
80contains
88 subroutine rough_log_law_init(this, scheme_name, coef, msk, facet, &
89 h_index, json)
90 class(rough_log_law_t), intent(inout) :: this
91 character(len=*), intent(in) :: scheme_name
92 type(coef_t), intent(in) :: coef
93 integer, intent(in) :: msk(:)
94 integer, intent(in) :: facet(:)
95 integer, intent(in) :: h_index
96 type(json_file), intent(inout) :: json
97 real(kind=rp) :: kappa, b, z0
98
99 call json_get_or_lookup(json, "kappa", kappa)
100 call json_get_or_lookup(json, "B", b)
101 call json_get_or_lookup(json, "z0", z0)
102
103 call this%init_from_components(scheme_name, coef, msk, facet, h_index, &
104 kappa, b, z0)
105 end subroutine rough_log_law_init
106
110 subroutine rough_log_law_partial_init(this, coef, json)
111 class(rough_log_law_t), intent(inout) :: this
112 type(coef_t), intent(in) :: coef
113 type(json_file), intent(inout) :: json
114 character(len=LOG_SIZE) :: log_buf
115
116 call this%partial_init_base(coef, json)
117 call json_get_or_lookup(json, "kappa", this%kappa)
118 call json_get_or_lookup(json, "B", this%B)
119 call json_get_or_lookup(json, "z0", this%z0)
120
121 call neko_log%section('Wall model')
122 write(log_buf, '(A)') 'Model : Rough log law'
123 call neko_log%message(log_buf)
124 write(log_buf, '(A, E15.7)') 'kappa : ', this%kappa
125 call neko_log%message(log_buf)
126 write(log_buf, '(A, E15.7)') 'B : ', this%B
127 call neko_log%message(log_buf)
128 write(log_buf, '(A, E15.7)') 'z0 : ', this%z0
129 call neko_log%message(log_buf)
130 call neko_log%end_section()
131
132 end subroutine rough_log_law_partial_init
133
137 subroutine rough_log_law_finalize(this, msk, facet)
138 class(rough_log_law_t), intent(inout) :: this
139 integer, intent(in) :: msk(:)
140 integer, intent(in) :: facet(:)
141
142 call this%finalize_base(msk, facet)
143
144 end subroutine rough_log_law_finalize
145
155 subroutine rough_log_law_init_from_components(this, scheme_name, coef, msk, &
156 facet, h_index, kappa, B, z0)
157 class(rough_log_law_t), intent(inout) :: this
158 character(len=*), intent(in) :: scheme_name
159 type(coef_t), intent(in) :: coef
160 integer, intent(in) :: msk(:)
161 integer, intent(in) :: facet(:)
162 integer, intent(in) :: h_index
163 real(kind=rp), intent(in) :: kappa
164 real(kind=rp), intent(in) :: b
165 real(kind=rp), intent(in) :: z0
166
167 call this%init_base(scheme_name, coef, msk, facet, h_index)
168
169 this%kappa = kappa
170 this%B = b
171 this%z0 = z0
172
174
176 subroutine rough_log_law_free(this)
177 class(rough_log_law_t), intent(inout) :: this
178
179 call this%free_base()
180
181 end subroutine rough_log_law_free
182
186 subroutine rough_log_law_compute(this, t, tstep)
187 class(rough_log_law_t), intent(inout) :: this
188 real(kind=rp), intent(in) :: t
189 integer, intent(in) :: tstep
190 type(field_t), pointer :: u
191 type(field_t), pointer :: v
192 type(field_t), pointer :: w
193 integer :: i
194 real(kind=rp) :: ui, vi, wi, magu, utau, normu
195
196 u => neko_registry%get_field("u")
197 v => neko_registry%get_field("v")
198 w => neko_registry%get_field("w")
199
200 if (neko_bcknd_device .eq. 1) then
201 call rough_log_law_compute_device(u%x_d, v%x_d, w%x_d, this%ind_r_d, &
202 this%ind_s_d, this%ind_t_d, this%ind_e_d, &
203 this%n_x%x_d, this%n_y%x_d, this%n_z%x_d, &
204 this%h%x_d, this%tau_x%x_d, this%tau_y%x_d, &
205 this%tau_z%x_d, this%n_nodes, u%Xh%lx, this%kappa, &
206 this%B, this%z0, tstep)
207 else
208 call rough_log_law_compute_cpu(u%x, v%x, w%x, this%ind_r, this%ind_s, &
209 this%ind_t, this%ind_e, this%n_x%x, this%n_y%x, this%n_z%x, &
210 this%h%x, this%tau_x%x, this%tau_y%x, this%tau_z%x, &
211 this%n_nodes, u%Xh%lx, u%msh%nelv, this%kappa, &
212 this%B, this%z0, tstep)
213 end if
214
215 end subroutine rough_log_law_compute
216
217
218end 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)
Coefficients.
Definition coef.f90:34
Defines a field.
Definition field.f90:34
Utilities for retrieving parameters from the case files.
Logging routines.
Definition log.f90:34
type(log_t), public neko_log
Global log stream.
Definition log.f90:79
integer, parameter, public log_size
Definition log.f90:45
Build configurations.
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Defines a registry for storing solution fields.
Definition registry.f90:34
type(registry_t), target, public neko_registry
Global field registry.
Definition registry.f90:144
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 objects This can be used when you have a func...
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:62
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.