237 type(
space_t),
intent(in) :: Xh
238 type(
coef_t),
intent(in) :: coef
239 type(
field_t),
intent(inout) :: vx, vy, vz
240 type(
field_t),
intent(inout) :: fx, fy, fz
241 integer,
intent(in) :: n
242 real(kind=
rp),
intent(in),
optional :: dt
244 real(kind=
rp),
dimension(this%Xh_GL%lxyz) :: tx, ty, tz
245 real(kind=
rp),
dimension(this%Xh_GL%lxyz) :: tfx, tfy, tfz
246 real(kind=
rp),
dimension(this%Xh_GL%lxyz) :: vr, vs, vt
247 real(kind=
rp),
dimension(this%Xh_GLL%lxyz) :: tempx, tempy, tempz
248 integer :: e, i, idx, nel, n_GL
251 n_gl = nel * this%Xh_GL%lxyz
254 associate(c_gl => this%coef_GL)
256 call this%GLL_to_GL%map(this%tx, vx%x, nel, this%Xh_GL)
257 call this%GLL_to_GL%map(this%ty, vy%x, nel, this%Xh_GL)
258 call this%GLL_to_GL%map(this%tz, vz%x, nel, this%Xh_GL)
260 call opgrad(this%vr, this%vs, this%vt, this%tx, c_gl)
261 call device_vdot3(this%tbf_d, this%vr_d, this%vs_d, this%vt_d, &
262 this%tx_d, this%ty_d, this%tz_d, n_gl)
263 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
267 call opgrad(this%vr, this%vs, this%vt, this%ty, c_gl)
268 call device_vdot3(this%tbf_d, this%vr_d, this%vs_d, this%vt_d, &
269 this%tx_d, this%ty_d, this%tz_d, n_gl)
270 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
273 call opgrad(this%vr, this%vs, this%vt, this%tz, c_gl)
274 call device_vdot3(this%tbf_d, this%vr_d, this%vs_d, this%vt_d, &
275 this%tx_d, this%ty_d, this%tz_d, n_gl)
276 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
281 call this%GLL_to_GL%map(this%tx, vx%x, nel, this%Xh_GL)
282 call this%GLL_to_GL%map(this%ty, vy%x, nel, this%Xh_GL)
283 call this%GLL_to_GL%map(this%tz, vz%x, nel, this%Xh_GL)
285 call opgrad(this%vr, this%vs, this%vt, this%tx, c_gl)
286 call vdot3(this%tbf, this%vr, this%vs, this%vt, &
287 this%tx, this%ty, this%tz, n_gl)
288 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
289 call sub2(fx%x, this%temp, n)
292 call opgrad(this%vr, this%vs, this%vt, this%ty, c_gl)
293 call vdot3(this%tbf, this%vr, this%vs, this%vt, &
294 this%tx, this%ty, this%tz, n_gl)
295 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
296 call sub2(fy%x, this%temp, n)
298 call opgrad(this%vr, this%vs, this%vt, this%tz, c_gl)
299 call vdot3(this%tbf, this%vr, this%vs, this%vt, &
300 this%tx, this%ty, this%tz, n_gl)
301 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
302 call sub2(fz%x, this%temp, n)
307 do e = 1, coef%msh%nelv
308 call this%GLL_to_GL%map(tx, vx%x(1,1,1,e), 1, this%Xh_GL)
309 call this%GLL_to_GL%map(ty, vy%x(1,1,1,e), 1, this%Xh_GL)
310 call this%GLL_to_GL%map(tz, vz%x(1,1,1,e), 1, this%Xh_GL)
312 call opgrad(vr, vs, vt, tx, c_gl, e, e)
313 do i = 1, this%Xh_GL%lxyz
314 tfx(i) = tx(i)*vr(i) + ty(i)*vs(i) + tz(i)*vt(i)
317 call opgrad(vr, vs, vt, ty, c_gl, e, e)
318 do i = 1, this%Xh_GL%lxyz
319 tfy(i) = tx(i)*vr(i) + ty(i)*vs(i) + tz(i)*vt(i)
322 call opgrad(vr, vs, vt, tz, c_gl, e, e)
323 do i = 1, this%Xh_GL%lxyz
324 tfz(i) = tx(i)*vr(i) + ty(i)*vs(i) + tz(i)*vt(i)
327 call this%GLL_to_GL%map(tempx, tfx, 1, this%Xh_GLL)
328 call this%GLL_to_GL%map(tempy, tfy, 1, this%Xh_GLL)
329 call this%GLL_to_GL%map(tempz, tfz, 1, this%Xh_GLL)
331 idx = (e-1)*this%Xh_GLL%lxyz+1
332 do concurrent(i = 0:this%Xh_GLL%lxyz-1)
333 fx%x(i+idx,1,1,1) = fx%x(i+idx,1,1,1) - tempx(i+1)
334 fy%x(i+idx,1,1,1) = fy%x(i+idx,1,1,1) - tempy(i+1)
335 fz%x(i+idx,1,1,1) = fz%x(i+idx,1,1,1) - tempz(i+1)
359 type(field_t),
intent(inout) :: vx, vy, vz
360 type(field_t),
intent(inout) :: s
361 type(field_t),
intent(inout) :: fs
362 type(space_t),
intent(in) :: Xh
363 type(coef_t),
intent(in) :: coef
364 integer,
intent(in) :: n
365 real(kind=rp),
intent(in),
optional :: dt
367 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: vx_gl, vy_gl, vz_gl, s_gl
368 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: dsdx, dsdy, dsdz
369 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: f_gl
370 integer :: e, i, idx, nel, n_GL
371 real(kind=rp),
dimension(this%Xh_GLL%lxyz) :: temp
374 n_gl = nel * this%Xh_GL%lxyz
376 associate(c_gl => this%coef_GL)
377 if (neko_bcknd_device .eq. 1)
then
380 call this%GLL_to_GL%map(this%tx, vx%x, nel, this%Xh_GL)
381 call this%GLL_to_GL%map(this%ty, vy%x, nel, this%Xh_GL)
382 call this%GLL_to_GL%map(this%tz, vz%x, nel, this%Xh_GL)
385 call this%GLL_to_GL%map(this%temp, s%x, nel, this%Xh_GL)
388 call opgrad(this%vr, this%vs, this%vt, this%temp, c_gl)
392 call device_vdot3(this%tbf_d, this%vr_d, this%vs_d, this%vt_d, &
393 this%tx_d, this%ty_d, this%tz_d, n_gl)
396 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
399 call device_sub2(fs%x_d, this%temp_d, n)
401 else if ((neko_bcknd_sx .eq. 1) .or. (neko_bcknd_xsmm .eq. 1))
then
404 call this%GLL_to_GL%map(this%tx, vx%x, nel, this%Xh_GL)
405 call this%GLL_to_GL%map(this%ty, vy%x, nel, this%Xh_GL)
406 call this%GLL_to_GL%map(this%tz, vz%x, nel, this%Xh_GL)
409 call this%GLL_to_GL%map(this%temp, s%x, nel, this%Xh_GL)
412 call opgrad(this%vr, this%vs, this%vt, this%temp, c_gl)
416 call vdot3(this%tbf, this%vr, this%vs, this%vt, &
417 this%tx, this%ty, this%tz, n_gl)
420 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
423 call sub2(fs%x, this%temp, n)
427 do e = 1, coef%msh%nelv
429 call this%GLL_to_GL%map(vx_gl, vx%x(1,1,1,e), 1, this%Xh_GL)
430 call this%GLL_to_GL%map(vy_gl, vy%x(1,1,1,e), 1, this%Xh_GL)
431 call this%GLL_to_GL%map(vz_gl, vz%x(1,1,1,e), 1, this%Xh_GL)
434 call this%GLL_to_GL%map(s_gl, s%x(1,1,1,e), 1, this%Xh_GL)
437 call opgrad(dsdx, dsdy, dsdz, s_gl, c_gl, e, e)
440 do i = 1, this%Xh_GL%lxyz
441 f_gl(i) = vx_gl(i)*dsdx(i) + vy_gl(i)*dsdy(i) + vz_gl(i)*dsdz(i)
445 call this%GLL_to_GL%map(temp, f_gl, 1, this%Xh_GLL)
447 idx = (e-1)*this%Xh_GLL%lxyz + 1
449 call sub2(fs%x(idx, 1, 1, 1), temp, this%Xh_GLL%lxyz)
479 wm_x, wm_y, wm_z, fx, fy, fz, Xh, coef, n, dt)
481 type(field_t),
intent(inout) :: vx, vy, vz
482 type(field_t),
intent(inout) :: wm_x, wm_y, wm_z
483 type(field_t),
intent(inout) :: fx, fy, fz
484 type(space_t),
intent(in) :: Xh
485 type(coef_t),
intent(in) :: coef
486 integer,
intent(in) :: n
487 real(kind=rp),
intent(in),
optional :: dt
488 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: vx_gl, vy_gl, vz_gl
489 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: wm_x_gl, wm_y_gl, wm_z_gl
490 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: flux_gl
491 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: grad_x, grad_y, grad_z
492 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: total_div_gl
493 integer :: e, i, idx, nel, n_GL
494 real(kind=rp),
dimension(this%Xh_GLL%lxyz) :: temp_x, temp_y, temp_z
497 n_gl = nel * this%Xh_GL%lxyz
499 associate(c_gl => this%coef_GL)
500 if (neko_bcknd_device .eq. 1)
then
503 call this%GLL_to_GL%map(this%vr, wm_x%x, nel, this%Xh_GL)
504 call this%GLL_to_GL%map(this%vs, wm_y%x, nel, this%Xh_GL)
505 call this%GLL_to_GL%map(this%vt, wm_z%x, nel, this%Xh_GL)
509 call this%GLL_to_GL%map(this%temp, vx%x, nel, this%Xh_GL)
510 call device_col3(this%temp_d, this%temp_d, this%vr_d, n_gl)
511 call opgrad(this%tz, this%tx, this%ty, this%temp, c_gl)
514 call this%GLL_to_GL%map(this%temp, vx%x, nel, this%Xh_GL)
515 call device_col3(this%temp_d, this%temp_d, this%vs_d, n_gl)
516 call opgrad(this%tx, this%tbf, this%ty, this%temp, c_gl)
517 call device_add2(this%tz_d, this%tbf_d, n_gl)
520 call this%GLL_to_GL%map(this%temp, vx%x, nel, this%Xh_GL)
521 call device_col3(this%temp_d, this%temp_d, this%vt_d, n_gl)
522 call opgrad(this%tx, this%ty, this%tbf, this%temp, c_gl)
523 call device_add2(this%tz_d, this%tbf_d, n_gl)
526 call this%GLL_to_GL%map(this%temp, this%tz, nel, this%Xh_GLL)
527 call device_add2(fx%x_d, this%temp_d, n)
531 call this%GLL_to_GL%map(this%temp, vy%x, nel, this%Xh_GL)
532 call device_col3(this%temp_d, this%temp_d, this%vr_d, n_gl)
533 call opgrad(this%tz, this%tx, this%ty, this%temp, c_gl)
536 call this%GLL_to_GL%map(this%temp, vy%x, nel, this%Xh_GL)
537 call device_col3(this%temp_d, this%temp_d, this%vs_d, n_gl)
538 call opgrad(this%tx, this%tbf, this%ty, this%temp, c_gl)
539 call device_add2(this%tz_d, this%tbf_d, n_gl)
542 call this%GLL_to_GL%map(this%temp, vy%x, nel, this%Xh_GL)
543 call device_col3(this%temp_d, this%temp_d, this%vt_d, n_gl)
544 call opgrad(this%tx, this%ty, this%tbf, this%temp, c_gl)
545 call device_add2(this%tz_d, this%tbf_d, n_gl)
547 call this%GLL_to_GL%map(this%temp, this%tz, nel, this%Xh_GLL)
548 call device_add2(fy%x_d, this%temp_d, n)
552 call this%GLL_to_GL%map(this%temp, vz%x, nel, this%Xh_GL)
553 call device_col3(this%temp_d, this%temp_d, this%vr_d, n_gl)
554 call opgrad(this%tz, this%tx, this%ty, this%temp, c_gl)
557 call this%GLL_to_GL%map(this%temp, vz%x, nel, this%Xh_GL)
558 call device_col3(this%temp_d, this%temp_d, this%vs_d, n_gl)
559 call opgrad(this%tx, this%tbf, this%ty, this%temp, c_gl)
560 call device_add2(this%tz_d, this%tbf_d, n_gl)
563 call this%GLL_to_GL%map(this%temp, vz%x, nel, this%Xh_GL)
564 call device_col3(this%temp_d, this%temp_d, this%vt_d, n_gl)
565 call opgrad(this%tx, this%ty, this%tbf, this%temp, c_gl)
566 call device_add2(this%tz_d, this%tbf_d, n_gl)
568 call this%GLL_to_GL%map(this%temp, this%tz, nel, this%Xh_GLL)
569 call device_add2(fz%x_d, this%temp_d, n)
573 do e = 1, coef%msh%nelv
576 call this%GLL_to_GL%map(vx_gl, vx%x(1,1,1,e), 1, this%Xh_GL)
577 call this%GLL_to_GL%map(vy_gl, vy%x(1,1,1,e), 1, this%Xh_GL)
578 call this%GLL_to_GL%map(vz_gl, vz%x(1,1,1,e), 1, this%Xh_GL)
579 call this%GLL_to_GL%map(wm_x_gl, wm_x%x(1,1,1,e), 1, this%Xh_GL)
580 call this%GLL_to_GL%map(wm_y_gl, wm_y%x(1,1,1,e), 1, this%Xh_GL)
581 call this%GLL_to_GL%map(wm_z_gl, wm_z%x(1,1,1,e), 1, this%Xh_GL)
586 total_div_gl = 0.0_rp
590 flux_gl = vx_gl * wm_x_gl
591 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
592 total_div_gl = total_div_gl + grad_x
593 flux_gl = vx_gl * wm_y_gl
594 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
595 total_div_gl = total_div_gl + grad_y
596 flux_gl = vx_gl * wm_z_gl
597 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
598 total_div_gl = total_div_gl + grad_z
601 call this%GLL_to_GL%map(temp_x, total_div_gl, 1, this%Xh_GLL)
604 total_div_gl = 0.0_rp
608 flux_gl = vy_gl * wm_x_gl
609 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
610 total_div_gl = total_div_gl + grad_x
611 flux_gl = vy_gl * wm_y_gl
612 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
613 total_div_gl = total_div_gl + grad_y
614 flux_gl = vy_gl * wm_z_gl
615 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
616 total_div_gl = total_div_gl + grad_z
619 call this%GLL_to_GL%map(temp_y, total_div_gl, 1, this%Xh_GLL)
622 total_div_gl = 0.0_rp
626 flux_gl = vz_gl * wm_x_gl
627 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
628 total_div_gl = total_div_gl + grad_x
629 flux_gl = vz_gl * wm_y_gl
630 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
631 total_div_gl = total_div_gl + grad_y
632 flux_gl = vz_gl * wm_z_gl
633 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
634 total_div_gl = total_div_gl + grad_z
637 call this%GLL_to_GL%map(temp_z, total_div_gl, 1, this%Xh_GLL)
642 idx = (e-1)*this%Xh_GLL%lxyz+1
643 do concurrent(i = 0:this%Xh_GLL%lxyz-1)
644 fx%x(i+idx,1,1,1) = fx%x(i+idx,1,1,1) + temp_x(i+1)
645 fy%x(i+idx,1,1,1) = fy%x(i+idx,1,1,1) + temp_y(i+1)
646 fz%x(i+idx,1,1,1) = fz%x(i+idx,1,1,1) + temp_z(i+1)