Loading [MathJax]/extensions/tex2jax.js
Neko 0.9.99
A portable framework for high-order spectral element flow simulations
All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Pages
smagorinsky_device.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!
35 use num_types, only : rp
36 use field_list, only : field_list_t
39 use field, only : field_t
40 use operators, only : strain_rate
41 use coefs, only : coef_t
42 use gs_ops, only : gs_op_add
43 use device_math, only : device_col2
45 implicit none
46 private
47
49
50contains
51
60 subroutine smagorinsky_compute_device(if_ext, t, tstep, coef, nut, delta, c_s)
61 logical, intent(in) :: if_ext
62 real(kind=rp), intent(in) :: t
63 integer, intent(in) :: tstep
64 type(coef_t), intent(in) :: coef
65 type(field_t), intent(inout) :: nut
66 type(field_t), intent(in) :: delta
67 real(kind=rp), intent(in) :: c_s
68 type(field_t), pointer :: u, v, w
69 ! double of the strain rate tensor
70 type(field_t), pointer :: s11, s22, s33, s12, s13, s23
71 integer :: temp_indices(6)
72 integer :: e, i
73
74 if (if_ext .eqv. .true.) then
75 u => neko_field_registry%get_field_by_name("u_e")
76 v => neko_field_registry%get_field_by_name("v_e")
77 w => neko_field_registry%get_field_by_name("w_e")
78 else
79 u => neko_field_registry%get_field_by_name("u")
80 v => neko_field_registry%get_field_by_name("v")
81 w => neko_field_registry%get_field_by_name("w")
82 end if
83
84 call neko_scratch_registry%request_field(s11, temp_indices(1))
85 call neko_scratch_registry%request_field(s22, temp_indices(2))
86 call neko_scratch_registry%request_field(s33, temp_indices(3))
87 call neko_scratch_registry%request_field(s12, temp_indices(4))
88 call neko_scratch_registry%request_field(s13, temp_indices(5))
89 call neko_scratch_registry%request_field(s23, temp_indices(6))
90
91 ! Compute the strain rate tensor
92 call strain_rate(s11%x, s22%x, s33%x, s12%x, s13%x, s23%x, u, v, w, coef)
93
94 call coef%gs_h%op(s11, gs_op_add)
95 call coef%gs_h%op(s22, gs_op_add)
96 call coef%gs_h%op(s33, gs_op_add)
97 call coef%gs_h%op(s12, gs_op_add)
98 call coef%gs_h%op(s13, gs_op_add)
99 call coef%gs_h%op(s23, gs_op_add)
100
101 call device_smagorinsky_nut_compute(s11%x_d, s22%x_d, s33%x_d, &
102 s12%x_d, s13%x_d, s23%x_d, &
103 delta%x_d, nut%x_d, coef%mult_d, &
104 c_s, s11%dof%size())
105
106 call coef%gs_h%op(nut, gs_op_add)
107 call device_col2(nut%x_d, coef%mult_d, nut%dof%size())
108
109 call neko_scratch_registry%relinquish_field(temp_indices)
110 end subroutine smagorinsky_compute_device
111
112end module smagorinsky_device
113
Coefficients.
Definition coef.f90:34
subroutine, public device_col2(a_d, b_d, n)
Vector multiplication .
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.
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
Defines Gather-scatter operations.
Definition gs_ops.f90:34
integer, parameter, public gs_op_add
Definition gs_ops.f90:36
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Operators.
Definition operators.f90:34
subroutine, public strain_rate(s11, s22, s33, s12, s13, s23, u, v, w, coef)
Compute the strain rate tensor, i.e 0.5 * du_i/dx_j + du_j/dx_i.
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 the device kernel for the smagorinsky_t type.
subroutine, public smagorinsky_compute_device(if_ext, t, tstep, coef, nut, delta, c_s)
Compute eddy viscosity on the device.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:55
field_list_t, To be able to group fields together