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
vreman_device.f90
Go to the documentation of this file.
1! Copyright (c) 2023-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 math, only : neko_eps
39 use field, only : field_t
40 use operators, only : dudxyz
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
48 public :: vreman_compute_device
49
50contains
51
60 subroutine vreman_compute_device(if_ext, t, tstep, coef, nut, delta, c)
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
68 ! This is the alpha tensor in the paper
69 type(field_t), pointer :: a11, a12, a13, a21, a22, a23, a31, a32, a33
70 type(field_t), pointer :: u, v, w
71
72 type(field_t), pointer :: beta11
73 type(field_t), pointer :: beta12
74 type(field_t), pointer :: beta13
75 type(field_t), pointer :: beta22
76 type(field_t), pointer :: beta23
77 type(field_t), pointer :: beta33
78 type(field_t), pointer :: b_beta
79 type(field_t), pointer :: aijaij
80 integer :: temp_indices(17)
81 integer :: e, i
82
83 if (if_ext .eqv. .true.) then
84 u => neko_field_registry%get_field_by_name("u_e")
85 v => neko_field_registry%get_field_by_name("v_e")
86 w => neko_field_registry%get_field_by_name("w_e")
87 else
88 u => neko_field_registry%get_field_by_name("u")
89 v => neko_field_registry%get_field_by_name("v")
90 w => neko_field_registry%get_field_by_name("w")
91 end if
92
93 call neko_scratch_registry%request_field(a11, temp_indices(1))
94 call neko_scratch_registry%request_field(a12, temp_indices(2))
95 call neko_scratch_registry%request_field(a13, temp_indices(3))
96 call neko_scratch_registry%request_field(a21, temp_indices(4))
97 call neko_scratch_registry%request_field(a22, temp_indices(5))
98 call neko_scratch_registry%request_field(a23, temp_indices(6))
99 call neko_scratch_registry%request_field(a31, temp_indices(7))
100 call neko_scratch_registry%request_field(a32, temp_indices(8))
101 call neko_scratch_registry%request_field(a33, temp_indices(9))
102 call neko_scratch_registry%request_field(beta11, temp_indices(10))
103 call neko_scratch_registry%request_field(beta12, temp_indices(11))
104 call neko_scratch_registry%request_field(beta13, temp_indices(12))
105 call neko_scratch_registry%request_field(beta22, temp_indices(13))
106 call neko_scratch_registry%request_field(beta23, temp_indices(14))
107 call neko_scratch_registry%request_field(beta33, temp_indices(15))
108 call neko_scratch_registry%request_field(b_beta, temp_indices(16))
109 call neko_scratch_registry%request_field(aijaij, temp_indices(17))
110
111
112 ! Compute the derivatives of the velocity (the alpha tensor)
113 call dudxyz (a11%x, u%x, coef%drdx, coef%dsdx, coef%dtdx, coef)
114 call dudxyz (a12%x, u%x, coef%drdy, coef%dsdy, coef%dtdy, coef)
115 call dudxyz (a13%x, u%x, coef%drdz, coef%dsdz, coef%dtdz, coef)
116
117 call dudxyz (a21%x, v%x, coef%drdx, coef%dsdx, coef%dtdx, coef)
118 call dudxyz (a22%x, v%x, coef%drdy, coef%dsdy, coef%dtdy, coef)
119 call dudxyz (a23%x, v%x, coef%drdz, coef%dsdz, coef%dtdz, coef)
120
121 call dudxyz (a31%x, w%x, coef%drdx, coef%dsdx, coef%dtdx, coef)
122 call dudxyz (a32%x, w%x, coef%drdy, coef%dsdy, coef%dtdy, coef)
123 call dudxyz (a33%x, w%x, coef%drdz, coef%dsdz, coef%dtdz, coef)
124
125 call coef%gs_h%op(a11, gs_op_add)
126 call coef%gs_h%op(a12, gs_op_add)
127 call coef%gs_h%op(a13, gs_op_add)
128 call coef%gs_h%op(a21, gs_op_add)
129 call coef%gs_h%op(a22, gs_op_add)
130 call coef%gs_h%op(a23, gs_op_add)
131 call coef%gs_h%op(a31, gs_op_add)
132 call coef%gs_h%op(a32, gs_op_add)
133 call coef%gs_h%op(a33, gs_op_add)
134
135 call device_vreman_nut_compute(a11%x_d, a12%x_d, a13%x_d, &
136 a21%x_d, a22%x_d, a23%x_d, &
137 a31%x_d, a32%x_d, a33%x_d, &
138 delta%x_d, nut%x_d, coef%mult_d, &
139 c, neko_eps, a11%dof%size())
140
141 call coef%gs_h%op(nut, gs_op_add)
142 call device_col2(nut%x_d, coef%mult_d, nut%dof%size())
143
144 call neko_scratch_registry%relinquish_field(temp_indices)
145 end subroutine vreman_compute_device
146
147end module vreman_device
148
Coefficients.
Definition coef.f90:34
subroutine, public device_col2(a_d, b_d, n)
Vector multiplication .
subroutine, public device_vreman_nut_compute(a11_d, a12_d, a13_d, a21_d, a22_d, a23_d, a31_d, a32_d, a33_d, delta_d, nut_d, mult_d, c, eps, 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
Definition math.f90:60
real(kind=rp), parameter, public neko_eps
Machine epsilon .
Definition math.f90:69
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Operators.
Definition operators.f90:34
subroutine, public dudxyz(du, u, dr, ds, dt, coef)
Compute derivative of a scalar field along a single direction.
Definition operators.f90:78
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 vreman_t type.
subroutine, public vreman_compute_device(if_ext, t, tstep, coef, nut, delta, c)
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