Neko 1.99.11
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
convect_scalar.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!>
34submodule(opr_cpu) cpu_convect_scalar
35 use math, only : col2
36 implicit none
37
38contains
39
40 module subroutine opr_cpu_convect_scalar(du, u, cr, cs, ct, xh_gll, xh_gl, &
41 coef_gll, coef_gl, gll_to_gl)
42 type(space_t), intent(in) :: Xh_GL
43 type(space_t), intent(in) :: Xh_GLL
44 type(coef_t), intent(in) :: coef_GLL
45 type(coef_t), intent(in) :: coef_GL
46 type(interpolator_t), intent(inout) :: GLL_to_GL
47 real(kind=rp), intent(inout) :: &
48 du(xh_gll%lx, xh_gll%ly, xh_gll%lz, coef_gl%msh%nelv)
49 real(kind=rp), intent(inout) :: &
50 u(xh_gl%lx, xh_gl%lx, xh_gl%lx, coef_gl%msh%nelv)
51 real(kind=rp), intent(inout) :: cr(xh_gl%lxyz, coef_gl%msh%nelv)
52 real(kind=rp), intent(inout) :: cs(xh_gl%lxyz, coef_gl%msh%nelv)
53 real(kind=rp), intent(inout) :: ct(xh_gl%lxyz, coef_gl%msh%nelv)
54 associate(dx => xh_gl%dx, dy => xh_gl%dy, dz => xh_gl%dz, &
55 lx => xh_gl%lx, nelv => coef_gl%msh%nelv)
56
57 select case (lx)
58 case (18)
59 call cpu_convect_scalar_lx18(du, u, cr, cs, ct, dx, dy, dz, &
60 xh_gll, coef_gll, gll_to_gl, nelv)
61 case (17)
62 call cpu_convect_scalar_lx17(du, u, cr, cs, ct, dx, dy, dz, &
63 xh_gll, coef_gll, gll_to_gl, nelv)
64 case (16)
65 call cpu_convect_scalar_lx16(du, u, cr, cs, ct, dx, dy, dz, &
66 xh_gll, coef_gll, gll_to_gl, nelv)
67 case (15)
68 call cpu_convect_scalar_lx15(du, u, cr, cs, ct, dx, dy, dz, &
69 xh_gll, coef_gll, gll_to_gl, nelv)
70 case (14)
71 call cpu_convect_scalar_lx14(du, u, cr, cs, ct, dx, dy, dz, &
72 xh_gll, coef_gll, gll_to_gl, nelv)
73 case (13)
74 call cpu_convect_scalar_lx13(du, u, cr, cs, ct, dx, dy, dz, &
75 xh_gll, coef_gll, gll_to_gl, nelv)
76 case (12)
77 call cpu_convect_scalar_lx12(du, u, cr, cs, ct, dx, dy, dz, &
78 xh_gll, coef_gll, gll_to_gl, nelv)
79 case (11)
80 call cpu_convect_scalar_lx11(du, u, cr, cs, ct, dx, dy, dz, &
81 xh_gll, coef_gll, gll_to_gl, nelv)
82 case (10)
83 call cpu_convect_scalar_lx10(du, u, cr, cs, ct, dx, dy, dz, &
84 xh_gll, coef_gll, gll_to_gl, nelv)
85 case (9)
86 call cpu_convect_scalar_lx9(du, u, cr, cs, ct, dx, dy, dz, &
87 xh_gll, coef_gll, gll_to_gl, nelv)
88 case (8)
89 call cpu_convect_scalar_lx8(du, u, cr, cs, ct, dx, dy, dz, &
90 xh_gll, coef_gll, gll_to_gl, nelv)
91 case (7)
92 call cpu_convect_scalar_lx7(du, u, cr, cs, ct, dx, dy, dz, &
93 xh_gll, coef_gll, gll_to_gl, nelv)
94 case (6)
95 call cpu_convect_scalar_lx6(du, u, cr, cs, ct, dx, dy, dz, &
96 xh_gll, coef_gll, gll_to_gl, nelv)
97 case (5)
98 call cpu_convect_scalar_lx5(du, u, cr, cs, ct, dx, dy, dz, &
99 xh_gll, coef_gll, gll_to_gl, nelv)
100 case (4)
101 call cpu_convect_scalar_lx4(du, u, cr, cs, ct, dx, dy, dz, &
102 xh_gll, coef_gll, gll_to_gl, nelv)
103 case (3)
104 call cpu_convect_scalar_lx3(du, u, cr, cs, ct, dx, dy, dz, &
105 xh_gll, coef_gll, gll_to_gl, nelv)
106 case (2)
107 call cpu_convect_scalar_lx2(du, u, cr, cs, ct, dx, dy, dz, &
108 xh_gll, coef_gll, gll_to_gl, nelv)
109 case default
110 call cpu_convect_scalar_lx(du, u, cr, cs, ct, dx, dy, dz, &
111 xh_gll, coef_gll, gll_to_gl, nelv, lx)
112 end select
113 end associate
114
115 end subroutine opr_cpu_convect_scalar
116
117 subroutine cpu_convect_scalar_lx(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
118 coef_GLL, GLL_to_GL, nelv, lx)
119 integer, intent(in) :: nelv, lx
120 type(space_t), intent(in) :: Xh_GLL
121 type(coef_t), intent(in) :: coef_GLL
122 type(interpolator_t), intent(inout) :: GLL_to_GL
123 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
124 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
125 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
126 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
127 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
128 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
129 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
130 real(kind=rp) :: ud(lx*lx*lx)
131 real(kind=rp) :: tmp
132 integer :: e, i, j, k, l, idx, n_GLL
133
134 n_gll = nelv * xh_gll%lxyz
135
136 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
137 do e = 1, nelv
138 do j = 1, lx * lx
139 do i = 1, lx
140 tmp = 0.0_rp
141 do k = 1, lx
142 tmp = tmp + dx(i,k) * u(k,j,1,e)
143 end do
144 ur(i,j,1) = tmp
145 end do
146 end do
147
148 do k = 1, lx
149 do j = 1, lx
150 do i = 1, lx
151 tmp = 0.0_rp
152 do l = 1, lx
153 tmp = tmp + dy(j,l) * u(i,l,k,e)
154 end do
155 us(i,j,k) = tmp
156 end do
157 end do
158 end do
159
160 do k = 1, lx
161 do i = 1, lx*lx
162 tmp = 0.0_rp
163 do l = 1, lx
164 tmp = tmp + dz(k,l) * u(i,1,l,e)
165 end do
166 ut(i,1,k) = tmp
167 end do
168 end do
169
170 do i = 1, lx * lx * lx
171 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
172 + ct(i,e) * ut(i,1,1)
173 end do
174 idx = (e-1) * xh_gll%lxyz+1
175 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
176 end do
177 !$omp end parallel do
178 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
179 call col2(du, coef_gll%Binv, n_gll)
180
181 end subroutine cpu_convect_scalar_lx
182
183 subroutine cpu_convect_scalar_lx18(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
184 coef_GLL, GLL_to_GL, nelv)
185 integer, parameter :: lx = 18
186 integer, intent(in) :: nelv
187 type(space_t), intent(in) :: Xh_GLL
188 type(coef_t), intent(in) :: coef_GLL
189 type(interpolator_t), intent(inout) :: GLL_to_GL
190 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
191 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
192 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
193 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
194 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
195 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
196 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
197 real(kind=rp) :: ud(lx*lx*lx)
198 real(kind=rp) :: tmp
199 integer :: e, i, j, k, l, idx, n_GLL
200
201 n_gll = nelv * xh_gll%lxyz
202
203 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
204 do e = 1, nelv
205 do j = 1, lx * lx
206 do i = 1, lx
207 tmp = 0.0_rp
208 do k = 1, lx
209 tmp = tmp + dx(i,k) * u(k,j,1,e)
210 end do
211 ur(i,j,1) = tmp
212 end do
213 end do
214
215 do k = 1, lx
216 do j = 1, lx
217 do i = 1, lx
218 tmp = 0.0_rp
219 do l = 1, lx
220 tmp = tmp + dy(j,l) * u(i,l,k,e)
221 end do
222 us(i,j,k) = tmp
223 end do
224 end do
225 end do
226
227 do k = 1, lx
228 do i = 1, lx*lx
229 tmp = 0.0_rp
230 do l = 1, lx
231 tmp = tmp + dz(k,l) * u(i,1,l,e)
232 end do
233 ut(i,1,k) = tmp
234 end do
235 end do
236
237 do i = 1, lx * lx * lx
238 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
239 + ct(i,e) * ut(i,1,1)
240 end do
241 idx = (e-1) * xh_gll%lxyz+1
242 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
243 end do
244 !$omp end parallel do
245 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
246 call col2(du, coef_gll%Binv, n_gll)
247
248 end subroutine cpu_convect_scalar_lx18
249
250 subroutine cpu_convect_scalar_lx17(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
251 coef_GLL, GLL_to_GL, nelv)
252 integer, parameter :: lx = 17
253 integer, intent(in) :: nelv
254 type(space_t), intent(in) :: Xh_GLL
255 type(coef_t), intent(in) :: coef_GLL
256 type(interpolator_t), intent(inout) :: GLL_to_GL
257 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
258 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
259 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
260 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
261 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
262 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
263 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
264 real(kind=rp) :: ud(lx*lx*lx)
265 real(kind=rp) :: tmp
266 integer :: e, i, j, k, l, idx, n_GLL
267
268 n_gll = nelv * xh_gll%lxyz
269
270 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
271 do e = 1, nelv
272 do j = 1, lx * lx
273 do i = 1, lx
274 tmp = 0.0_rp
275 do k = 1, lx
276 tmp = tmp + dx(i,k) * u(k,j,1,e)
277 end do
278 ur(i,j,1) = tmp
279 end do
280 end do
281
282 do k = 1, lx
283 do j = 1, lx
284 do i = 1, lx
285 tmp = 0.0_rp
286 do l = 1, lx
287 tmp = tmp + dy(j,l) * u(i,l,k,e)
288 end do
289 us(i,j,k) = tmp
290 end do
291 end do
292 end do
293
294 do k = 1, lx
295 do i = 1, lx*lx
296 tmp = 0.0_rp
297 do l = 1, lx
298 tmp = tmp + dz(k,l) * u(i,1,l,e)
299 end do
300 ut(i,1,k) = tmp
301 end do
302 end do
303
304 do i = 1, lx * lx * lx
305 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
306 + ct(i,e) * ut(i,1,1)
307 end do
308 idx = (e-1) * xh_gll%lxyz+1
309 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
310 end do
311 !$omp end parallel do
312 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
313 call col2(du, coef_gll%Binv, n_gll)
314
315 end subroutine cpu_convect_scalar_lx17
316
317 subroutine cpu_convect_scalar_lx16(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
318 coef_GLL, GLL_to_GL, nelv)
319 integer, parameter :: lx = 16
320 integer, intent(in) :: nelv
321 type(space_t), intent(in) :: Xh_GLL
322 type(coef_t), intent(in) :: coef_GLL
323 type(interpolator_t), intent(inout) :: GLL_to_GL
324 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
325 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
326 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
327 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
328 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
329 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
330 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
331 real(kind=rp) :: ud(lx*lx*lx)
332 real(kind=rp) :: tmp
333 integer :: e, i, j, k, l, idx, n_GLL
334
335 n_gll = nelv * xh_gll%lxyz
336
337 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
338 do e = 1, nelv
339 do j = 1, lx * lx
340 do i = 1, lx
341 tmp = 0.0_rp
342 do k = 1, lx
343 tmp = tmp + dx(i,k) * u(k,j,1,e)
344 end do
345 ur(i,j,1) = tmp
346 end do
347 end do
348
349 do k = 1, lx
350 do j = 1, lx
351 do i = 1, lx
352 tmp = 0.0_rp
353 do l = 1, lx
354 tmp = tmp + dy(j,l) * u(i,l,k,e)
355 end do
356 us(i,j,k) = tmp
357 end do
358 end do
359 end do
360
361 do k = 1, lx
362 do i = 1, lx*lx
363 tmp = 0.0_rp
364 do l = 1, lx
365 tmp = tmp + dz(k,l) * u(i,1,l,e)
366 end do
367 ut(i,1,k) = tmp
368 end do
369 end do
370
371 do i = 1, lx * lx * lx
372 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
373 + ct(i,e) * ut(i,1,1)
374 end do
375 idx = (e-1) * xh_gll%lxyz+1
376 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
377 end do
378 !$omp end parallel do
379 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
380 call col2(du, coef_gll%Binv, n_gll)
381
382 end subroutine cpu_convect_scalar_lx16
383
384 subroutine cpu_convect_scalar_lx15(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
385 coef_GLL, GLL_to_GL, nelv)
386 integer, parameter :: lx = 15
387 integer, intent(in) :: nelv
388 type(space_t), intent(in) :: Xh_GLL
389 type(coef_t), intent(in) :: coef_GLL
390 type(interpolator_t), intent(inout) :: GLL_to_GL
391 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
392 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
393 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
394 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
395 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
396 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
397 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
398 real(kind=rp) :: ud(lx*lx*lx)
399 real(kind=rp) :: tmp
400 integer :: e, i, j, k, l, idx, n_GLL
401
402 n_gll = nelv * xh_gll%lxyz
403
404 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
405 do e = 1, nelv
406 do j = 1, lx * lx
407 do i = 1, lx
408 tmp = 0.0_rp
409 do k = 1, lx
410 tmp = tmp + dx(i,k) * u(k,j,1,e)
411 end do
412 ur(i,j,1) = tmp
413 end do
414 end do
415
416 do k = 1, lx
417 do j = 1, lx
418 do i = 1, lx
419 tmp = 0.0_rp
420 do l = 1, lx
421 tmp = tmp + dy(j,l) * u(i,l,k,e)
422 end do
423 us(i,j,k) = tmp
424 end do
425 end do
426 end do
427
428 do k = 1, lx
429 do i = 1, lx*lx
430 tmp = 0.0_rp
431 do l = 1, lx
432 tmp = tmp + dz(k,l) * u(i,1,l,e)
433 end do
434 ut(i,1,k) = tmp
435 end do
436 end do
437
438 do i = 1, lx * lx * lx
439 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
440 + ct(i,e) * ut(i,1,1)
441 end do
442 idx = (e-1) * xh_gll%lxyz+1
443 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
444 end do
445 !$omp end parallel do
446 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
447 call col2(du, coef_gll%Binv, n_gll)
448
449 end subroutine cpu_convect_scalar_lx15
450
451 subroutine cpu_convect_scalar_lx14(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
452 coef_GLL, GLL_to_GL, nelv)
453 integer, parameter :: lx = 14
454 integer, intent(in) :: nelv
455 type(space_t), intent(in) :: Xh_GLL
456 type(coef_t), intent(in) :: coef_GLL
457 type(interpolator_t), intent(inout) :: GLL_to_GL
458 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
459 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
460 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
461 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
462 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
463 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
464 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
465 real(kind=rp) :: ud(lx*lx*lx)
466 real(kind=rp) :: tmp
467 integer :: e, i, j, k, l, idx, n_GLL
468
469 n_gll = nelv * xh_gll%lxyz
470
471 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
472 do e = 1, nelv
473 do j = 1, lx * lx
474 do i = 1, lx
475 tmp = 0.0_rp
476 do k = 1, lx
477 tmp = tmp + dx(i,k) * u(k,j,1,e)
478 end do
479 ur(i,j,1) = tmp
480 end do
481 end do
482
483 do k = 1, lx
484 do j = 1, lx
485 do i = 1, lx
486 tmp = 0.0_rp
487 do l = 1, lx
488 tmp = tmp + dy(j,l) * u(i,l,k,e)
489 end do
490 us(i,j,k) = tmp
491 end do
492 end do
493 end do
494
495 do k = 1, lx
496 do i = 1, lx*lx
497 tmp = 0.0_rp
498 do l = 1, lx
499 tmp = tmp + dz(k,l) * u(i,1,l,e)
500 end do
501 ut(i,1,k) = tmp
502 end do
503 end do
504
505 do i = 1, lx * lx * lx
506 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
507 + ct(i,e) * ut(i,1,1)
508 end do
509 idx = (e-1) * xh_gll%lxyz+1
510 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
511 end do
512 !$omp end parallel do
513 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
514 call col2(du, coef_gll%Binv, n_gll)
515
516 end subroutine cpu_convect_scalar_lx14
517
518 subroutine cpu_convect_scalar_lx13(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
519 coef_GLL, GLL_to_GL, nelv)
520 integer, parameter :: lx = 13
521 integer, intent(in) :: nelv
522 type(space_t), intent(in) :: Xh_GLL
523 type(coef_t), intent(in) :: coef_GLL
524 type(interpolator_t), intent(inout) :: GLL_to_GL
525 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
526 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
527 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
528 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
529 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
530 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
531 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
532 real(kind=rp) :: ud(lx*lx*lx)
533 real(kind=rp) :: tmp
534 integer :: e, i, j, k, l, idx, n_GLL
535
536 n_gll = nelv * xh_gll%lxyz
537
538 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
539 do e = 1, nelv
540 do j = 1, lx * lx
541 do i = 1, lx
542 tmp = 0.0_rp
543 do k = 1, lx
544 tmp = tmp + dx(i,k) * u(k,j,1,e)
545 end do
546 ur(i,j,1) = tmp
547 end do
548 end do
549
550 do k = 1, lx
551 do j = 1, lx
552 do i = 1, lx
553 tmp = 0.0_rp
554 do l = 1, lx
555 tmp = tmp + dy(j,l) * u(i,l,k,e)
556 end do
557 us(i,j,k) = tmp
558 end do
559 end do
560 end do
561
562 do k = 1, lx
563 do i = 1, lx*lx
564 tmp = 0.0_rp
565 do l = 1, lx
566 tmp = tmp + dz(k,l) * u(i,1,l,e)
567 end do
568 ut(i,1,k) = tmp
569 end do
570 end do
571
572 do i = 1, lx * lx * lx
573 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
574 + ct(i,e) * ut(i,1,1)
575 end do
576 idx = (e-1) * xh_gll%lxyz+1
577 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
578 end do
579 !$omp end parallel do
580 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
581 call col2(du, coef_gll%Binv, n_gll)
582
583 end subroutine cpu_convect_scalar_lx13
584
585 subroutine cpu_convect_scalar_lx12(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
586 coef_GLL, GLL_to_GL, nelv)
587 integer, parameter :: lx = 12
588 integer, intent(in) :: nelv
589 type(space_t), intent(in) :: Xh_GLL
590 type(coef_t), intent(in) :: coef_GLL
591 type(interpolator_t), intent(inout) :: GLL_to_GL
592 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
593 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
594 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
595 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
596 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
597 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
598 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
599 real(kind=rp) :: ud(lx*lx*lx)
600 real(kind=rp) :: tmp
601 integer :: e, i, j, k, l, idx, n_GLL
602
603 n_gll = nelv * xh_gll%lxyz
604
605 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
606 do e = 1, nelv
607 do j = 1, lx * lx
608 do i = 1, lx
609 tmp = 0.0_rp
610 do k = 1, lx
611 tmp = tmp + dx(i,k) * u(k,j,1,e)
612 end do
613 ur(i,j,1) = tmp
614 end do
615 end do
616
617 do k = 1, lx
618 do j = 1, lx
619 do i = 1, lx
620 tmp = 0.0_rp
621 do l = 1, lx
622 tmp = tmp + dy(j,l) * u(i,l,k,e)
623 end do
624 us(i,j,k) = tmp
625 end do
626 end do
627 end do
628
629 do k = 1, lx
630 do i = 1, lx*lx
631 tmp = 0.0_rp
632 do l = 1, lx
633 tmp = tmp + dz(k,l) * u(i,1,l,e)
634 end do
635 ut(i,1,k) = tmp
636 end do
637 end do
638
639 do i = 1, lx * lx * lx
640 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
641 + ct(i,e) * ut(i,1,1)
642 end do
643 idx = (e-1) * xh_gll%lxyz+1
644 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
645 end do
646 !$omp end parallel do
647 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
648 call col2(du, coef_gll%Binv, n_gll)
649
650 end subroutine cpu_convect_scalar_lx12
651
652 subroutine cpu_convect_scalar_lx11(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
653 coef_GLL, GLL_to_GL, nelv)
654 integer, parameter :: lx = 11
655 integer, intent(in) :: nelv
656 type(space_t), intent(in) :: Xh_GLL
657 type(coef_t), intent(in) :: coef_GLL
658 type(interpolator_t), intent(inout) :: GLL_to_GL
659 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
660 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
661 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
662 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
663 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
664 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
665 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
666 real(kind=rp) :: ud(lx*lx*lx)
667 real(kind=rp) :: tmp
668 integer :: e, i, j, k, l, idx, n_GLL
669
670 n_gll = nelv * xh_gll%lxyz
671
672 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
673 do e = 1, nelv
674 do j = 1, lx * lx
675 do i = 1, lx
676 tmp = 0.0_rp
677 do k = 1, lx
678 tmp = tmp + dx(i,k) * u(k,j,1,e)
679 end do
680 ur(i,j,1) = tmp
681 end do
682 end do
683
684 do k = 1, lx
685 do j = 1, lx
686 do i = 1, lx
687 tmp = 0.0_rp
688 do l = 1, lx
689 tmp = tmp + dy(j,l) * u(i,l,k,e)
690 end do
691 us(i,j,k) = tmp
692 end do
693 end do
694 end do
695
696 do k = 1, lx
697 do i = 1, lx*lx
698 tmp = 0.0_rp
699 do l = 1, lx
700 tmp = tmp + dz(k,l) * u(i,1,l,e)
701 end do
702 ut(i,1,k) = tmp
703 end do
704 end do
705
706 do i = 1, lx * lx * lx
707 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
708 + ct(i,e) * ut(i,1,1)
709 end do
710 idx = (e-1) * xh_gll%lxyz+1
711 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
712 end do
713 !$omp end parallel do
714 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
715 call col2(du, coef_gll%Binv, n_gll)
716
717 end subroutine cpu_convect_scalar_lx11
718
719 subroutine cpu_convect_scalar_lx10(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
720 coef_GLL, GLL_to_GL, nelv)
721 integer, parameter :: lx = 10
722 integer, intent(in) :: nelv
723 type(space_t), intent(in) :: Xh_GLL
724 type(coef_t), intent(in) :: coef_GLL
725 type(interpolator_t), intent(inout) :: GLL_to_GL
726 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
727 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
728 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
729 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
730 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
731 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
732 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
733 real(kind=rp) :: ud(lx*lx*lx)
734 real(kind=rp) :: tmp
735 integer :: e, i, j, k, l, idx, n_GLL
736
737 n_gll = nelv * xh_gll%lxyz
738
739 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
740 do e = 1, nelv
741 do j = 1, lx * lx
742 do i = 1, lx
743 tmp = 0.0_rp
744 do k = 1, lx
745 tmp = tmp + dx(i,k) * u(k,j,1,e)
746 end do
747 ur(i,j,1) = tmp
748 end do
749 end do
750
751 do k = 1, lx
752 do j = 1, lx
753 do i = 1, lx
754 tmp = 0.0_rp
755 do l = 1, lx
756 tmp = tmp + dy(j,l) * u(i,l,k,e)
757 end do
758 us(i,j,k) = tmp
759 end do
760 end do
761 end do
762
763 do k = 1, lx
764 do i = 1, lx*lx
765 tmp = 0.0_rp
766 do l = 1, lx
767 tmp = tmp + dz(k,l) * u(i,1,l,e)
768 end do
769 ut(i,1,k) = tmp
770 end do
771 end do
772
773 do i = 1, lx * lx * lx
774 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
775 + ct(i,e) * ut(i,1,1)
776 end do
777 idx = (e-1) * xh_gll%lxyz+1
778 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
779 end do
780 !$omp end parallel do
781 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
782 call col2(du, coef_gll%Binv, n_gll)
783
784 end subroutine cpu_convect_scalar_lx10
785
786 subroutine cpu_convect_scalar_lx9(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
787 coef_GLL, GLL_to_GL, nelv)
788 integer, parameter :: lx = 9
789 integer, intent(in) :: nelv
790 type(space_t), intent(in) :: Xh_GLL
791 type(coef_t), intent(in) :: coef_GLL
792 type(interpolator_t), intent(inout) :: GLL_to_GL
793 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
794 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
795 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
796 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
797 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
798 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
799 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
800 real(kind=rp) :: ud(lx*lx*lx)
801 real(kind=rp) :: tmp
802 integer :: e, i, j, k, l, idx, n_GLL
803
804 n_gll = nelv * xh_gll%lxyz
805
806 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
807 do e = 1, nelv
808 do j = 1, lx * lx
809 do i = 1, lx
810 tmp = 0.0_rp
811 do k = 1, lx
812 tmp = tmp + dx(i,k) * u(k,j,1,e)
813 end do
814 ur(i,j,1) = tmp
815 end do
816 end do
817
818 do k = 1, lx
819 do j = 1, lx
820 do i = 1, lx
821 tmp = 0.0_rp
822 do l = 1, lx
823 tmp = tmp + dy(j,l) * u(i,l,k,e)
824 end do
825 us(i,j,k) = tmp
826 end do
827 end do
828 end do
829
830 do k = 1, lx
831 do i = 1, lx*lx
832 tmp = 0.0_rp
833 do l = 1, lx
834 tmp = tmp + dz(k,l) * u(i,1,l,e)
835 end do
836 ut(i,1,k) = tmp
837 end do
838 end do
839
840 do i = 1, lx * lx * lx
841 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
842 + ct(i,e) * ut(i,1,1)
843 end do
844 idx = (e-1) * xh_gll%lxyz+1
845 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
846 end do
847 !$omp end parallel do
848 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
849 call col2(du, coef_gll%Binv, n_gll)
850
851 end subroutine cpu_convect_scalar_lx9
852
853 subroutine cpu_convect_scalar_lx8(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
854 coef_GLL, GLL_to_GL, nelv)
855 integer, parameter :: lx = 8
856 integer, intent(in) :: nelv
857 type(space_t), intent(in) :: Xh_GLL
858 type(coef_t), intent(in) :: coef_GLL
859 type(interpolator_t), intent(inout) :: GLL_to_GL
860 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
861 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
862 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
863 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
864 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
865 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
866 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
867 real(kind=rp) :: ud(lx*lx*lx)
868 real(kind=rp) :: tmp
869 integer :: e, i, j, k, l, idx, n_GLL
870
871 n_gll = nelv * xh_gll%lxyz
872
873 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
874 do e = 1, nelv
875 do j = 1, lx * lx
876 do i = 1, lx
877 tmp = 0.0_rp
878 do k = 1, lx
879 tmp = tmp + dx(i,k) * u(k,j,1,e)
880 end do
881 ur(i,j,1) = tmp
882 end do
883 end do
884
885 do k = 1, lx
886 do j = 1, lx
887 do i = 1, lx
888 tmp = 0.0_rp
889 do l = 1, lx
890 tmp = tmp + dy(j,l) * u(i,l,k,e)
891 end do
892 us(i,j,k) = tmp
893 end do
894 end do
895 end do
896
897 do k = 1, lx
898 do i = 1, lx*lx
899 tmp = 0.0_rp
900 do l = 1, lx
901 tmp = tmp + dz(k,l) * u(i,1,l,e)
902 end do
903 ut(i,1,k) = tmp
904 end do
905 end do
906
907 do i = 1, lx * lx * lx
908 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
909 + ct(i,e) * ut(i,1,1)
910 end do
911 idx = (e-1) * xh_gll%lxyz+1
912 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
913 end do
914 !$omp end parallel do
915 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
916 call col2(du, coef_gll%Binv, n_gll)
917
918 end subroutine cpu_convect_scalar_lx8
919
920 subroutine cpu_convect_scalar_lx7(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
921 coef_GLL, GLL_to_GL, nelv)
922 integer, parameter :: lx = 7
923 integer, intent(in) :: nelv
924 type(space_t), intent(in) :: Xh_GLL
925 type(coef_t), intent(in) :: coef_GLL
926 type(interpolator_t), intent(inout) :: GLL_to_GL
927 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
928 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
929 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
930 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
931 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
932 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
933 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
934 real(kind=rp) :: ud(lx*lx*lx)
935 real(kind=rp) :: tmp
936 integer :: e, i, j, k, l, idx, n_GLL
937
938 n_gll = nelv * xh_gll%lxyz
939
940 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
941 do e = 1, nelv
942 do j = 1, lx * lx
943 do i = 1, lx
944 tmp = 0.0_rp
945 do k = 1, lx
946 tmp = tmp + dx(i,k) * u(k,j,1,e)
947 end do
948 ur(i,j,1) = tmp
949 end do
950 end do
951
952 do k = 1, lx
953 do j = 1, lx
954 do i = 1, lx
955 tmp = 0.0_rp
956 do l = 1, lx
957 tmp = tmp + dy(j,l) * u(i,l,k,e)
958 end do
959 us(i,j,k) = tmp
960 end do
961 end do
962 end do
963
964 do k = 1, lx
965 do i = 1, lx*lx
966 tmp = 0.0_rp
967 do l = 1, lx
968 tmp = tmp + dz(k,l) * u(i,1,l,e)
969 end do
970 ut(i,1,k) = tmp
971 end do
972 end do
973
974 do i = 1, lx * lx * lx
975 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
976 + ct(i,e) * ut(i,1,1)
977 end do
978 idx = (e-1) * xh_gll%lxyz+1
979 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
980 end do
981 !$omp end parallel do
982 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
983 call col2(du, coef_gll%Binv, n_gll)
984
985 end subroutine cpu_convect_scalar_lx7
986
987 subroutine cpu_convect_scalar_lx6(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
988 coef_GLL, GLL_to_GL, nelv)
989 integer, parameter :: lx = 6
990 integer, intent(in) :: nelv
991 type(space_t), intent(in) :: Xh_GLL
992 type(coef_t), intent(in) :: coef_GLL
993 type(interpolator_t), intent(inout) :: GLL_to_GL
994 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
995 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
996 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
997 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
998 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
999 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
1000 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
1001 real(kind=rp) :: ud(lx*lx*lx)
1002 real(kind=rp) :: tmp
1003 integer :: e, i, j, k, l, idx, n_GLL
1004
1005 n_gll = nelv * xh_gll%lxyz
1006
1007 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
1008 do e = 1, nelv
1009 do j = 1, lx * lx
1010 do i = 1, lx
1011 tmp = 0.0_rp
1012 do k = 1, lx
1013 tmp = tmp + dx(i,k) * u(k,j,1,e)
1014 end do
1015 ur(i,j,1) = tmp
1016 end do
1017 end do
1018
1019 do k = 1, lx
1020 do j = 1, lx
1021 do i = 1, lx
1022 tmp = 0.0_rp
1023 do l = 1, lx
1024 tmp = tmp + dy(j,l) * u(i,l,k,e)
1025 end do
1026 us(i,j,k) = tmp
1027 end do
1028 end do
1029 end do
1030
1031 do k = 1, lx
1032 do i = 1, lx*lx
1033 tmp = 0.0_rp
1034 do l = 1, lx
1035 tmp = tmp + dz(k,l) * u(i,1,l,e)
1036 end do
1037 ut(i,1,k) = tmp
1038 end do
1039 end do
1040
1041 do i = 1, lx * lx * lx
1042 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
1043 + ct(i,e) * ut(i,1,1)
1044 end do
1045 idx = (e-1) * xh_gll%lxyz+1
1046 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
1047 end do
1048 !$omp end parallel do
1049 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
1050 call col2(du, coef_gll%Binv, n_gll)
1051
1052 end subroutine cpu_convect_scalar_lx6
1053
1054 subroutine cpu_convect_scalar_lx5(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
1055 coef_GLL, GLL_to_GL, nelv)
1056 integer, parameter :: lx = 5
1057 integer, intent(in) :: nelv
1058 type(space_t), intent(in) :: Xh_GLL
1059 type(coef_t), intent(in) :: coef_GLL
1060 type(interpolator_t), intent(inout) :: GLL_to_GL
1061 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
1062 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
1063 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
1064 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
1065 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
1066 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
1067 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
1068 real(kind=rp) :: ud(lx*lx*lx)
1069 real(kind=rp) :: tmp
1070 integer :: e, i, j, k, l, idx, n_GLL
1071
1072 n_gll = nelv * xh_gll%lxyz
1073
1074 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
1075 do e = 1, nelv
1076 do j = 1, lx * lx
1077 do i = 1, lx
1078 tmp = 0.0_rp
1079 do k = 1, lx
1080 tmp = tmp + dx(i,k) * u(k,j,1,e)
1081 end do
1082 ur(i,j,1) = tmp
1083 end do
1084 end do
1085
1086 do k = 1, lx
1087 do j = 1, lx
1088 do i = 1, lx
1089 tmp = 0.0_rp
1090 do l = 1, lx
1091 tmp = tmp + dy(j,l) * u(i,l,k,e)
1092 end do
1093 us(i,j,k) = tmp
1094 end do
1095 end do
1096 end do
1097
1098 do k = 1, lx
1099 do i = 1, lx*lx
1100 tmp = 0.0_rp
1101 do l = 1, lx
1102 tmp = tmp + dz(k,l) * u(i,1,l,e)
1103 end do
1104 ut(i,1,k) = tmp
1105 end do
1106 end do
1107
1108 do i = 1, lx * lx * lx
1109 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
1110 + ct(i,e) * ut(i,1,1)
1111 end do
1112 idx = (e-1) * xh_gll%lxyz+1
1113 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
1114 end do
1115 !$omp end parallel do
1116 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
1117 call col2(du, coef_gll%Binv, n_gll)
1118
1119 end subroutine cpu_convect_scalar_lx5
1120
1121 subroutine cpu_convect_scalar_lx4(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
1122 coef_GLL, GLL_to_GL, nelv)
1123 integer, parameter :: lx = 4
1124 integer, intent(in) :: nelv
1125 type(space_t), intent(in) :: Xh_GLL
1126 type(coef_t), intent(in) :: coef_GLL
1127 type(interpolator_t), intent(inout) :: GLL_to_GL
1128 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
1129 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
1130 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
1131 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
1132 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
1133 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
1134 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
1135 real(kind=rp) :: ud(lx*lx*lx)
1136 real(kind=rp) :: tmp
1137 integer :: e, i, j, k, l, idx, n_GLL
1138
1139 n_gll = nelv * xh_gll%lxyz
1140
1141 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
1142 do e = 1, nelv
1143 do j = 1, lx * lx
1144 do i = 1, lx
1145 tmp = 0.0_rp
1146 do k = 1, lx
1147 tmp = tmp + dx(i,k) * u(k,j,1,e)
1148 end do
1149 ur(i,j,1) = tmp
1150 end do
1151 end do
1152
1153 do k = 1, lx
1154 do j = 1, lx
1155 do i = 1, lx
1156 tmp = 0.0_rp
1157 do l = 1, lx
1158 tmp = tmp + dy(j,l) * u(i,l,k,e)
1159 end do
1160 us(i,j,k) = tmp
1161 end do
1162 end do
1163 end do
1164
1165 do k = 1, lx
1166 do i = 1, lx*lx
1167 tmp = 0.0_rp
1168 do l = 1, lx
1169 tmp = tmp + dz(k,l) * u(i,1,l,e)
1170 end do
1171 ut(i,1,k) = tmp
1172 end do
1173 end do
1174
1175 do i = 1, lx * lx * lx
1176 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
1177 + ct(i,e) * ut(i,1,1)
1178 end do
1179 idx = (e-1) * xh_gll%lxyz+1
1180 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
1181 end do
1182 !$omp end parallel do
1183 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
1184 call col2(du, coef_gll%Binv, n_gll)
1185
1186 end subroutine cpu_convect_scalar_lx4
1187
1188 subroutine cpu_convect_scalar_lx3(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
1189 coef_GLL, GLL_to_GL, nelv)
1190 integer, parameter :: lx = 3
1191 integer, intent(in) :: nelv
1192 type(space_t), intent(in) :: Xh_GLL
1193 type(coef_t), intent(in) :: coef_GLL
1194 type(interpolator_t), intent(inout) :: GLL_to_GL
1195 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
1196 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
1197 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
1198 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
1199 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
1200 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
1201 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
1202 real(kind=rp) :: ud(lx*lx*lx)
1203 real(kind=rp) :: tmp
1204 integer :: e, i, j, k, l, idx, n_GLL
1205
1206 n_gll = nelv * xh_gll%lxyz
1207
1208 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
1209 do e = 1, nelv
1210 do j = 1, lx * lx
1211 do i = 1, lx
1212 tmp = 0.0_rp
1213 do k = 1, lx
1214 tmp = tmp + dx(i,k) * u(k,j,1,e)
1215 end do
1216 ur(i,j,1) = tmp
1217 end do
1218 end do
1219
1220 do k = 1, lx
1221 do j = 1, lx
1222 do i = 1, lx
1223 tmp = 0.0_rp
1224 do l = 1, lx
1225 tmp = tmp + dy(j,l) * u(i,l,k,e)
1226 end do
1227 us(i,j,k) = tmp
1228 end do
1229 end do
1230 end do
1231
1232 do k = 1, lx
1233 do i = 1, lx*lx
1234 tmp = 0.0_rp
1235 do l = 1, lx
1236 tmp = tmp + dz(k,l) * u(i,1,l,e)
1237 end do
1238 ut(i,1,k) = tmp
1239 end do
1240 end do
1241
1242 do i = 1, lx * lx * lx
1243 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
1244 + ct(i,e) * ut(i,1,1)
1245 end do
1246 idx = (e-1) * xh_gll%lxyz+1
1247 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
1248 end do
1249 !$omp end parallel do
1250 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
1251 call col2(du, coef_gll%Binv, n_gll)
1252
1253 end subroutine cpu_convect_scalar_lx3
1254
1255 subroutine cpu_convect_scalar_lx2(du, u, cr, cs, ct, dx, dy, dz, Xh_GLL, &
1256 coef_GLL, GLL_to_GL, nelv)
1257 integer, parameter :: lx = 2
1258 integer, intent(in) :: nelv
1259 type(space_t), intent(in) :: Xh_GLL
1260 type(coef_t), intent(in) :: coef_GLL
1261 type(interpolator_t), intent(inout) :: GLL_to_GL
1262 real(kind=rp), intent(inout) :: du(xh_gll%lx, xh_gll%lx, xh_gll%lx, nelv)
1263 real(kind=rp), intent(in) :: u(lx, lx, lx, nelv)
1264 real(kind=rp), intent(in) :: cr(lx*lx*lx, nelv)
1265 real(kind=rp), intent(in) :: cs(lx*lx*lx, nelv)
1266 real(kind=rp), intent(in) :: ct(lx*lx*lx, nelv)
1267 real(kind=rp), dimension(lx, lx), intent(in) :: dx, dy, dz
1268 real(kind=rp), dimension(lx, lx, lx) :: ur, us, ut
1269 real(kind=rp) :: ud(lx*lx*lx)
1270 real(kind=rp) :: tmp
1271 integer :: e, i, j, k, l, idx, n_GLL
1272
1273 n_gll = nelv * xh_gll%lxyz
1274
1275 !$omp parallel do private(e, i, j, k, l, tmp, idx, ur, us, ut, ud)
1276 do e = 1, nelv
1277 do j = 1, lx * lx
1278 do i = 1, lx
1279 tmp = 0.0_rp
1280 do k = 1, lx
1281 tmp = tmp + dx(i,k) * u(k,j,1,e)
1282 end do
1283 ur(i,j,1) = tmp
1284 end do
1285 end do
1286
1287 do k = 1, lx
1288 do j = 1, lx
1289 do i = 1, lx
1290 tmp = 0.0_rp
1291 do l = 1, lx
1292 tmp = tmp + dy(j,l) * u(i,l,k,e)
1293 end do
1294 us(i,j,k) = tmp
1295 end do
1296 end do
1297 end do
1298
1299 do k = 1, lx
1300 do i = 1, lx*lx
1301 tmp = 0.0_rp
1302 do l = 1, lx
1303 tmp = tmp + dz(k,l) * u(i,1,l,e)
1304 end do
1305 ut(i,1,k) = tmp
1306 end do
1307 end do
1308
1309 do i = 1, lx * lx * lx
1310 ud(i) = cr(i,e) * ur(i,1,1) + cs(i,e) * us(i,1,1) &
1311 + ct(i,e) * ut(i,1,1)
1312 end do
1313 idx = (e-1) * xh_gll%lxyz+1
1314 call gll_to_gl%map(du(idx,1,1,1), ud, 1, xh_gll)
1315 end do
1316 !$omp end parallel do
1317 call coef_gll%gs_h%op(du, n_gll, gs_op_add)
1318 call col2(du, coef_gll%Binv, n_gll)
1319
1320 end subroutine cpu_convect_scalar_lx2
1321
1322end submodule cpu_convect_scalar
Definition math.F90:60
subroutine, public col2(a, b, n)
Vector multiplication .
Definition math.F90:1095
Operators CPU backend.
Definition opr_cpu.f90:34