Neko 0.9.99
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
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
59 subroutine smagorinsky_compute_device(t, tstep, coef, nut, delta, c_s)
60 real(kind=rp), intent(in) :: t
61 integer, intent(in) :: tstep
62 type(coef_t), intent(in) :: coef
63 type(field_t), intent(inout) :: nut
64 type(field_t), intent(in) :: delta
65 real(kind=rp), intent(in) :: c_s
66 type(field_t), pointer :: u, v, w
67 ! double of the strain rate tensor
68 type(field_t), pointer :: s11, s22, s33, s12, s13, s23
69 integer :: temp_indices(6)
70 integer :: e, i
71
72 u => neko_field_registry%get_field_by_name("u")
73 v => neko_field_registry%get_field_by_name("v")
74 w => neko_field_registry%get_field_by_name("w")
75
76 call neko_scratch_registry%request_field(s11, temp_indices(1))
77 call neko_scratch_registry%request_field(s22, temp_indices(2))
78 call neko_scratch_registry%request_field(s33, temp_indices(3))
79 call neko_scratch_registry%request_field(s12, temp_indices(4))
80 call neko_scratch_registry%request_field(s13, temp_indices(5))
81 call neko_scratch_registry%request_field(s23, temp_indices(6))
82
83 ! Compute the strain rate tensor
84 call strain_rate(s11%x, s22%x, s33%x, s12%x, s13%x, s23%x, u, v, w, coef)
85
86 call coef%gs_h%op(s11, gs_op_add)
87 call coef%gs_h%op(s22, gs_op_add)
88 call coef%gs_h%op(s33, gs_op_add)
89 call coef%gs_h%op(s12, gs_op_add)
90 call coef%gs_h%op(s13, gs_op_add)
91 call coef%gs_h%op(s23, gs_op_add)
92
93 call device_smagorinsky_nut_compute(s11%x_d, s22%x_d, s33%x_d, &
94 s12%x_d, s13%x_d, s23%x_d, &
95 delta%x_d, nut%x_d, coef%mult_d, &
96 c_s, s11%dof%size())
97
98 call coef%gs_h%op(nut, gs_op_add)
99 call device_col2(nut%x_d, coef%mult_d, nut%dof%size())
100
101 call neko_scratch_registry%relinquish_field(temp_indices)
102 end subroutine smagorinsky_compute_device
103
104end module smagorinsky_device
105
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(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