Neko 1.99.1
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
operators.f90
Go to the documentation of this file.
1! Copyright (c) 2020-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!
37 use num_types, only : rp, i8
38 use opr_cpu, only : opr_cpu_cfl, opr_cpu_curl, opr_cpu_opgrad, &
39 opr_cpu_conv1, opr_cpu_convect_scalar, opr_cpu_cdtp, &
40 opr_cpu_dudxyz, opr_cpu_lambda2, opr_cpu_set_convect_rst
41 use opr_sx, only : opr_sx_cfl, opr_sx_curl, opr_sx_opgrad, &
42 opr_sx_conv1, opr_sx_convect_scalar, opr_sx_cdtp, &
43 opr_sx_dudxyz, opr_sx_lambda2, opr_sx_set_convect_rst
50 use space, only : space_t
51 use coefs, only : coef_t
52 use field, only : field_t
53 use field_math, only : field_rzero
55 use math, only : glsum, cmult, add2, add3s2, cadd, copy, col2, invcol2, &
57 use device, only : device_get_ptr
62 use mpi_f08, only : mpi_allreduce, mpi_in_place, mpi_max, mpi_sum
63 use, intrinsic :: iso_c_binding, only : c_ptr
64 implicit none
65 private
66
69
70contains
71
79 subroutine dudxyz (du, u, dr, ds, dt, coef)
80 type(coef_t), intent(in), target :: coef
81 real(kind=rp), dimension(coef%Xh%lx, coef%Xh%ly, coef%Xh%lz, & coef%msh%nelv), intent(inout) :: du
82 real(kind=rp), dimension(coef%Xh%lx, coef%Xh%ly, coef%Xh%lz, & coef%msh%nelv), intent(in) :: u, dr, ds, dt
83
84 if (neko_bcknd_sx .eq. 1) then
85 call opr_sx_dudxyz(du, u, dr, ds, dt, coef)
86 else if (neko_bcknd_xsmm .eq. 1) then
87 call opr_xsmm_dudxyz(du, u, dr, ds, dt, coef)
88 else if (neko_bcknd_device .eq. 1) then
89 call opr_device_dudxyz(du, u, dr, ds, dt, coef)
90 else
91 call opr_cpu_dudxyz(du, u, dr, ds, dt, coef)
92 end if
93
94 end subroutine dudxyz
95
102 subroutine div(res, ux, uy, uz, coef)
103 type(coef_t), intent(in), target :: coef
104 real(kind=rp), dimension(coef%Xh%lx, coef%Xh%ly, coef%Xh%lz, & coef%msh%nelv), intent(inout) :: res
105 real(kind=rp), dimension(coef%Xh%lx, coef%Xh%ly, coef%Xh%lz, & coef%msh%nelv), intent(in) :: ux, uy, uz
106 type(field_t), pointer :: work
107 integer :: ind
108 type(c_ptr) :: res_d
109
110 if (neko_bcknd_device .eq. 1) then
111 res_d = device_get_ptr(res)
112 end if
113
114 call neko_scratch_registry%request_field(work, ind)
115
116 ! Get dux / dx
117 call dudxyz(res, ux, coef%drdx, coef%dsdx, coef%dtdx, coef)
118
119 ! Get duy / dy
120 call dudxyz(work%x, uy, coef%drdy, coef%dsdy, coef%dtdy, coef)
121 if (neko_bcknd_device .eq. 1) then
122 call device_add2(res_d, work%x_d, work%size())
123 else
124 call add2(res, work%x, work%size())
125 end if
126
127 ! Get dux / dz
128 call dudxyz(work%x, uz, coef%drdz, coef%dsdz, coef%dtdz, coef)
129 if (neko_bcknd_device .eq. 1) then
130 call device_add2(res_d, work%x_d, work%size())
131 else
132 call add2(res, work%x, work%size())
133 end if
134
135 call neko_scratch_registry%relinquish_field(ind)
136
137 end subroutine div
138
145 subroutine grad(ux, uy, uz, u, coef)
146 type(coef_t), intent(in) :: coef
147 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(inout) :: ux
148 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(inout) :: uy
149 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(inout) :: uz
150 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(in) :: u
151
152 call dudxyz(ux, u, coef%drdx, coef%dsdx, coef%dtdx, coef)
153 call dudxyz(uy, u, coef%drdy, coef%dsdy, coef%dtdy, coef)
154 call dudxyz(uz, u, coef%drdz, coef%dsdz, coef%dtdz, coef)
155
156 end subroutine grad
157
170 subroutine opgrad(ux, uy, uz, u, coef, es, ee)
171 type(coef_t), intent(in) :: coef
172 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(inout) :: ux
173 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(inout) :: uy
174 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(inout) :: uz
175 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(in) :: u
176 integer, optional :: es, ee
177 integer :: eblk_start, eblk_end
178
179 if (present(es)) then
180 eblk_start = es
181 else
182 eblk_start = 1
183 end if
184
185 if (present(ee)) then
186 eblk_end = ee
187 else
188 eblk_end = coef%msh%nelv
189 end if
190
191 if (neko_bcknd_sx .eq. 1) then
192 call opr_sx_opgrad(ux, uy, uz, u, coef)
193 else if (neko_bcknd_xsmm .eq. 1) then
194 call opr_xsmm_opgrad(ux, uy, uz, u, coef)
195 else if (neko_bcknd_device .eq. 1) then
196 call opr_device_opgrad(ux, uy, uz, u, coef)
197 else
198 call opr_cpu_opgrad(ux, uy, uz, u, coef, eblk_start, eblk_end)
199 end if
200
201 end subroutine opgrad
202
207 subroutine ortho(x, glb_n_points, n)
208 integer, intent(in) :: n
209 integer(kind=i8), intent(in) :: glb_n_points
210 real(kind=rp), dimension(n), intent(inout) :: x
211 real(kind=rp) :: c
212 type(c_ptr) :: x_d
213 if (neko_bcknd_device .eq. 1) then
214 x_d = device_get_ptr(x)
215 c = device_glsum(x_d, n)/glb_n_points
216 call device_cadd(x_d, -c, n)
217 else
218 c = glsum(x, n)/glb_n_points
219 call cadd(x, -c, n)
220 end if
221
222 end subroutine ortho
223
235 subroutine cdtp (dtx, x, dr, ds, dt, coef, es, ee)
236 type(coef_t), intent(in) :: coef
237 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(inout) :: dtx
238 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(inout) :: x
239 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(in) :: dr
240 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(in) :: ds
241 real(kind=rp), dimension(coef%Xh%lxyz, coef%msh%nelv), intent(in) :: dt
242 integer, optional :: es, ee
243 integer :: eblk_start, eblk_end
244
245 if (present(es)) then
246 eblk_start = es
247 else
248 eblk_start = 1
249 end if
250
251 if (present(ee)) then
252 eblk_end = ee
253 else
254 eblk_end = coef%msh%nelv
255 end if
256
257 if (neko_bcknd_sx .eq. 1) then
258 call opr_sx_cdtp(dtx, x, dr, ds, dt, coef)
259 else if (neko_bcknd_xsmm .eq. 1) then
260 call opr_xsmm_cdtp(dtx, x, dr, ds, dt, coef)
261 else if (neko_bcknd_device .eq. 1) then
262 call opr_device_cdtp(dtx, x, dr, ds, dt, coef)
263 else
264 call opr_cpu_cdtp(dtx, x, dr, ds, dt, coef, eblk_start, eblk_end)
265 end if
266
267 end subroutine cdtp
268
279 subroutine conv1(du, u, vx, vy, vz, Xh, coef, es, ee)
280 type(space_t), intent(in) :: xh
281 type(coef_t), intent(in) :: coef
282 real(kind=rp), intent(inout) :: du(xh%lxyz, coef%msh%nelv)
283 real(kind=rp), intent(inout) :: u(xh%lx, xh%ly, xh%lz, coef%msh%nelv)
284 real(kind=rp), intent(inout) :: vx(xh%lx, xh%ly, xh%lz, coef%msh%nelv)
285 real(kind=rp), intent(inout) :: vy(xh%lx, xh%ly, xh%lz, coef%msh%nelv)
286 real(kind=rp), intent(inout) :: vz(xh%lx, xh%ly, xh%lz, coef%msh%nelv)
287 integer, optional :: es, ee
288 integer :: eblk_end, eblk_start
289
290 associate(nelv => coef%msh%nelv, gdim => coef%msh%gdim)
291 if (present(es)) then
292 eblk_start = es
293 else
294 eblk_start = 1
295 end if
296
297 if (present(ee)) then
298 eblk_end = ee
299 else
300 eblk_end = coef%msh%nelv
301 end if
302
303 if (neko_bcknd_sx .eq. 1) then
304 call opr_sx_conv1(du, u, vx, vy, vz, xh, coef, nelv)
305 else if (neko_bcknd_xsmm .eq. 1) then
306 call opr_xsmm_conv1(du, u, vx, vy, vz, xh, coef, nelv, gdim)
307 else if (neko_bcknd_device .eq. 1) then
308 call opr_device_conv1(du, u, vx, vy, vz, xh, coef, nelv, gdim)
309 else
310 call opr_cpu_conv1(du, u, vx, vy, vz, xh, coef, eblk_start, eblk_end)
311 end if
312 end associate
313
314 end subroutine conv1
315
331 subroutine convect_scalar(du, u, c, Xh_GLL, Xh_GL, coef_GLL, &
332 coef_GL, GLL_to_GL)
333 type(space_t), intent(in) :: xh_gl
334 type(space_t), intent(in) :: xh_gll
335 type(coef_t), intent(in) :: coef_GLL
336 type(coef_t), intent(in) :: coef_GL
337 type(interpolator_t), intent(inout) :: GLL_to_GL
338 real(kind=rp), intent(inout) :: &
339 du(xh_gll%lx, xh_gll%ly, xh_gll%lz, coef_gl%msh%nelv)
340 real(kind=rp), intent(inout) :: &
341 u(xh_gl%lx, xh_gl%lx, xh_gl%lx, coef_gl%msh%nelv)
342 real(kind=rp), intent(inout) :: c(xh_gl%lxyz, coef_gl%msh%nelv, 3)
343
344 if (neko_bcknd_sx .eq. 1) then
345 call opr_sx_convect_scalar(du, u, c, xh_gll, xh_gl, &
346 coef_gll, coef_gl, gll_to_gl)
347 else if (neko_bcknd_xsmm .eq. 1) then
348 call opr_xsmm_convect_scalar(du, u, c, xh_gll, xh_gl, &
349 coef_gll, coef_gl, gll_to_gl)
350 else
351 call opr_cpu_convect_scalar(du, u, c, xh_gll, xh_gl, &
352 coef_gll, coef_gl, gll_to_gl)
353 end if
354
355 end subroutine convect_scalar
356
357 !! Compute the curl fo a vector field.
358 !! @param w1 Will store the x component of the curl.
359 !! @param w2 Will store the y component of the curl.
360 !! @param w3 Will store the z component of the curl.
361 !! @param u1 The x component of the vector field.
362 !! @param u2 The y component of the vector field.
363 !! @param u3 The z component of the vector field.
364 !! @param work1 A temporary array for computations.
365 !! @param work2 A temporary array for computations.
366 !! @param coef The SEM coefficients.
367 subroutine curl(w1, w2, w3, u1, u2, u3, work1, work2, coef, event)
368 type(field_t), intent(inout) :: w1
369 type(field_t), intent(inout) :: w2
370 type(field_t), intent(inout) :: w3
371 type(field_t), intent(in) :: u1
372 type(field_t), intent(in) :: u2
373 type(field_t), intent(in) :: u3
374 type(field_t), intent(inout) :: work1
375 type(field_t), intent(inout) :: work2
376 type(coef_t), intent(in) :: coef
377 type(c_ptr), optional, intent(inout) :: event
378
379 if (neko_bcknd_sx .eq. 1) then
380 call opr_sx_curl(w1, w2, w3, u1, u2, u3, work1, work2, coef)
381 else if (neko_bcknd_xsmm .eq. 1) then
382 call opr_xsmm_curl(w1, w2, w3, u1, u2, u3, work1, work2, coef)
383 else if (neko_bcknd_device .eq. 1) then
384 if (present(event)) then
385 call opr_device_curl(w1, w2, w3, u1, u2, u3, &
386 work1, work2, coef, event)
387 else
388 call opr_device_curl(w1, w2, w3, u1, u2, u3, work1, work2, coef)
389 end if
390 else
391 call opr_cpu_curl(w1, w2, w3, u1, u2, u3, work1, work2, coef)
392 end if
393
394 end subroutine curl
395
396 !! Compute the CFL number
397 !! @param dt The timestep.
398 !! @param u The x component of velocity.
399 !! @param v The y component of velocity.
400 !! @param w The z component of velocity.
401 !! @param Xh The SEM function space.
402 !! @param coef The SEM coefficients.
403 !! @param nelv The total number of elements.
404 !! @param gdim Number of geometric dimensions.
405 function cfl(dt, u, v, w, Xh, coef, nelv, gdim)
406 type(space_t), intent(in) :: xh
407 type(coef_t), intent(in) :: coef
408 integer, intent(in) :: nelv, gdim
409 real(kind=rp), intent(in) :: dt
410 real(kind=rp), dimension(Xh%lx, Xh%ly, Xh%lz, nelv), intent(in) :: u, v, w
411 real(kind=rp) :: cfl
412 integer :: ierr
413
414 if (neko_bcknd_sx .eq. 1) then
415 cfl = opr_sx_cfl(dt, u, v, w, xh, coef, nelv)
416 else if (neko_bcknd_device .eq. 1) then
417 cfl = opr_device_cfl(dt, u, v, w, xh, coef, nelv, gdim)
418 else
419 cfl = opr_cpu_cfl(dt, u, v, w, xh, coef, nelv, gdim)
420 end if
421
422 if (.not. neko_device_mpi) then
423 call mpi_allreduce(mpi_in_place, cfl, 1, &
424 mpi_real_precision, mpi_max, neko_comm, ierr)
425 end if
426
427 end function cfl
428
429 !! Compute the CFL number for compressible flows
430 !! @param dt The timestep.
431 !! @param max_wave_speed The precomputed maximum wave speed field.
432 !! @param Xh The SEM function space.
433 !! @param coef The SEM coefficients.
434 !! @param nelv The total number of elements.
435 !! @param gdim Number of geometric dimensions.
436 function cfl_compressible(dt, max_wave_speed, Xh, coef, nelv, gdim)
437 type(space_t), intent(in) :: xh
438 type(coef_t), intent(in) :: coef
439 integer, intent(in) :: nelv, gdim
440 real(kind=rp), intent(in) :: dt
441 real(kind=rp), dimension(Xh%lx, Xh%ly, Xh%lz, nelv), intent(in) :: max_wave_speed
442 real(kind=rp) :: cfl_compressible
443 integer :: ierr, n
444 type(field_t), pointer :: zero_vector
445 integer :: ind
446
447 n = xh%lx * xh%ly * xh%lz * nelv
448
449 ! Request a scratch field for zero vector
450 call neko_scratch_registry%request_field(zero_vector, ind)
451
452 ! Initialize zero vector
453 call field_rzero(zero_vector)
454
455 ! Use incompressible CFL with max_wave_speed as u-component, zero v and w
456 cfl_compressible = cfl(dt, max_wave_speed, zero_vector%x, zero_vector%x, xh, coef, nelv, gdim)
457
458 ! Release the scratch field
459 call neko_scratch_registry%relinquish_field(ind)
460
461 end function cfl_compressible
462
475 subroutine strain_rate(s11, s22, s33, s12, s13, s23, u, v, w, coef)
476 type(field_t), intent(in) :: u, v, w
477 type(coef_t), intent(in) :: coef
478 real(kind=rp), intent(inout) :: s11(u%Xh%lx, u%Xh%ly, u%Xh%lz, u%msh%nelv)
479 real(kind=rp), intent(inout) :: s22(u%Xh%lx, u%Xh%ly, u%Xh%lz, u%msh%nelv)
480 real(kind=rp), intent(inout) :: s33(u%Xh%lx, u%Xh%ly, u%Xh%lz, u%msh%nelv)
481 real(kind=rp), intent(inout) :: s12(u%Xh%lx, u%Xh%ly, u%Xh%lz, u%msh%nelv)
482 real(kind=rp), intent(inout) :: s13(u%Xh%lx, u%Xh%ly, u%Xh%lz, u%msh%nelv)
483 real(kind=rp), intent(inout) :: s23(u%Xh%lx, u%Xh%ly, u%Xh%lz, u%msh%nelv)
484
485 type(c_ptr) :: s11_d, s22_d, s33_d, s12_d, s23_d, s13_d
486
487 integer :: nelv, lxyz
488
489 if (neko_bcknd_device .eq. 1) then
490 s11_d = device_get_ptr(s11)
491 s22_d = device_get_ptr(s22)
492 s33_d = device_get_ptr(s33)
493 s12_d = device_get_ptr(s12)
494 s23_d = device_get_ptr(s23)
495 s13_d = device_get_ptr(s13)
496 end if
497
498 nelv = u%msh%nelv
499 lxyz = u%Xh%lxyz
500
501 ! we use s11 as a work array here
502 call dudxyz (s12, u%x, coef%drdy, coef%dsdy, coef%dtdy, coef)
503 call dudxyz (s11, v%x, coef%drdx, coef%dsdx, coef%dtdx, coef)
504 if (neko_bcknd_device .eq. 1) then
505 call device_add2(s12_d, s11_d, nelv*lxyz)
506 else
507 call add2(s12, s11, nelv*lxyz)
508 end if
509
510 call dudxyz (s13, u%x, coef%drdz, coef%dsdz, coef%dtdz, coef)
511 call dudxyz (s11, w%x, coef%drdx, coef%dsdx, coef%dtdx, coef)
512 if (neko_bcknd_device .eq. 1) then
513 call device_add2(s13_d, s11_d, nelv*lxyz)
514 else
515 call add2(s13, s11, nelv*lxyz)
516 end if
517
518 call dudxyz (s23, v%x, coef%drdz, coef%dsdz, coef%dtdz, coef)
519 call dudxyz (s11, w%x, coef%drdy, coef%dsdy, coef%dtdy, coef)
520 if (neko_bcknd_device .eq. 1) then
521 call device_add2(s23_d, s11_d, nelv*lxyz)
522 else
523 call add2(s23, s11, nelv*lxyz)
524 end if
525
526 call dudxyz (s11, u%x, coef%drdx, coef%dsdx, coef%dtdx, coef)
527 call dudxyz (s22, v%x, coef%drdy, coef%dsdy, coef%dtdy, coef)
528 call dudxyz (s33, w%x, coef%drdz, coef%dsdz, coef%dtdz, coef)
529
530 if (neko_bcknd_device .eq. 1) then
531 call device_cmult(s12_d, 0.5_rp, nelv*lxyz)
532 call device_cmult(s13_d, 0.5_rp, nelv*lxyz)
533 call device_cmult(s23_d, 0.5_rp, nelv*lxyz)
534 else
535 call cmult(s12, 0.5_rp, nelv*lxyz)
536 call cmult(s13, 0.5_rp, nelv*lxyz)
537 call cmult(s23, 0.5_rp, nelv*lxyz)
538 end if
539
540 end subroutine strain_rate
541
548 subroutine lambda2op(lambda2, u, v, w, coef)
549 type(coef_t), intent(in) :: coef
550 type(field_t), intent(inout) :: lambda2
551 type(field_t), intent(in) :: u, v, w
553 if (neko_bcknd_sx .eq. 1) then
554 call opr_sx_lambda2(lambda2, u, v, w, coef)
555 else if (neko_bcknd_device .eq. 1) then
556 call opr_device_lambda2(lambda2, u, v, w, coef)
557 else
558 call opr_cpu_lambda2(lambda2, u, v, w, coef)
559 end if
560
561 end subroutine lambda2op
562
573 subroutine set_convect_rst(cr, cs, ct, cx, cy, cz, Xh, coef)
574 type(space_t), intent(inout) :: xh
575 type(coef_t), intent(inout) :: coef
576 real(kind=rp), dimension(Xh%lxyz, coef%msh%nelv), &
577 intent(inout) :: cr, cs, ct
578 real(kind=rp), dimension(Xh%lxyz, coef%msh%nelv), &
579 intent(in) :: cx, cy, cz
580
581 if (neko_bcknd_sx .eq. 1) then
582 call opr_sx_set_convect_rst(cr, cs, ct, cx, cy, cz, xh, coef)
583 else if (neko_bcknd_xsmm .eq. 1) then
584 call opr_xsmm_set_convect_rst(cr, cs, ct, cx, cy, cz, xh, coef)
585 else
586 call opr_cpu_set_convect_rst(cr, cs, ct, cx, cy, cz, xh, coef)
587 end if
588
589 end subroutine set_convect_rst
590
606 subroutine runge_kutta(phi, c_r1, c_r23, c_r4, Xh_GLL, Xh_GL, coef, &
607 coef_GL, GLL_to_GL, tau, dtau, n, nel, n_GL)
608 type(space_t), intent(in) :: xh_gll
609 type(space_t), intent(inout) :: xh_gl
610 type(coef_t), intent(in) :: coef
611 type(coef_t), intent(inout) :: coef_gl
612 type(interpolator_t) :: gll_to_gl
613 real(kind=rp), intent(inout) :: tau, dtau
614 integer, intent(in) :: n, nel, n_gl
615 real(kind=rp), dimension(n), intent(inout) :: phi
616 real(kind=rp), dimension(3 * n_GL), intent(inout) :: c_r1, c_r23, c_r4
617 real(kind=rp) :: c1, c2, c3
618 ! Work Arrays
619 real(kind=rp), dimension(n) :: u1, r1, r2, r3, r4
620 real(kind=rp), dimension(n_GL) :: u1_gl
621 integer :: i, e
622
623 c1 = 1.
624 c2 = -dtau/2.
625 c3 = -dtau
626
627 ! Stage 1:
628 call invcol3 (u1, phi, coef%B, n)
629 call gll_to_gl%map(u1_gl, u1, nel, xh_gl)
630 call convect_scalar(r1, u1_gl, c_r1, xh_gll, xh_gl, coef, &
631 coef_gl, gll_to_gl)
632 call col2(r1, coef%B, n)
633
634 ! Stage 2:
635 call add3s2 (u1, phi, r1, c1, c2, n)
636 call invcol2 (u1, coef%B, n)
637 call gll_to_gl%map(u1_gl, u1, nel, xh_gl)
638 call convect_scalar(r2, u1_gl, c_r23, xh_gll, xh_gl, coef, &
639 coef_gl, gll_to_gl)
640 call col2(r2, coef%B, n)
641
642 ! Stage 3:
643 call add3s2 (u1, phi, r2, c1, c2, n)
644 call invcol2 (u1, coef%B, n)
645 call gll_to_gl%map(u1_gl, u1, nel, xh_gl)
646 call convect_scalar(r3, u1_gl, c_r23, xh_gll, xh_gl, coef, &
647 coef_gl, gll_to_gl)
648 call col2(r3, coef%B, n)
649
650 ! Stage 4:
651 call add3s2 (u1, phi, r3, c1, c3, n)
652 call invcol2 (u1, coef%B, n)
653 call gll_to_gl%map(u1_gl, u1, nel, xh_gl)
654 call convect_scalar(r4, u1_gl, c_r4, xh_gll, xh_gl, coef, &
655 coef_gl, gll_to_gl)
656 call col2(r4, coef%B, n)
657
658 c1 = -dtau/6.
659 c2 = -dtau/3.
660 do i = 1, n
661 phi(i) = phi(i) + c1 * (r1(i) + r4(i)) + c2 * (r2(i) + r3(i))
662 end do
663
664 end subroutine runge_kutta
665
666
667
668end module operators
669
Return the device pointer for an associated Fortran array.
Definition device.F90:96
Coefficients.
Definition coef.f90:34
Definition comm.F90:1
type(mpi_datatype), public mpi_real_precision
MPI type for working precision of REAL types.
Definition comm.F90:50
type(mpi_comm), public neko_comm
MPI communicator.
Definition comm.F90:42
subroutine, public device_add2(a_d, b_d, n, strm)
Vector addition .
real(kind=rp) function, public device_glsum(a_d, n, strm)
Sum a vector of length n.
subroutine, public device_cmult(a_d, c, n, strm)
Multiplication by constant c .
subroutine, public device_copy(a_d, b_d, n, strm)
Copy a vector .
Device abstraction, common interface for various accelerators.
Definition device.F90:34
subroutine, public field_rzero(a, n)
Zero a real vector.
Defines a field.
Definition field.f90:34
Routines to interpolate between different spaces.
A simulation component that computes lambda2 The values are stored in the field registry under the na...
Definition lambda2.f90:37
Definition math.f90:60
subroutine, public cmult(a, c, n)
Multiplication by constant c .
Definition math.f90:417
subroutine, public invcol2(a, b, n)
Vector division .
Definition math.f90:846
subroutine, public cadd(a, s, n)
Add a scalar to vector .
Definition math.f90:468
real(kind=rp) function, public glsum(a, n)
Sum a vector of length n.
Definition math.f90:505
subroutine, public add2(a, b, n)
Vector addition .
Definition math.f90:732
subroutine, public invcol3(a, b, c, n)
Invert a vector .
Definition math.f90:632
subroutine, public add3s2(a, b, c, c1, c2, n)
Returns .
Definition math.f90:901
subroutine, public col2(a, b, n)
Vector multiplication .
Definition math.f90:860
subroutine, public copy(a, b, n)
Copy a vector .
Definition math.f90:255
subroutine, public rzero(a, n)
Zero a real vector.
Definition math.f90:211
Build configurations.
integer, parameter neko_bcknd_sx
integer, parameter neko_bcknd_device
logical, parameter neko_device_mpi
integer, parameter neko_bcknd_xsmm
integer, parameter, public i8
Definition num_types.f90:7
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Operators.
Definition operators.f90:34
subroutine, public runge_kutta(phi, c_r1, c_r23, c_r4, xh_gll, xh_gl, coef, coef_gl, gll_to_gl, tau, dtau, n, nel, n_gl)
Compute one step of Runge Kutta time interpolation for OIFS scheme.
subroutine, public set_convect_rst(cr, cs, ct, cx, cy, cz, xh, coef)
Transforms the convecting velocity field to the rst form of the GL space.
subroutine, public ortho(x, glb_n_points, n)
Othogonalize with regard to vector (1,1,1,1,1,1...,1)^T.
subroutine convect_scalar(du, u, c, xh_gll, xh_gl, coef_gll, coef_gl, gll_to_gl)
Apply the convecting velocity c to the to the scalar field u, used in the OIFS scheme.
real(kind=rp) function, public cfl(dt, u, v, w, xh, coef, nelv, gdim)
subroutine, public opgrad(ux, uy, uz, u, coef, es, ee)
Compute the weak gradient of a scalar field, i.e. the gradient multiplied by the mass matrix.
subroutine, public div(res, ux, uy, uz, coef)
Compute the divergence of a vector field.
real(kind=rp) function, public cfl_compressible(dt, max_wave_speed, xh, coef, nelv, gdim)
subroutine, public conv1(du, u, vx, vy, vz, xh, coef, es, ee)
Compute the advection term.
subroutine, public grad(ux, uy, uz, u, coef)
Compute the gradient of a scalar field.
subroutine, public curl(w1, w2, w3, u1, u2, u3, work1, work2, coef, event)
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.
subroutine, public lambda2op(lambda2, u, v, w, coef)
Compute the Lambda2 field for a given velocity field.
subroutine, public cdtp(dtx, x, dr, ds, dt, coef, es, ee)
Apply D^T to a scalar field, where D is the derivative matrix.
subroutine, public dudxyz(du, u, dr, ds, dt, coef)
Compute derivative of a scalar field along a single direction.
Definition operators.f90:80
Operators CPU backend.
Definition opr_cpu.f90:34
subroutine, public opr_cpu_curl(w1, w2, w3, u1, u2, u3, work1, work2, c_xh)
Definition opr_cpu.f90:124
real(kind=rp) function, public opr_cpu_cfl(dt, u, v, w, xh, coef, nelv, gdim)
Definition opr_cpu.f90:175
subroutine, public opr_cpu_lambda2(lambda2, u, v, w, coef)
Definition opr_cpu.f90:235
Operators accelerator backends.
subroutine, public opr_device_cdtp(dtx, x, dr, ds, dt, coef)
real(kind=rp) function, public opr_device_cfl(dt, u, v, w, xh, coef, nelv, gdim)
subroutine, public opr_device_curl(w1, w2, w3, u1, u2, u3, work1, work2, c_xh, event)
subroutine, public opr_device_dudxyz(du, u, dr, ds, dt, coef)
subroutine, public opr_device_opgrad(ux, uy, uz, u, coef)
subroutine, public opr_device_conv1(du, u, vx, vy, vz, xh, coef, nelv, gdim)
subroutine, public opr_device_lambda2(lambda2, u, v, w, coef)
Operators SX-Aurora backend.
Definition opr_sx.f90:2
subroutine, public opr_sx_curl(w1, w2, w3, u1, u2, u3, work1, work2, c_xh)
Definition opr_sx.f90:100
Operators libxsmm backend.
Definition opr_xsmm.F90:61
subroutine, public opr_xsmm_conv1(du, u, vx, vy, vz, xh, coef, nelv, gdim)
Definition opr_xsmm.F90:297
subroutine, public opr_xsmm_cdtp(dtx, x, dr, ds, dt, coef)
Definition opr_xsmm.F90:242
subroutine, public opr_xsmm_curl(w1, w2, w3, u1, u2, u3, work1, work2, c_xh)
Definition opr_xsmm.F90:416
subroutine, public opr_xsmm_dudxyz(du, u, dr, ds, dt, coef)
Definition opr_xsmm.F90:92
subroutine, public opr_xsmm_opgrad(ux, uy, uz, u, coef)
Definition opr_xsmm.F90:146
subroutine, public opr_xsmm_set_convect_rst(cr, cs, ct, cx, cy, cz, xh, coef)
Definition opr_xsmm.F90:467
subroutine, public opr_xsmm_convect_scalar(du, u, c, xh_gll, xh_gl, coef_gll, coef_gl, gll_to_gl)
Definition opr_xsmm.F90:371
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.
Defines a function space.
Definition space.f90:34
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:55
Interpolation between two space::space_t.
The function space for the SEM solution fields.
Definition space.f90:62