109 integer,
intent(in) :: lxd
110 type(
coef_t),
intent(inout),
target :: coef
111 integer :: nel, n_GL, n
113 call this%Xh_GL%init(
gl, lxd, lxd, lxd)
114 this%Xh_GLL => coef%Xh
115 this%coef_GLL => coef
116 call this%GLL_to_GL%init(this%Xh_GL, this%Xh_GLL)
118 call this%coef_GL%init(this%Xh_GL, coef%msh)
121 n_gl = nel*this%Xh_GL%lxyz
123 call this%GLL_to_GL%map(this%coef_GL%drdx, coef%drdx, nel, this%Xh_GL)
124 call this%GLL_to_GL%map(this%coef_GL%dsdx, coef%dsdx, nel, this%Xh_GL)
125 call this%GLL_to_GL%map(this%coef_GL%dtdx, coef%dtdx, nel, this%Xh_GL)
126 call this%GLL_to_GL%map(this%coef_GL%drdy, coef%drdy, nel, this%Xh_GL)
127 call this%GLL_to_GL%map(this%coef_GL%dsdy, coef%dsdy, nel, this%Xh_GL)
128 call this%GLL_to_GL%map(this%coef_GL%dtdy, coef%dtdy, nel, this%Xh_GL)
129 call this%GLL_to_GL%map(this%coef_GL%drdz, coef%drdz, nel, this%Xh_GL)
130 call this%GLL_to_GL%map(this%coef_GL%dsdz, coef%dsdz, nel, this%Xh_GL)
131 call this%GLL_to_GL%map(this%coef_GL%dtdz, coef%dtdz, nel, this%Xh_GL)
135 allocate(this%temp(n_gl))
136 allocate(this%tbf(n_gl))
137 allocate(this%tx(n_gl))
138 allocate(this%ty(n_gl))
139 allocate(this%tz(n_gl))
140 allocate(this%vr(n_gl))
141 allocate(this%vs(n_gl))
142 allocate(this%vt(n_gl))
245 type(
space_t),
intent(in) :: Xh
246 type(
coef_t),
intent(in) :: coef
247 type(
field_t),
intent(inout) :: vx, vy, vz
248 type(
field_t),
intent(inout) :: fx, fy, fz
249 integer,
intent(in) :: n
250 real(kind=
rp),
intent(in),
optional :: dt
252 real(kind=
rp),
dimension(this%Xh_GL%lxyz) :: tx, ty, tz
253 real(kind=
rp),
dimension(this%Xh_GL%lxyz) :: tfx, tfy, tfz
254 real(kind=
rp),
dimension(this%Xh_GL%lxyz) :: vr, vs, vt
255 real(kind=
rp),
dimension(this%Xh_GLL%lxyz) :: tempx, tempy, tempz
256 integer :: e, i, idx, nel, n_GL
259 n_gl = nel * this%Xh_GL%lxyz
262 associate(c_gl => this%coef_GL)
264 call this%GLL_to_GL%map(this%tx, vx%x, nel, this%Xh_GL)
265 call this%GLL_to_GL%map(this%ty, vy%x, nel, this%Xh_GL)
266 call this%GLL_to_GL%map(this%tz, vz%x, nel, this%Xh_GL)
268 call opgrad(this%vr, this%vs, this%vt, this%tx, c_gl)
269 call device_vdot3(this%tbf_d, this%vr_d, this%vs_d, this%vt_d, &
270 this%tx_d, this%ty_d, this%tz_d, n_gl)
271 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
275 call opgrad(this%vr, this%vs, this%vt, this%ty, c_gl)
276 call device_vdot3(this%tbf_d, this%vr_d, this%vs_d, this%vt_d, &
277 this%tx_d, this%ty_d, this%tz_d, n_gl)
278 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
281 call opgrad(this%vr, this%vs, this%vt, this%tz, c_gl)
282 call device_vdot3(this%tbf_d, this%vr_d, this%vs_d, this%vt_d, &
283 this%tx_d, this%ty_d, this%tz_d, n_gl)
284 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
289 call this%GLL_to_GL%map(this%tx, vx%x, nel, this%Xh_GL)
290 call this%GLL_to_GL%map(this%ty, vy%x, nel, this%Xh_GL)
291 call this%GLL_to_GL%map(this%tz, vz%x, nel, this%Xh_GL)
293 call opgrad(this%vr, this%vs, this%vt, this%tx, c_gl)
294 call vdot3(this%tbf, this%vr, this%vs, this%vt, &
295 this%tx, this%ty, this%tz, n_gl)
296 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
297 call sub2(fx%x, this%temp, n)
300 call opgrad(this%vr, this%vs, this%vt, this%ty, c_gl)
301 call vdot3(this%tbf, this%vr, this%vs, this%vt, &
302 this%tx, this%ty, this%tz, n_gl)
303 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
304 call sub2(fy%x, this%temp, n)
306 call opgrad(this%vr, this%vs, this%vt, this%tz, c_gl)
307 call vdot3(this%tbf, this%vr, this%vs, this%vt, &
308 this%tx, this%ty, this%tz, n_gl)
309 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
310 call sub2(fz%x, this%temp, n)
314 do e = 1, coef%msh%nelv
315 call this%GLL_to_GL%map(tx, vx%x(1,1,1,e), 1, this%Xh_GL)
316 call this%GLL_to_GL%map(ty, vy%x(1,1,1,e), 1, this%Xh_GL)
317 call this%GLL_to_GL%map(tz, vz%x(1,1,1,e), 1, this%Xh_GL)
319 call opgrad(vr, vs, vt, tx, c_gl, e, e)
320 do i = 1, this%Xh_GL%lxyz
321 tfx(i) = tx(i)*vr(i) + ty(i)*vs(i) + tz(i)*vt(i)
324 call opgrad(vr, vs, vt, ty, c_gl, e, e)
325 do i = 1, this%Xh_GL%lxyz
326 tfy(i) = tx(i)*vr(i) + ty(i)*vs(i) + tz(i)*vt(i)
329 call opgrad(vr, vs, vt, tz, c_gl, e, e)
330 do i = 1, this%Xh_GL%lxyz
331 tfz(i) = tx(i)*vr(i) + ty(i)*vs(i) + tz(i)*vt(i)
334 call this%GLL_to_GL%map(tempx, tfx, 1, this%Xh_GLL)
335 call this%GLL_to_GL%map(tempy, tfy, 1, this%Xh_GLL)
336 call this%GLL_to_GL%map(tempz, tfz, 1, this%Xh_GLL)
338 idx = (e-1)*this%Xh_GLL%lxyz+1
339 do concurrent(i = 0:this%Xh_GLL%lxyz-1)
340 fx%x(i+idx,1,1,1) = fx%x(i+idx,1,1,1) - tempx(i+1)
341 fy%x(i+idx,1,1,1) = fy%x(i+idx,1,1,1) - tempy(i+1)
342 fz%x(i+idx,1,1,1) = fz%x(i+idx,1,1,1) - tempz(i+1)
366 type(field_t),
intent(inout) :: vx, vy, vz
367 type(field_t),
intent(inout) :: s
368 type(field_t),
intent(inout) :: fs
369 type(space_t),
intent(in) :: Xh
370 type(coef_t),
intent(in) :: coef
371 integer,
intent(in) :: n
372 real(kind=rp),
intent(in),
optional :: dt
374 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: vx_gl, vy_gl, vz_gl, s_gl
375 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: dsdx, dsdy, dsdz
376 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: f_gl
377 integer :: e, i, idx, nel, n_GL
378 real(kind=rp),
dimension(this%Xh_GLL%lxyz) :: temp
381 n_gl = nel * this%Xh_GL%lxyz
383 associate(c_gl => this%coef_GL)
384 if (neko_bcknd_device .eq. 1)
then
387 call this%GLL_to_GL%map(this%tx, vx%x, nel, this%Xh_GL)
388 call this%GLL_to_GL%map(this%ty, vy%x, nel, this%Xh_GL)
389 call this%GLL_to_GL%map(this%tz, vz%x, nel, this%Xh_GL)
392 call this%GLL_to_GL%map(this%temp, s%x, nel, this%Xh_GL)
395 call opgrad(this%vr, this%vs, this%vt, this%temp, c_gl)
398 call device_vdot3(this%tbf_d, this%vr_d, this%vs_d, this%vt_d, &
399 this%tx_d, this%ty_d, this%tz_d, n_gl)
402 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
405 call device_sub2(fs%x_d, this%temp_d, n)
407 else if ((neko_bcknd_sx .eq. 1) .or. (neko_bcknd_xsmm .eq. 1))
then
410 call this%GLL_to_GL%map(this%tx, vx%x, nel, this%Xh_GL)
411 call this%GLL_to_GL%map(this%ty, vy%x, nel, this%Xh_GL)
412 call this%GLL_to_GL%map(this%tz, vz%x, nel, this%Xh_GL)
415 call this%GLL_to_GL%map(this%temp, s%x, nel, this%Xh_GL)
418 call opgrad(this%vr, this%vs, this%vt, this%temp, c_gl)
421 call vdot3(this%tbf, this%vr, this%vs, this%vt, &
422 this%tx, this%ty, this%tz, n_gl)
425 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
428 call sub2(fs%x, this%temp, n)
432 do e = 1, coef%msh%nelv
434 call this%GLL_to_GL%map(vx_gl, vx%x(1,1,1,e), 1, this%Xh_GL)
435 call this%GLL_to_GL%map(vy_gl, vy%x(1,1,1,e), 1, this%Xh_GL)
436 call this%GLL_to_GL%map(vz_gl, vz%x(1,1,1,e), 1, this%Xh_GL)
439 call this%GLL_to_GL%map(s_gl, s%x(1,1,1,e), 1, this%Xh_GL)
442 call opgrad(dsdx, dsdy, dsdz, s_gl, c_gl, e, e)
445 do i = 1, this%Xh_GL%lxyz
446 f_gl(i) = vx_gl(i)*dsdx(i) + vy_gl(i)*dsdy(i) + vz_gl(i)*dsdz(i)
450 call this%GLL_to_GL%map(temp, f_gl, 1, this%Xh_GLL)
452 idx = (e-1)*this%Xh_GLL%lxyz + 1
454 call sub2(fs%x(idx, 1, 1, 1), temp, this%Xh_GLL%lxyz)
484 fx, fy, fz, Xh, coef, n, dt)
486 type(field_t),
intent(inout) :: vx, vy, vz
487 type(field_t),
intent(inout) :: wm_x, wm_y, wm_z
488 type(field_t),
intent(inout) :: fx, fy, fz
489 type(space_t),
intent(in) :: Xh
490 type(coef_t),
intent(in) :: coef
491 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: vx_gl, vy_gl, vz_gl
492 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: wm_x_gl, wm_y_gl, wm_z_gl
493 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: flux_gl
494 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: grad_x, grad_y, grad_z
495 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: total_div_gl
496 integer :: e, i, idx, nel, n_GL
497 real(kind=rp),
dimension(this%Xh_GLL%lxyz) :: temp_x, temp_y, temp_z
498 integer,
intent(in) :: n
499 real(kind=rp),
intent(in),
optional :: dt
502 n_gl = nel * this%Xh_GL%lxyz
504 associate(c_gl => this%coef_GL)
505 if (neko_bcknd_device .eq. 1)
then
506 call neko_error(
"ALE advection with dealiasing not " // &
507 "implemented yet for device")
508 else if ((neko_bcknd_sx .eq. 1) .or. (neko_bcknd_xsmm .eq. 1))
then
509 call neko_error(
"ALE advection with dealiasing not " // &
510 "implemented yet for device")
513 do e = 1, coef%msh%nelv
515 call this%GLL_to_GL%map(vx_gl, vx%x(1,1,1,e), 1, this%Xh_GL)
516 call this%GLL_to_GL%map(vy_gl, vy%x(1,1,1,e), 1, this%Xh_GL)
517 call this%GLL_to_GL%map(vz_gl, vz%x(1,1,1,e), 1, this%Xh_GL)
518 call this%GLL_to_GL%map(wm_x_gl, wm_x%x(1,1,1,e), 1, this%Xh_GL)
519 call this%GLL_to_GL%map(wm_y_gl, wm_y%x(1,1,1,e), 1, this%Xh_GL)
520 call this%GLL_to_GL%map(wm_z_gl, wm_z%x(1,1,1,e), 1, this%Xh_GL)
523 total_div_gl = 0.0_rp
529 flux_gl = vx_gl * wm_x_gl
530 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
531 total_div_gl = total_div_gl + grad_x
532 flux_gl = vx_gl * wm_y_gl
533 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
534 total_div_gl = total_div_gl + grad_y
535 flux_gl = vx_gl * wm_z_gl
536 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
537 total_div_gl = total_div_gl + grad_z
540 call this%GLL_to_GL%map(temp_x, total_div_gl, 1, this%Xh_GLL)
543 total_div_gl = 0.0_rp
546 flux_gl = vy_gl * wm_x_gl
547 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
548 total_div_gl = total_div_gl + grad_x
549 flux_gl = vy_gl * wm_y_gl
550 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
551 total_div_gl = total_div_gl + grad_y
552 flux_gl = vy_gl * wm_z_gl
553 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
554 total_div_gl = total_div_gl + grad_z
557 call this%GLL_to_GL%map(temp_y, total_div_gl, 1, this%Xh_GLL)
560 total_div_gl = 0.0_rp
563 flux_gl = vz_gl * wm_x_gl
564 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
565 total_div_gl = total_div_gl + grad_x
566 flux_gl = vz_gl * wm_y_gl
567 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
568 total_div_gl = total_div_gl + grad_y
569 flux_gl = vz_gl * wm_z_gl
570 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
571 total_div_gl = total_div_gl + grad_z
574 call this%GLL_to_GL%map(temp_z, total_div_gl, 1, this%Xh_GLL)
579 idx = (e-1)*this%Xh_GLL%lxyz+1
580 do concurrent(i = 0:this%Xh_GLL%lxyz-1)
581 fx%x(i+idx,1,1,1) = fx%x(i+idx,1,1,1) + temp_x(i+1)
582 fy%x(i+idx,1,1,1) = fy%x(i+idx,1,1,1) + temp_y(i+1)
583 fz%x(i+idx,1,1,1) = fz%x(i+idx,1,1,1) + temp_z(i+1)
594 type(coef_t),
intent(in) :: coef
595 logical,
intent(in) :: moving_boundary
598 if (.not. moving_boundary)
return
601 call this%GLL_to_GL%map(this%coef_GL%drdx, coef%drdx, nel, this%Xh_GL)
602 call this%GLL_to_GL%map(this%coef_GL%dsdx, coef%dsdx, nel, this%Xh_GL)
603 call this%GLL_to_GL%map(this%coef_GL%dtdx, coef%dtdx, nel, this%Xh_GL)
605 call this%GLL_to_GL%map(this%coef_GL%drdy, coef%drdy, nel, this%Xh_GL)
606 call this%GLL_to_GL%map(this%coef_GL%dsdy, coef%dsdy, nel, this%Xh_GL)
607 call this%GLL_to_GL%map(this%coef_GL%dtdy, coef%dtdy, nel, this%Xh_GL)
609 call this%GLL_to_GL%map(this%coef_GL%drdz, coef%drdz, nel, this%Xh_GL)
610 call this%GLL_to_GL%map(this%coef_GL%dsdz, coef%dsdz, nel, this%Xh_GL)
611 call this%GLL_to_GL%map(this%coef_GL%dtdz, coef%dtdz, nel, this%Xh_GL)