Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
ax_helm_svv_one_sided_cpu.f90
Go to the documentation of this file.
1! Copyright (c) 2026, 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 disclaimer
13! in the documentation and/or other materials provided with the
14! distribution.
15!
16! * Neither the name of the authors nor the names of its contributors may
17! be used to endorse or promote products derived from this software
18! without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30! POSSIBILITY OF SUCH DAMAGE.
31!
34 use ax_helm_svv, only : ax_helm_svv_t
35 use num_types, only : rp
36 use coefs, only : coef_t
37 use space, only : space_t
38 use mesh, only : mesh_t
39 use math, only : addcol4
40 use tensor, only : tnsr3d_el
41 implicit none
42 private
43
46 contains
47 procedure, pass(this) :: compute => ax_helm_svv_one_sided_compute
49
50contains
51
59 subroutine ax_helm_svv_one_sided_compute(this, w, u, coef, msh, Xh)
60 class(ax_helm_svv_one_sided_cpu_t), intent(in) :: this
61 type(mesh_t), intent(in) :: msh
62 type(space_t), intent(in) :: Xh
63 type(coef_t), intent(in) :: coef
64 real(kind=rp), intent(inout) :: w(xh%lx, xh%ly, xh%lz, msh%nelv)
65 real(kind=rp), intent(in) :: u(xh%lx, xh%ly, xh%lz, msh%nelv)
66
67 call ax_helm_svv_one_sided_lx(w, u, xh%dx, xh%dy, xh%dz, xh%dxt, xh%dyt, &
68 xh%dzt, coef%h1, coef%drdx, coef%drdy, coef%drdz, coef%dsdx, &
69 coef%dsdy, coef%dsdz, coef%dtdx, coef%dtdy, coef%dtdz, &
70 coef%jacinv, xh%w3, this%svv%h1, this%svv%filter%fh, &
71 this%svv%filter%fht, this%svv%direction, this%svv%ident, &
72 msh%nelv, xh%lx)
73
74 if (coef%ifh2) then
75 call addcol4(w, coef%h2, coef%B, u, coef%dof%size())
76 end if
78
107 subroutine ax_helm_svv_one_sided_lx(w, u, Dx, Dy, Dz, Dxt, Dyt, Dzt, &
108 h1, drdx, drdy, drdz, dsdx, dsdy, dsdz, dtdx, dtdy, dtdz, &
109 jacinv, weights3, svv_h1, svv_F, svv_Ft, svv_direction, ident, n, lx)
110 integer, intent(in) :: n, lx
111 real(kind=rp), intent(inout) :: w(lx, lx, lx, n)
112 real(kind=rp), intent(in) :: u(lx, lx, lx, n)
113 real(kind=rp), intent(in) :: h1(lx, lx, lx, n)
114 real(kind=rp), intent(in) :: drdx(lx, lx, lx, n)
115 real(kind=rp), intent(in) :: drdy(lx, lx, lx, n)
116 real(kind=rp), intent(in) :: drdz(lx, lx, lx, n)
117 real(kind=rp), intent(in) :: dsdx(lx, lx, lx, n)
118 real(kind=rp), intent(in) :: dsdy(lx, lx, lx, n)
119 real(kind=rp), intent(in) :: dsdz(lx, lx, lx, n)
120 real(kind=rp), intent(in) :: dtdx(lx, lx, lx, n)
121 real(kind=rp), intent(in) :: dtdy(lx, lx, lx, n)
122 real(kind=rp), intent(in) :: dtdz(lx, lx, lx, n)
123 real(kind=rp), intent(in) :: jacinv(lx, lx, lx, n)
124 real(kind=rp), intent(in) :: weights3(lx, lx, lx)
125 real(kind=rp), intent(in) :: dx(lx,lx), dy(lx,lx), dz(lx,lx)
126 real(kind=rp), intent(in) :: dxt(lx,lx), dyt(lx,lx), dzt(lx,lx)
127 real(kind=rp), intent(in) :: svv_h1(lx, lx, lx, n)
128 real(kind=rp), intent(in) :: svv_f(lx, lx), svv_ft(lx, lx)
129 real(kind=rp), intent(in) :: ident(lx, lx)
130 character(len=*), intent(in) :: svv_direction
131 real(kind=rp) :: u1(lx, lx, lx), u2(lx, lx, lx), u3(lx, lx, lx)
132 real(kind=rp) :: u1_svv(lx, lx, lx), u2_svv(lx, lx, lx)
133 real(kind=rp) :: u3_svv(lx, lx, lx)
134 real(kind=rp) :: wur(lx, lx, lx), wus(lx, lx, lx), wut(lx, lx, lx)
135 real(kind=rp) :: filter_r(lx, lx), filter_s(lx, lx), filter_t(lx, lx)
136 real(kind=rp) :: ur_h, us_h, ut_h, tmp
137 integer :: e, i, j, k, l
138
139 if (index(svv_direction, "r") > 0) then
140 filter_r = svv_f
141 else
142 filter_r = ident
143 end if
144 if (index(svv_direction, "s") > 0) then
145 filter_s = svv_ft
146 else
147 filter_s = ident
148 end if
149 if (index(svv_direction, "t") > 0) then
150 filter_t = svv_ft
151 else
152 filter_t = ident
153 end if
154
155 !$omp parallel do private(e, i, j, k, l, tmp, ur_h, us_h, ut_h) &
156 !$omp& private(u1, u2, u3, u1_svv, u2_svv, u3_svv, wur, wus, wut)
157 do e = 1, n
158 do j = 1, lx * lx
159 do i = 1, lx
160 tmp = 0.0_rp
161 do k = 1, lx
162 tmp = tmp + dx(i,k) * u(k,j,1,e)
163 end do
164 wur(i,j,1) = tmp
165 end do
166 end do
167
168 do k = 1, lx
169 do j = 1, lx
170 do i = 1, lx
171 tmp = 0.0_rp
172 do l = 1, lx
173 tmp = tmp + dy(j,l) * u(i,l,k,e)
174 end do
175 wus(i,j,k) = tmp
176 end do
177 end do
178 end do
179
180 do k = 1, lx
181 do i = 1, lx * lx
182 tmp = 0.0_rp
183 do l = 1, lx
184 tmp = tmp + dz(k,l) * u(i,1,l,e)
185 end do
186 wut(i,1,k) = tmp
187 end do
188 end do
189
190 do i = 1, lx * lx * lx
191 u1(i,1,1) = (drdx(i,1,1,e) * wur(i,1,1) + &
192 dsdx(i,1,1,e) * wus(i,1,1) + &
193 dtdx(i,1,1,e) * wut(i,1,1)) * jacinv(i,1,1,e)
194 u2(i,1,1) = (drdy(i,1,1,e) * wur(i,1,1) + &
195 dsdy(i,1,1,e) * wus(i,1,1) + &
196 dtdy(i,1,1,e) * wut(i,1,1)) * jacinv(i,1,1,e)
197 u3(i,1,1) = (drdz(i,1,1,e) * wur(i,1,1) + &
198 dsdz(i,1,1,e) * wus(i,1,1) + &
199 dtdz(i,1,1,e) * wut(i,1,1)) * jacinv(i,1,1,e)
200 end do
201
202 call tnsr3d_el(u1_svv, lx, u1, lx, filter_r, filter_s, filter_t)
203 call tnsr3d_el(u2_svv, lx, u2, lx, filter_r, filter_s, filter_t)
204 call tnsr3d_el(u3_svv, lx, u3, lx, filter_r, filter_s, filter_t)
205
206 do i = 1, lx * lx * lx
207 u1_svv(i,1,1) = u1(i,1,1) - u1_svv(i,1,1)
208 u2_svv(i,1,1) = u2(i,1,1) - u2_svv(i,1,1)
209 u3_svv(i,1,1) = u3(i,1,1) - u3_svv(i,1,1)
210
211 ur_h = (svv_h1(i,1,1,e) * u1_svv(i,1,1) + &
212 h1(i,1,1,e) * u1(i,1,1)) * weights3(i,1,1)
213 us_h = (svv_h1(i,1,1,e) * u2_svv(i,1,1) + &
214 h1(i,1,1,e) * u2(i,1,1)) * weights3(i,1,1)
215 ut_h = (svv_h1(i,1,1,e) * u3_svv(i,1,1) + &
216 h1(i,1,1,e) * u3(i,1,1)) * weights3(i,1,1)
217
218 wur(i,1,1) = drdx(i,1,1,e) * ur_h + &
219 drdy(i,1,1,e) * us_h + drdz(i,1,1,e) * ut_h
220 wus(i,1,1) = dsdx(i,1,1,e) * ur_h + &
221 dsdy(i,1,1,e) * us_h + dsdz(i,1,1,e) * ut_h
222 wut(i,1,1) = dtdx(i,1,1,e) * ur_h + &
223 dtdy(i,1,1,e) * us_h + dtdz(i,1,1,e) * ut_h
224 end do
225
226 do j = 1, lx * lx
227 do i = 1, lx
228 tmp = 0.0_rp
229 do k = 1, lx
230 tmp = tmp + dxt(i,k) * wur(k,j,1)
231 end do
232 w(i,j,1,e) = tmp
233 end do
234 end do
235 do k = 1, lx
236 do j = 1, lx
237 do i = 1, lx
238 tmp = 0.0_rp
239 do l = 1, lx
240 tmp = tmp + dyt(j,l) * wus(i,l,k)
241 end do
242 w(i,j,k,e) = w(i,j,k,e) + tmp
243 end do
244 end do
245 end do
246 do k = 1, lx
247 do i = 1, lx * lx
248 tmp = 0.0_rp
249 do l = 1, lx
250 tmp = tmp + dzt(k,l) * wut(i,1,l)
251 end do
252 w(i,1,k,e) = w(i,1,k,e) + tmp
253 end do
254 end do
255 end do
256 !$omp end parallel do
257 end subroutine ax_helm_svv_one_sided_lx
258
CPU implementation of the one-sided SVV Helmholtz operator.
subroutine ax_helm_svv_one_sided_compute(this, w, u, coef, msh, xh)
Compute the one-sided SVV Helmholtz product.
subroutine ax_helm_svv_one_sided_lx(w, u, dx, dy, dz, dxt, dyt, dzt, h1, drdx, drdy, drdz, dsdx, dsdy, dsdz, dtdx, dtdy, dtdz, jacinv, weights3, svv_h1, svv_f, svv_ft, svv_direction, ident, n, lx)
Generic CPU kernel for the one-sided SVV Helmholtz product.
Base type for an SVV Helmholtz operator.
Coefficients.
Definition coef.f90:34
Definition math.f90:60
subroutine, public addcol4(a, b, c, d, n)
Returns .
Definition math.f90:1183
Defines a mesh.
Definition mesh.f90:34
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:14
Defines a function space.
Definition space.f90:34
Tensor operations.
Definition tensor.f90:61
subroutine, public tnsr3d_el(v, nv, u, nu, a, bt, ct)
Tensor product performed on a single element.
Definition tensor.f90:174
Helmholtz operator carrying a non-owning SVV object.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:93
The function space for the SEM solution fields.
Definition space.f90:64