39 opr_cpu_conv1, opr_cpu_convect_scalar, opr_cpu_cdtp, &
43 opr_sx_conv1, opr_sx_convect_scalar, opr_sx_cdtp, &
44 opr_sx_dudxyz, opr_sx_lambda2, opr_sx_set_convect_rst
67 use mpi_f08,
only : mpi_allreduce, mpi_in_place, mpi_max, mpi_sum, &
69 use,
intrinsic :: iso_c_binding, only : c_ptr
88 module procedure div_d
100 module procedure cfl_d
101 module procedure cfl_f
135 real(kind=
rp),
contiguous,
dimension(:,:,:,:),
intent(inout) :: du
136 real(kind=
rp),
contiguous,
dimension(:,:,:,:),
intent(in) :: u, dr, ds, dt
137 type(
coef_t),
intent(in) :: coef
138 type(c_ptr) :: du_d, u_d, dr_d, ds_d, dt_d
141 call opr_sx_dudxyz(du, u, dr, ds, dt, coef)
145 call neko_log%deprecated(
'Operator: dudxyz, implicit device', &
146 '2.0.0',
'Please call opr_device_dudxyz instead.')
156 call opr_cpu_dudxyz(du, u, dr, ds, dt, coef)
169 type(
field_t),
intent(inout) :: du
170 type(
field_t),
intent(in) :: u, dr, ds, dt
171 type(
coef_t),
intent(in) :: coef
174 call opr_sx_dudxyz(du%x, u%x, dr%x, ds%x, dt%x, coef)
180 call opr_cpu_dudxyz(du%x, u%x, dr%x, ds%x, dt%x, coef)
192 real(kind=
rp),
contiguous,
dimension(:,:,:,:),
intent(inout) :: res
193 real(kind=
rp),
contiguous,
dimension(:,:,:,:),
intent(in) :: ux, uy, uz
194 type(
coef_t),
intent(in),
target :: coef
200 call neko_log%deprecated(
'Operator: div, implicit device', &
201 '2.0.0',
'Please call div_d instead.')
208 call dudxyz(res, ux, coef%drdx, coef%dsdx, coef%dtdx, coef)
211 call dudxyz(work%x, uy, coef%drdy, coef%dsdy, coef%dtdy, coef)
215 call add2(res, work%x, work%size())
219 call dudxyz(work%x, uz, coef%drdz, coef%dsdz, coef%dtdz, coef)
223 call add2(res, work%x, work%size())
236 subroutine div_d(res_d, ux_d, uy_d, uz_d, coef)
237 type(c_ptr),
intent(inout) :: res_d
238 type(c_ptr),
intent(in) :: ux_d, uy_d, uz_d
239 type(
coef_t),
intent(in),
target :: coef
246 call dudxyz(res_d, ux_d, coef%drdx_d, coef%dsdx_d, coef%dtdx_d, coef)
249 call dudxyz(work%x_d, uy_d, coef%drdy_d, coef%dsdy_d, coef%dtdy_d, coef)
253 call dudxyz(work%x_d, uz_d, coef%drdz_d, coef%dsdz_d, coef%dtdz_d, coef)
267 type(
coef_t),
intent(in) :: coef
268 real(kind=
rp),
contiguous,
dimension(:,:,:,:),
intent(inout) :: ux
269 real(kind=
rp),
contiguous,
dimension(:,:,:,:),
intent(inout) :: uy
270 real(kind=
rp),
contiguous,
dimension(:,:,:,:),
intent(inout) :: uz
271 real(kind=
rp),
contiguous,
dimension(:,:,:,:),
intent(in) :: u
273 call dudxyz(ux, u, coef%drdx, coef%dsdx, coef%dtdx, coef)
274 call dudxyz(uy, u, coef%drdy, coef%dsdy, coef%dtdy, coef)
275 call dudxyz(uz, u, coef%drdz, coef%dsdz, coef%dtdz, coef)
285 subroutine grad_d(ux_d, uy_d, uz_d, u_d, coef)
286 type(
coef_t),
intent(in) :: coef
287 type(c_ptr),
intent(inout) :: ux_d, uy_d, uz_d
288 type(c_ptr),
intent(in) :: u_d
290 call dudxyz(ux_d, u_d, coef%drdx_d, coef%dsdx_d, coef%dtdx_d, coef)
291 call dudxyz(uy_d, u_d, coef%drdy_d, coef%dsdy_d, coef%dtdy_d, coef)
292 call dudxyz(uz_d, u_d, coef%drdz_d, coef%dsdz_d, coef%dtdz_d, coef)
308 subroutine opgrad(ux, uy, uz, u, coef, es, ee)
309 type(
coef_t),
intent(in) :: coef
310 real(kind=
rp),
dimension(coef%Xh%lxyz, coef%msh%nelv),
intent(inout) :: ux
311 real(kind=
rp),
dimension(coef%Xh%lxyz, coef%msh%nelv),
intent(inout) :: uy
312 real(kind=
rp),
dimension(coef%Xh%lxyz, coef%msh%nelv),
intent(inout) :: uz
313 real(kind=
rp),
dimension(coef%Xh%lxyz, coef%msh%nelv),
intent(in) :: u
314 integer,
optional :: es, ee
315 integer :: eblk_start, eblk_end
316 type(c_ptr) :: ux_d, uy_d, uz_d, u_d
318 if (
present(es))
then
324 if (
present(ee))
then
327 eblk_end = coef%msh%nelv
331 call opr_sx_opgrad(ux, uy, uz, u, coef)
341 call opr_cpu_opgrad(ux, uy, uz, u, coef, eblk_start, eblk_end)
350 subroutine ortho(x, glb_n_points, n)
351 integer,
intent(in) :: n
352 integer(kind=i8),
intent(in) :: glb_n_points
353 real(kind=
rp),
dimension(n),
intent(inout) :: x
358 call neko_log%deprecated(
'Operator: ortho, implicit device', &
359 '2.0.0',
'Please call device_ortho instead.')
365 c =
glsum(x, n) / glb_n_points
382 subroutine cdtp(dtx, x, dr, ds, dt, coef, es, ee)
383 type(
coef_t),
intent(in) :: coef
384 real(kind=
rp),
dimension(coef%Xh%lxyz, coef%msh%nelv),
intent(inout) :: dtx
385 real(kind=
rp),
dimension(coef%Xh%lxyz, coef%msh%nelv),
intent(inout) :: x
386 real(kind=
rp),
dimension(coef%Xh%lxyz, coef%msh%nelv),
intent(in) :: dr
387 real(kind=
rp),
dimension(coef%Xh%lxyz, coef%msh%nelv),
intent(in) :: ds
388 real(kind=
rp),
dimension(coef%Xh%lxyz, coef%msh%nelv),
intent(in) :: dt
389 integer,
optional :: es, ee
390 integer :: eblk_start, eblk_end
391 type(c_ptr) :: dtx_d, x_d, dr_d, ds_d, dt_d
393 if (
present(es))
then
399 if (
present(ee))
then
402 eblk_end = coef%msh%nelv
406 call opr_sx_cdtp(dtx, x, dr, ds, dt, coef)
417 call opr_cpu_cdtp(dtx, x, dr, ds, dt, coef, eblk_start, eblk_end)
432 subroutine conv1(du, u, vx, vy, vz, Xh, coef, es, ee)
433 type(
space_t),
intent(in) :: xh
434 type(
coef_t),
intent(in) :: coef
435 real(kind=
rp),
intent(inout) :: du(xh%lxyz, coef%msh%nelv)
436 real(kind=
rp),
intent(in) :: u(xh%lx, xh%ly, xh%lz, coef%msh%nelv)
437 real(kind=
rp),
intent(in) :: vx(xh%lx, xh%ly, xh%lz, coef%msh%nelv)
438 real(kind=
rp),
intent(in) :: vy(xh%lx, xh%ly, xh%lz, coef%msh%nelv)
439 real(kind=
rp),
intent(in) :: vz(xh%lx, xh%ly, xh%lz, coef%msh%nelv)
440 integer,
optional :: es, ee
441 integer :: eblk_end, eblk_start
442 type(c_ptr) :: du_d, u_d, vx_d, vy_d, vz_d
444 associate(nelv => coef%msh%nelv, gdim => coef%msh%gdim)
445 if (
present(es))
then
451 if (
present(ee))
then
454 eblk_end = coef%msh%nelv
458 call opr_sx_conv1(du, u, vx, vy, vz, xh, coef, nelv)
469 call opr_cpu_conv1(du, u, vx, vy, vz, xh, coef, eblk_start, eblk_end)
494 type(space_t),
intent(in) :: Xh_GL
495 type(space_t),
intent(in) :: Xh_GLL
496 type(coef_t),
intent(in) :: coef_GLL
497 type(coef_t),
intent(in) :: coef_GL
498 type(interpolator_t),
intent(inout) :: GLL_to_GL
499 real(kind=rp),
intent(inout) :: &
500 du(xh_gll%lx, xh_gll%ly, xh_gll%lz, coef_gl%msh%nelv)
501 real(kind=rp),
intent(inout) :: &
502 u(xh_gl%lx, xh_gl%lx, xh_gl%lx, coef_gl%msh%nelv)
503 type(field_t),
intent(inout) :: cr, cs, ct
506 if (neko_bcknd_sx .eq. 1)
then
507 call opr_sx_convect_scalar(du, u, cr%x, cs%x, ct%x, &
508 xh_gll, xh_gl, coef_gll, coef_gl, gll_to_gl)
509 else if (neko_bcknd_xsmm .eq. 1)
then
510 call opr_xsmm_convect_scalar(du, u, cr%x, cs%x, ct%x, &
511 xh_gll, xh_gl, coef_gll, coef_gl, gll_to_gl)
512 else if (neko_bcknd_device .eq. 1)
then
513 u_d = device_get_ptr(u)
514 call opr_device_convect_scalar(du, u_d, cr%x_d, cs%x_d, ct%x_d, &
515 xh_gll, xh_gl, coef_gll, coef_gl, gll_to_gl)
517 call opr_cpu_convect_scalar(du, u, cr%x, cs%x, ct%x, &
518 xh_gll, xh_gl, coef_gll, coef_gl, gll_to_gl)
533 subroutine curl(w1, w2, w3, u1, u2, u3, work1, work2, coef, event)
534 type(field_t),
intent(inout) :: w1
535 type(field_t),
intent(inout) :: w2
536 type(field_t),
intent(inout) :: w3
537 type(field_t),
intent(in) :: u1
538 type(field_t),
intent(in) :: u2
539 type(field_t),
intent(in) :: u3
540 type(field_t),
intent(inout) :: work1
541 type(field_t),
intent(inout) :: work2
542 type(coef_t),
intent(in) :: coef
543 type(c_ptr),
optional,
intent(inout) :: event
545 if (neko_bcknd_sx .eq. 1)
then
546 call opr_sx_curl(w1%x, w2%x, w3%x, u1%x, u2%x, u3%x, &
547 work1%x, work2%x, coef)
548 else if (neko_bcknd_xsmm .eq. 1)
then
549 call opr_xsmm_curl(w1%x, w2%x, w3%x, u1%x, u2%x, u3%x, &
550 work1%x, work2%x, coef)
551 else if (neko_bcknd_device .eq. 1)
then
552 call opr_device_curl(w1, w2, w3, u1, u2, u3, &
553 work1, work2, coef, event)
555 call opr_cpu_curl(w1%x, w2%x, w3%x, u1%x, u2%x, u3%x, &
556 work1%x, work2%x, coef)
570 function cfl_r4(dt, u, v, w, Xh, coef, nelv, gdim)
571 real(kind=dp),
intent(in) :: dt
572 real(kind=rp),
contiguous,
dimension(:,:,:,:),
intent(in) :: u, v, w
573 type(space_t),
intent(in) :: xh
574 type(coef_t),
intent(in) :: coef
575 integer,
intent(in) :: nelv, gdim
578 type(c_ptr) :: u_d, v_d, w_d
580 if (neko_bcknd_sx .eq. 1)
then
581 cfl_r4 = opr_sx_cfl(dt, u, v, w, xh, coef, nelv)
582 else if (neko_bcknd_device .eq. 1)
then
583 call neko_log%deprecated(
'Operator: cfl_r4, implicit device', &
584 '2.0.0',
'Please call cfl_d instead.')
586 u_d = device_get_ptr(u)
587 v_d = device_get_ptr(v)
588 w_d = device_get_ptr(w)
590 cfl_r4 = opr_device_cfl(dt, u_d, v_d, w_d, xh, coef, nelv, gdim)
592 cfl_r4 = opr_cpu_cfl(dt, u, v, w, xh, coef, nelv, gdim)
595 if (.not. neko_device_mpi)
then
596 call mpi_allreduce(mpi_in_place,
cfl_r4, 1, &
597 mpi_double_precision, mpi_max, neko_comm, ierr)
602 function cfl_d(dt, u_d, v_d, w_d, Xh, coef, nelv, gdim)
603 real(kind=dp),
intent(in) :: dt
604 type(c_ptr),
intent(in) :: u_d, v_d, w_d
605 type(space_t),
intent(in) :: xh
606 type(coef_t),
intent(in) :: coef
607 integer,
intent(in) :: nelv, gdim
608 real(kind=dp) ::
cfl_d
611 cfl_d = opr_device_cfl(dt, u_d, v_d, w_d, xh, coef, nelv, gdim)
613 if (.not. neko_device_mpi)
then
614 call mpi_allreduce(mpi_in_place,
cfl_d, 1, &
615 mpi_double_precision, mpi_max, neko_comm, ierr)
620 function cfl_f(dt, u, v, w, Xh, coef, nelv, gdim)
621 real(kind=dp),
intent(in) :: dt
622 type(field_t),
intent(in) :: u, v, w
623 type(space_t),
intent(in) :: xh
624 type(coef_t),
intent(in) :: coef
625 integer,
intent(in) :: nelv, gdim
626 real(kind=dp) ::
cfl_f
629 if (neko_bcknd_sx .eq. 1)
then
630 cfl_f = opr_sx_cfl(dt, u%x, v%x, w%x, xh, coef, nelv)
631 else if (neko_bcknd_device .eq. 1)
then
632 cfl_f = opr_device_cfl(dt, u%x_d, v%x_d, w%x_d, xh, coef, nelv, gdim)
634 cfl_f = opr_cpu_cfl(dt, u%x, v%x, w%x, xh, coef, nelv, gdim)
637 if (.not. neko_device_mpi)
then
638 call mpi_allreduce(mpi_in_place,
cfl_f, 1, &
639 mpi_double_precision, mpi_max, neko_comm, ierr)
652 real(kind=dp),
intent(in) :: dt
653 real(kind=rp),
contiguous,
dimension(:,:,:,:),
intent(in) :: max_wave_speed
654 type(space_t),
intent(in) :: xh
655 type(coef_t),
intent(in) :: coef
656 integer,
intent(in) :: nelv, gdim
660 max_wave_speed, xh, coef, nelv, gdim)
672 real(kind=dp),
intent(in) :: dt
673 type(c_ptr),
intent(in) :: max_wave_speed
674 type(space_t),
intent(in) :: xh
675 type(coef_t),
intent(in) :: coef
676 integer,
intent(in) :: nelv, gdim
680 max_wave_speed, xh, coef, nelv, gdim)
692 real(kind=dp),
intent(in) :: dt
693 type(field_t),
intent(in) :: max_wave_speed
694 type(space_t),
intent(in) :: xh
695 type(coef_t),
intent(in) :: coef
696 integer,
intent(in) :: nelv, gdim
700 max_wave_speed, xh, coef, nelv, gdim)
717 real(kind=rp),
contiguous,
intent(inout) :: s11(:,:,:,:)
718 real(kind=rp),
contiguous,
intent(inout) :: s22(:,:,:,:)
719 real(kind=rp),
contiguous,
intent(inout) :: s33(:,:,:,:)
720 real(kind=rp),
contiguous,
intent(inout) :: s12(:,:,:,:)
721 real(kind=rp),
contiguous,
intent(inout) :: s13(:,:,:,:)
722 real(kind=rp),
contiguous,
intent(inout) :: s23(:,:,:,:)
723 real(kind=rp),
contiguous,
intent(in) :: u(:,:,:,:), v(:,:,:,:), w(:,:,:,:)
724 type(coef_t),
intent(in) :: coef
726 type(c_ptr) :: s11_d, s22_d, s33_d, s12_d, s23_d, s13_d, u_d, v_d, w_d
728 integer :: nelv, lxyz
733 if (neko_bcknd_device .eq. 1)
then
734 call neko_log%deprecated(
'Operator: strain_rate_r4, implicit device', &
735 '2.0.0',
'Please call strain_rate_d instead.')
736 s11_d = device_get_ptr(s11)
737 s22_d = device_get_ptr(s22)
738 s33_d = device_get_ptr(s33)
739 s12_d = device_get_ptr(s12)
740 s23_d = device_get_ptr(s23)
741 s13_d = device_get_ptr(s13)
742 u_d = device_get_ptr(u)
743 v_d = device_get_ptr(v)
744 w_d = device_get_ptr(w)
746 call dudxyz(s12_d, u_d, coef%drdy_d, coef%dsdy_d, coef%dtdy_d, coef)
747 call dudxyz(s11_d, v_d, coef%drdx_d, coef%dsdx_d, coef%dtdx_d, coef)
748 call device_add2(s12_d, s11_d, nelv*lxyz)
750 call dudxyz(s13_d, u_d, coef%drdz_d, coef%dsdz_d, coef%dtdz_d, coef)
751 call dudxyz(s11_d, w_d, coef%drdx_d, coef%dsdx_d, coef%dtdx_d, coef)
752 call device_add2(s13_d, s11_d, nelv*lxyz)
754 call dudxyz(s23_d, v_d, coef%drdz_d, coef%dsdz_d, coef%dtdz_d, coef)
755 call dudxyz(s11_d, w_d, coef%drdy_d, coef%dsdy_d, coef%dtdy_d, coef)
756 call device_add2(s23_d, s11_d, nelv*lxyz)
758 call dudxyz(s11_d, u_d, coef%drdx_d, coef%dsdx_d, coef%dtdx_d, coef)
759 call dudxyz(s22_d, v_d, coef%drdy_d, coef%dsdy_d, coef%dtdy_d, coef)
760 call dudxyz(s33_d, w_d, coef%drdz_d, coef%dsdz_d, coef%dtdz_d, coef)
761 call device_cmult(s12_d, 0.5_rp, nelv*lxyz)
762 call device_cmult(s13_d, 0.5_rp, nelv*lxyz)
763 call device_cmult(s23_d, 0.5_rp, nelv*lxyz)
765 call dudxyz(s12, u, coef%drdy, coef%dsdy, coef%dtdy, coef)
766 call dudxyz(s11, v, coef%drdx, coef%dsdx, coef%dtdx, coef)
767 call add2(s12, s11, nelv*lxyz)
769 call dudxyz(s13, u, coef%drdz, coef%dsdz, coef%dtdz, coef)
770 call dudxyz(s11, w, coef%drdx, coef%dsdx, coef%dtdx, coef)
771 call add2(s13, s11, nelv*lxyz)
773 call dudxyz(s23, v, coef%drdz, coef%dsdz, coef%dtdz, coef)
774 call dudxyz(s11, w, coef%drdy, coef%dsdy, coef%dtdy, coef)
775 call add2(s23, s11, nelv*lxyz)
777 call dudxyz(s11, u, coef%drdx, coef%dsdx, coef%dtdx, coef)
778 call dudxyz(s22, v, coef%drdy, coef%dsdy, coef%dtdy, coef)
779 call dudxyz(s33, w, coef%drdz, coef%dsdz, coef%dtdz, coef)
780 call cmult(s12, 0.5_rp, nelv*lxyz)
781 call cmult(s13, 0.5_rp, nelv*lxyz)
782 call cmult(s23, 0.5_rp, nelv*lxyz)
801 type(c_ptr),
intent(inout) :: s11_d, s22_d, s33_d, s12_d, s13_d, s23_d
802 type(c_ptr),
intent(in) :: u_d, v_d, w_d
803 type(coef_t),
intent(in) :: coef
805 integer :: nelv, lxyz
810 call dudxyz(s12_d, u_d, coef%drdy_d, coef%dsdy_d, coef%dtdy_d, coef)
811 call dudxyz(s11_d, v_d, coef%drdx_d, coef%dsdx_d, coef%dtdx_d, coef)
812 call device_add2(s12_d, s11_d, nelv*lxyz)
814 call dudxyz(s13_d, u_d, coef%drdz_d, coef%dsdz_d, coef%dtdz_d, coef)
815 call dudxyz(s11_d, w_d, coef%drdx_d, coef%dsdx_d, coef%dtdx_d, coef)
816 call device_add2(s13_d, s11_d, nelv*lxyz)
818 call dudxyz(s23_d, v_d, coef%drdz_d, coef%dsdz_d, coef%dtdz_d, coef)
819 call dudxyz(s11_d, w_d, coef%drdy_d, coef%dsdy_d, coef%dtdy_d, coef)
820 call device_add2(s23_d, s11_d, nelv*lxyz)
822 call dudxyz(s11_d, u_d, coef%drdx_d, coef%dsdx_d, coef%dtdx_d, coef)
823 call dudxyz(s22_d, v_d, coef%drdy_d, coef%dsdy_d, coef%dtdy_d, coef)
824 call dudxyz(s33_d, w_d, coef%drdz_d, coef%dsdz_d, coef%dtdz_d, coef)
825 call device_cmult(s12_d, 0.5_rp, nelv*lxyz)
826 call device_cmult(s13_d, 0.5_rp, nelv*lxyz)
827 call device_cmult(s23_d, 0.5_rp, nelv*lxyz)
844 type(field_t),
intent(inout) :: s11, s22, s33, s12, s13, s23
845 type(field_t),
intent(in) :: u, v, w
846 type(coef_t),
intent(in) :: coef
849 n = coef%Xh%lxyz * coef%msh%nelv
851 if (neko_bcknd_device .eq. 1)
then
852 call dudxyz(s12%x_d, u%x_d, coef%drdy_d, coef%dsdy_d, coef%dtdy_d, coef)
853 call dudxyz(s11%x_d, v%x_d, coef%drdx_d, coef%dsdx_d, coef%dtdx_d, coef)
854 call device_add2(s12%x_d, s11%x_d, n)
856 call dudxyz(s13%x_d, u%x_d, coef%drdz_d, coef%dsdz_d, coef%dtdz_d, coef)
857 call dudxyz(s11%x_d, w%x_d, coef%drdx_d, coef%dsdx_d, coef%dtdx_d, coef)
858 call device_add2(s13%x_d, s11%x_d, n)
860 call dudxyz(s23%x_d, v%x_d, coef%drdz_d, coef%dsdz_d, coef%dtdz_d, coef)
861 call dudxyz(s11%x_d, w%x_d, coef%drdy_d, coef%dsdy_d, coef%dtdy_d, coef)
862 call device_add2(s23%x_d, s11%x_d, n)
864 call dudxyz(s11%x_d, u%x_d, coef%drdx_d, coef%dsdx_d, coef%dtdx_d, coef)
865 call dudxyz(s22%x_d, v%x_d, coef%drdy_d, coef%dsdy_d, coef%dtdy_d, coef)
866 call dudxyz(s33%x_d, w%x_d, coef%drdz_d, coef%dsdz_d, coef%dtdz_d, coef)
867 call device_cmult(s12%x_d, 0.5_rp, n)
868 call device_cmult(s13%x_d, 0.5_rp, n)
869 call device_cmult(s23%x_d, 0.5_rp, n)
871 call dudxyz(s12%x, u%x, coef%drdy, coef%dsdy, coef%dtdy, coef)
872 call dudxyz(s11%x, v%x, coef%drdx, coef%dsdx, coef%dtdx, coef)
873 call add2(s12%x, s11%x, n)
875 call dudxyz(s13%x, u%x, coef%drdz, coef%dsdz, coef%dtdz, coef)
876 call dudxyz(s11%x, w%x, coef%drdx, coef%dsdx, coef%dtdx, coef)
877 call add2(s13%x, s11%x, n)
879 call dudxyz(s23%x, v%x, coef%drdz, coef%dsdz, coef%dtdz, coef)
880 call dudxyz(s11%x, w%x, coef%drdy, coef%dsdy, coef%dtdy, coef)
881 call add2(s23%x, s11%x, n)
883 call dudxyz(s11%x, u%x, coef%drdx, coef%dsdx, coef%dtdx, coef)
884 call dudxyz(s22%x, v%x, coef%drdy, coef%dsdy, coef%dtdy, coef)
885 call dudxyz(s33%x, w%x, coef%drdz, coef%dsdz, coef%dtdz, coef)
886 call cmult(s12%x, 0.5_rp, n)
887 call cmult(s13%x, 0.5_rp, n)
888 call cmult(s23%x, 0.5_rp, n)
900 type(coef_t),
intent(in) :: coef
901 type(field_t),
intent(inout) ::
lambda2
902 type(field_t),
intent(in) :: u, v, w
904 if (neko_bcknd_sx .eq. 1)
then
905 call opr_sx_lambda2(
lambda2%x, u%x, v%x, w%x, coef)
906 else if (neko_bcknd_device .eq. 1)
then
907 call opr_device_lambda2(
lambda2%x_d, u%x_d, v%x_d, w%x_d, coef)
909 call opr_cpu_lambda2(
lambda2%x, u%x, v%x, w%x, coef)
925 type(space_t),
intent(inout) :: xh
926 type(coef_t),
intent(inout) :: coef
927 type(field_t),
intent(inout) :: cr, cs, ct
928 real(kind=rp),
dimension(Xh%lxyz, coef%msh%nelv), &
929 intent(in) :: cx, cy, cz
930 type(c_ptr) :: cx_d, cy_d, cz_d
932 if (neko_bcknd_sx .eq. 1)
then
933 call opr_sx_set_convect_rst(cr%x, cs%x, ct%x, cx, cy, cz, xh, coef)
934 else if (neko_bcknd_xsmm .eq. 1)
then
935 call opr_xsmm_set_convect_rst(cr%x, cs%x, ct%x, cx, cy, cz, xh, coef)
936 else if (neko_bcknd_device .eq. 1)
then
937 cx_d = device_get_ptr(cx)
938 cy_d = device_get_ptr(cy)
939 cz_d = device_get_ptr(cz)
940 call opr_device_set_convect_rst(cr%x_d, cs%x_d, ct%x_d, &
941 cx_d, cy_d, cz_d, xh, coef)
943 call opr_cpu_set_convect_rst(cr%x, cs%x, ct%x, cx, cy, cz, xh, coef)
963 subroutine runge_kutta(phi, conv_k1, conv_k23, conv_k4, Xh_GLL, Xh_GL, &
964 coef, coef_GL, GLL_to_GL, tau, dtau, n, nel, n_GL)
965 type(space_t),
intent(in) :: xh_gll
966 type(space_t),
intent(inout) :: xh_gl
967 type(coef_t),
intent(in) :: coef
968 type(coef_t),
intent(inout) :: coef_gl
969 type(interpolator_t) :: gll_to_gl
970 real(kind=dp),
intent(inout) :: tau, dtau
971 integer,
intent(in) :: n, nel, n_gl
972 type(field_t),
intent(inout) :: phi
973 type(field_list_t) :: conv_k1, conv_k23, conv_k4
974 real(kind=rp) :: c1, c2, c3
975 type(field_t),
pointer :: u1, k1, k2, k3, k4
976 type(vector_t),
pointer :: u1_gl
977 integer :: ind(6), i, e
979 call neko_scratch_registry%request_field(u1, ind(1), .false.)
980 call neko_scratch_registry%request_field(k1, ind(2), .false.)
981 call neko_scratch_registry%request_field(k2, ind(3), .false.)
982 call neko_scratch_registry%request_field(k3, ind(4), .false.)
983 call neko_scratch_registry%request_field(k4, ind(5), .false.)
984 call neko_scratch_registry%request_vector(u1_gl, ind(6), n_gl, .false.)
990 if (neko_bcknd_device .eq. 1)
then
993 call device_invcol3(u1%x_d, phi%x_d, coef%B_d, n)
994 call gll_to_gl%map(u1_gl%x, u1%x, nel, xh_gl)
996 conv_k1%items(2)%ptr, conv_k1%items(3)%ptr, &
997 xh_gll, xh_gl, coef, coef_gl, gll_to_gl)
998 call device_col2(k1%x_d, coef%B_d, n)
1001 call device_add3s2(u1%x_d, phi%x_d, k1%x_d, c1, c2, n)
1002 call device_invcol2(u1%x_d, coef%B_d, n)
1003 call gll_to_gl%map(u1_gl%x, u1%x, nel, xh_gl)
1005 conv_k23%items(2)%ptr, conv_k23%items(3)%ptr, &
1006 xh_gll, xh_gl, coef, coef_gl, gll_to_gl)
1007 call device_col2(k2%x_d, coef%B_d, n)
1010 call device_add3s2(u1%x_d, phi%x_d, k2%x_d, c1, c2, n)
1011 call device_invcol2(u1%x_d, coef%B_d, n)
1012 call gll_to_gl%map(u1_gl%x, u1%x, nel, xh_gl)
1014 conv_k23%items(2)%ptr, conv_k23%items(3)%ptr, &
1015 xh_gll, xh_gl, coef, coef_gl, gll_to_gl)
1016 call device_col2(k3%x_d, coef%B_d, n)
1019 call device_add3s2(u1%x_d, phi%x_d, k3%x_d, c1, c3, n)
1020 call device_invcol2(u1%x_d, coef%B_d, n)
1021 call gll_to_gl%map(u1_gl%x, u1%x, nel, xh_gl)
1023 conv_k4%items(2)%ptr, conv_k4%items(3)%ptr, &
1024 xh_gll, xh_gl, coef, coef_gl, gll_to_gl)
1025 call device_col2(k4%x_d, coef%B_d, n)
1030 call device_add5s4(phi%x_d, k1%x_d, k2%x_d, k3%x_d, k4%x_d, &
1036 call invcol3(u1%x, phi%x, coef%B, n)
1037 call gll_to_gl%map(u1_gl%x, u1%x, nel, xh_gl)
1039 conv_k1%items(2)%ptr, conv_k1%items(3)%ptr, &
1040 xh_gll, xh_gl, coef, coef_gl, gll_to_gl)
1041 call col2(k1%x, coef%B, n)
1044 call add3s2(u1%x, phi%x, k1%x, c1, c2, n)
1045 call invcol2(u1%x, coef%B, n)
1046 call gll_to_gl%map(u1_gl%x, u1%x, nel, xh_gl)
1048 conv_k23%items(2)%ptr, conv_k23%items(3)%ptr, &
1049 xh_gll, xh_gl, coef, coef_gl, gll_to_gl)
1050 call col2(k2%x, coef%B, n)
1053 call add3s2(u1%x, phi%x, k2%x, c1, c2, n)
1054 call invcol2(u1%x, coef%B, n)
1055 call gll_to_gl%map(u1_gl%x, u1%x, nel, xh_gl)
1057 conv_k23%items(2)%ptr, conv_k23%items(3)%ptr, &
1058 xh_gll, xh_gl, coef, coef_gl, gll_to_gl)
1059 call col2(k3%x, coef%B, n)
1062 call add3s2(u1%x, phi%x, k3%x, c1, c3, n)
1063 call invcol2(u1%x, coef%B, n)
1064 call gll_to_gl%map(u1_gl%x, u1%x, nel, xh_gl)
1066 conv_k4%items(2)%ptr, conv_k4%items(3)%ptr, &
1067 xh_gll, xh_gl, coef, coef_gl, gll_to_gl)
1068 call col2(k4%x, coef%B, n)
1072 call add5s4(phi%x, k1%x, k2%x, k3%x, k4%x, c1, c2, c2, c1, n)
1075 call neko_scratch_registry%relinquish(ind)
1080 real(kind=rp),
contiguous,
dimension(:),
intent(inout) :: vx, vy, vz
1081 integer,
intent(in) :: idir
1082 type(coef_t),
intent(in) :: coef
1083 type(c_ptr) :: vx_d, vy_d, vz_d
1085 if (coef%cyclic .and. coef%cyc_msk(0) .gt. 1)
then
1086 if (neko_bcknd_device .eq. 1)
then
1087 call neko_log%deprecated(
'Operator: rotate_cyc_r1, implicit device', &
1088 '2.0.0',
'Please call rotate_cyc_d instead.')
1090 vx_d = device_get_ptr(vx)
1091 vy_d = device_get_ptr(vy)
1092 vz_d = device_get_ptr(vz)
1093 call opr_device_rotate_cyc(vx_d, vy_d, vz_d, idir, coef)
1095 call opr_cpu_rotate_cyc_r1(vx, vy, vz, idir, coef)
1101 real(kind=rp),
contiguous,
dimension(:,:,:,:),
intent(inout) :: vx, vy, vz
1102 integer,
intent(in) :: idir
1103 type(coef_t),
intent(in) :: coef
1104 type(c_ptr) :: vx_d, vy_d, vz_d
1106 if (coef%cyclic .and. coef%cyc_msk(0) .gt. 1)
then
1107 if (neko_bcknd_device .eq. 1)
then
1108 call neko_log%deprecated(
'Operator: rotate_cyc_r4, implicit device', &
1109 '2.0.0',
'Please call rotate_cyc_d instead.')
1111 vx_d = device_get_ptr(vx)
1112 vy_d = device_get_ptr(vy)
1113 vz_d = device_get_ptr(vz)
1114 call opr_device_rotate_cyc(vx_d, vy_d, vz_d, idir, coef)
1116 call opr_cpu_rotate_cyc_r4(vx, vy, vz, idir, coef)
1122 type(c_ptr),
intent(inout) :: vx_d, vy_d, vz_d
1123 integer,
intent(in) :: idir
1124 type(coef_t),
intent(in) :: coef
1126 if (coef%cyclic .and. coef%cyc_msk(0) .gt. 1)
then
1127 call opr_device_rotate_cyc(vx_d, vy_d, vz_d, idir, coef)
1132 type(field_t),
intent(inout) :: vx, vy, vz
1133 integer,
intent(in) :: idir
1134 type(coef_t),
intent(in) :: coef
1136 if (coef%cyclic .and. coef%cyc_msk(0) .gt. 1)
then
1137 if (neko_bcknd_device .eq. 1)
then
1138 call opr_device_rotate_cyc(vx%x_d, vy%x_d, vz%x_d, idir, coef)
1140 call opr_cpu_rotate_cyc_r4(vx%x, vy%x, vz%x, idir, coef)
Return the device pointer for an associated Fortran array.
Map a Fortran array to a device (allocate and associate)
Compute CFL condition for compressible flow.
Compute the divergence of a vector field.
Compute derivative of a scalar field along a single direction.
Compute the gradient of a scalar field, multiplied by the mass matrix.
Apply cyclic boundary condition to a vector field.
Compute the strain rate tensor of a vector field.
type(mpi_datatype), public mpi_real_precision
MPI type for working precision of REAL types.
type(mpi_comm), public neko_comm
MPI communicator.
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_add3s2(a_d, b_d, c_d, c1, c2, n, strm)
Returns .
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 .
subroutine, public device_invcol3(a_d, b_d, c_d, n, strm)
Vector division .
subroutine, public device_col2(a_d, b_d, n, strm)
Vector multiplication .
subroutine, public device_add5s4(a_d, b_d, c_d, d_d, e_d, c1, c2, c3, c4, n, strm)
Returns .
subroutine, public device_invcol2(a_d, b_d, n, strm)
Vector division .
Device abstraction, common interface for various accelerators.
subroutine, public device_free(x_d)
Deallocate memory on the device.
subroutine, public field_rzero(a, n)
Zero a real vector.
Routines to interpolate between different spaces.
A simulation component that computes lambda2 The values are stored in the field registry under the na...
type(log_t), public neko_log
Global log stream.
subroutine, public cmult(a, c, n)
Multiplication by constant c .
subroutine, public invcol2(a, b, n)
Vector division .
subroutine, public cadd(a, s, n)
Add a scalar to vector .
real(kind=rp) function, public glsum(a, n)
Sum a vector of length n.
subroutine, public add2(a, b, n)
Vector addition .
subroutine, public invcol3(a, b, c, n)
Invert a vector .
subroutine, public add3s2(a, b, c, c1, c2, n)
Returns .
subroutine, public col2(a, b, n)
Vector multiplication .
subroutine, public copy(a, b, n)
Copy a vector .
subroutine, public add5s4(a, b, c, d, e, c1, c2, c3, c4, n)
Returns .
subroutine, public rzero(a, n)
Zero a real vector.
integer, parameter neko_bcknd_sx
integer, parameter neko_bcknd_device
logical, parameter neko_device_mpi
integer, parameter neko_bcknd_xsmm
integer, parameter, public i8
integer, parameter, public dp
integer, parameter, public rp
Global precision used in computations.
real(kind=dp) function cfl_compressible_r4(dt, max_wave_speed, xh, coef, nelv, gdim)
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 strain_rate_d(s11_d, s22_d, s33_d, s12_d, s13_d, s23_d, u_d, v_d, w_d, coef)
Compute the strain rate tensor, i.e 0.5 * du_i/dx_j + du_j/dx_i.
subroutine dudxyz_r4(du, u, dr, ds, dt, coef)
Compute derivative of a scalar field along a single direction.
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 div_r4(res, ux, uy, uz, coef)
Compute the divergence of a vector field.
subroutine rotate_cyc_r1(vx, vy, vz, idir, coef)
subroutine grad_r4(ux, uy, uz, u, coef)
Compute the gradient of a scalar field.
subroutine strain_rate_r4(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.
real(kind=dp) function cfl_f(dt, u, v, w, xh, coef, nelv, gdim)
subroutine convect_scalar(du, u, cr, cs, ct, 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=dp) function cfl_r4(dt, u, v, w, xh, coef, nelv, gdim)
subroutine rotate_cyc_r4(vx, vy, vz, idir, coef)
subroutine grad_d(ux_d, uy_d, uz_d, u_d, coef)
Compute the gradient of a scalar field.
subroutine, public conv1(du, u, vx, vy, vz, xh, coef, es, ee)
Compute the advection term.
subroutine div_d(res_d, ux_d, uy_d, uz_d, coef)
Compute the divergence of a vector field.
subroutine, public curl(w1, w2, w3, u1, u2, u3, work1, work2, coef, event)
subroutine strain_rate_f(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.
real(kind=dp) function cfl_compressible_f(dt, max_wave_speed, xh, coef, nelv, gdim)
subroutine, public lambda2op(lambda2, u, v, w, coef)
Compute the Lambda2 field for a given velocity field.
subroutine rotate_cyc_d(vx_d, vy_d, vz_d, idir, coef)
subroutine dudxyz_f(du, u, dr, ds, dt, coef)
Compute derivative of a scalar field along a single direction.
real(kind=dp) function cfl_d(dt, u_d, v_d, w_d, xh, coef, nelv, gdim)
real(kind=dp) function cfl_compressible_d(dt, max_wave_speed, xh, coef, nelv, gdim)
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 rotate_cyc_f(vx, vy, vz, idir, coef)
subroutine, public runge_kutta(phi, conv_k1, conv_k23, conv_k4, 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 opr_cpu_curl(w1, w2, w3, u1, u2, u3, work1, work2, c_xh)
subroutine, public opr_cpu_rotate_cyc_r1(vx, vy, vz, idir, coef)
subroutine, public opr_cpu_lambda2(lambda2, u, v, w, coef)
subroutine, public opr_cpu_rotate_cyc_r4(vx, vy, vz, idir, coef)
real(kind=dp) function, public opr_cpu_cfl(dt, u, v, w, xh, coef, nelv, gdim)
Operators accelerator backends.
subroutine, public opr_device_convect_scalar(du, u_d, cr_d, cs_d, ct_d, xh_gll, xh_gl, coef_gll, coef_gl, gll_to_gl)
subroutine, public opr_device_cdtp(dtx_d, x_d, dr_d, ds_d, dt_d, coef)
subroutine, public opr_device_dudxyz(du_d, u_d, dr_d, ds_d, dt_d, coef)
real(kind=dp) function, public opr_device_cfl(dt, u_d, v_d, w_d, xh, coef, nelv, gdim)
subroutine, public opr_device_conv1(du_d, u_d, vx_d, vy_d, vz_d, xh, coef, nelv, gdim)
subroutine, public opr_device_curl(w1, w2, w3, u1, u2, u3, work1, work2, c_xh, event)
subroutine, public opr_device_set_convect_rst(cr_d, cs_d, ct_d, cx_d, cy_d, cz_d, xh, coef)
subroutine, public opr_device_lambda2(lambda2_d, u_d, v_d, w_d, coef)
subroutine, public opr_device_rotate_cyc(vx_d, vy_d, vz_d, idir, coef)
subroutine, public opr_device_opgrad(ux_d, uy_d, uz_d, u_d, coef)
Operators SX-Aurora backend.
subroutine, public opr_sx_curl(w1, w2, w3, u1, u2, u3, work1, work2, c_xh)
Operators libxsmm backend.
subroutine, public opr_xsmm_convect_scalar(du, u, cr, cs, ct, xh_gll, xh_gl, coef_gll, coef_gl, gll_to_gl)
subroutine, public opr_xsmm_conv1(du, u, vx, vy, vz, xh, coef, nelv, gdim)
subroutine, public opr_xsmm_cdtp(dtx, x, dr, ds, dt, coef)
subroutine, public opr_xsmm_curl(w1, w2, w3, u1, u2, u3, work1, work2, c_xh)
subroutine, public opr_xsmm_dudxyz(du, u, dr, ds, dt, coef)
subroutine, public opr_xsmm_opgrad(ux, uy, uz, u, coef)
subroutine, public opr_xsmm_set_convect_rst(cr, cs, ct, cx, cy, cz, xh, coef)
Defines a registry for storing and requesting temporary objects This can be used when you have a func...
type(scratch_registry_t), target, public neko_scratch_registry
Global scratch registry.
Defines a function space.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
field_list_t, To be able to group fields together
Interpolation between two space::space_t.
The function space for the SEM solution fields.