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)
315 do e = 1, coef%msh%nelv
316 call this%GLL_to_GL%map(tx, vx%x(1,1,1,e), 1, this%Xh_GL)
317 call this%GLL_to_GL%map(ty, vy%x(1,1,1,e), 1, this%Xh_GL)
318 call this%GLL_to_GL%map(tz, vz%x(1,1,1,e), 1, this%Xh_GL)
320 call opgrad(vr, vs, vt, tx, c_gl, e, e)
321 do i = 1, this%Xh_GL%lxyz
322 tfx(i) = tx(i)*vr(i) + ty(i)*vs(i) + tz(i)*vt(i)
325 call opgrad(vr, vs, vt, ty, c_gl, e, e)
326 do i = 1, this%Xh_GL%lxyz
327 tfy(i) = tx(i)*vr(i) + ty(i)*vs(i) + tz(i)*vt(i)
330 call opgrad(vr, vs, vt, tz, c_gl, e, e)
331 do i = 1, this%Xh_GL%lxyz
332 tfz(i) = tx(i)*vr(i) + ty(i)*vs(i) + tz(i)*vt(i)
335 call this%GLL_to_GL%map(tempx, tfx, 1, this%Xh_GLL)
336 call this%GLL_to_GL%map(tempy, tfy, 1, this%Xh_GLL)
337 call this%GLL_to_GL%map(tempz, tfz, 1, this%Xh_GLL)
339 idx = (e-1)*this%Xh_GLL%lxyz+1
340 do concurrent(i = 0:this%Xh_GLL%lxyz-1)
341 fx%x(i+idx,1,1,1) = fx%x(i+idx,1,1,1) - tempx(i+1)
342 fy%x(i+idx,1,1,1) = fy%x(i+idx,1,1,1) - tempy(i+1)
343 fz%x(i+idx,1,1,1) = fz%x(i+idx,1,1,1) - tempz(i+1)
367 type(field_t),
intent(inout) :: vx, vy, vz
368 type(field_t),
intent(inout) :: s
369 type(field_t),
intent(inout) :: fs
370 type(space_t),
intent(in) :: Xh
371 type(coef_t),
intent(in) :: coef
372 integer,
intent(in) :: n
373 real(kind=rp),
intent(in),
optional :: dt
375 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: vx_gl, vy_gl, vz_gl, s_gl
376 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: dsdx, dsdy, dsdz
377 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: f_gl
378 integer :: e, i, idx, nel, n_GL
379 real(kind=rp),
dimension(this%Xh_GLL%lxyz) :: temp
382 n_gl = nel * this%Xh_GL%lxyz
384 associate(c_gl => this%coef_GL)
385 if (neko_bcknd_device .eq. 1)
then
388 call this%GLL_to_GL%map(this%tx, vx%x, nel, this%Xh_GL)
389 call this%GLL_to_GL%map(this%ty, vy%x, nel, this%Xh_GL)
390 call this%GLL_to_GL%map(this%tz, vz%x, nel, this%Xh_GL)
393 call this%GLL_to_GL%map(this%temp, s%x, nel, this%Xh_GL)
396 call opgrad(this%vr, this%vs, this%vt, this%temp, c_gl)
399 call device_vdot3(this%tbf_d, this%vr_d, this%vs_d, this%vt_d, &
400 this%tx_d, this%ty_d, this%tz_d, n_gl)
403 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
406 call device_sub2(fs%x_d, this%temp_d, n)
408 else if ((neko_bcknd_sx .eq. 1) .or. (neko_bcknd_xsmm .eq. 1))
then
411 call this%GLL_to_GL%map(this%tx, vx%x, nel, this%Xh_GL)
412 call this%GLL_to_GL%map(this%ty, vy%x, nel, this%Xh_GL)
413 call this%GLL_to_GL%map(this%tz, vz%x, nel, this%Xh_GL)
416 call this%GLL_to_GL%map(this%temp, s%x, nel, this%Xh_GL)
419 call opgrad(this%vr, this%vs, this%vt, this%temp, c_gl)
422 call vdot3(this%tbf, this%vr, this%vs, this%vt, &
423 this%tx, this%ty, this%tz, n_gl)
426 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
429 call sub2(fs%x, this%temp, n)
433 do e = 1, coef%msh%nelv
435 call this%GLL_to_GL%map(vx_gl, vx%x(1,1,1,e), 1, this%Xh_GL)
436 call this%GLL_to_GL%map(vy_gl, vy%x(1,1,1,e), 1, this%Xh_GL)
437 call this%GLL_to_GL%map(vz_gl, vz%x(1,1,1,e), 1, this%Xh_GL)
440 call this%GLL_to_GL%map(s_gl, s%x(1,1,1,e), 1, this%Xh_GL)
443 call opgrad(dsdx, dsdy, dsdz, s_gl, c_gl, e, e)
446 do i = 1, this%Xh_GL%lxyz
447 f_gl(i) = vx_gl(i)*dsdx(i) + vy_gl(i)*dsdy(i) + vz_gl(i)*dsdz(i)
451 call this%GLL_to_GL%map(temp, f_gl, 1, this%Xh_GLL)
453 idx = (e-1)*this%Xh_GLL%lxyz + 1
455 call sub2(fs%x(idx, 1, 1, 1), temp, this%Xh_GLL%lxyz)
485 fx, fy, fz, Xh, coef, n, dt)
487 type(field_t),
intent(inout) :: vx, vy, vz
488 type(field_t),
intent(inout) :: wm_x, wm_y, wm_z
489 type(field_t),
intent(inout) :: fx, fy, fz
490 type(space_t),
intent(in) :: Xh
491 type(coef_t),
intent(in) :: coef
492 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: vx_gl, vy_gl, vz_gl
493 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: wm_x_gl, wm_y_gl, wm_z_gl
494 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: flux_gl
495 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: grad_x, grad_y, grad_z
496 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: total_div_gl
497 integer :: e, i, idx, nel, n_GL
498 real(kind=rp),
dimension(this%Xh_GLL%lxyz) :: temp_x, temp_y, temp_z
499 integer,
intent(in) :: n
500 real(kind=rp),
intent(in),
optional :: dt
503 n_gl = nel * this%Xh_GL%lxyz
505 associate(c_gl => this%coef_GL)
506 if (neko_bcknd_device .eq. 1)
then
507 call neko_error(
"ALE advection with dealiasing not " // &
508 "implemented yet for device")
509 else if ((neko_bcknd_sx .eq. 1) .or. (neko_bcknd_xsmm .eq. 1))
then
510 call neko_error(
"ALE advection with dealiasing not " // &
511 "implemented yet for device")
514 do e = 1, coef%msh%nelv
516 call this%GLL_to_GL%map(vx_gl, vx%x(1,1,1,e), 1, this%Xh_GL)
517 call this%GLL_to_GL%map(vy_gl, vy%x(1,1,1,e), 1, this%Xh_GL)
518 call this%GLL_to_GL%map(vz_gl, vz%x(1,1,1,e), 1, this%Xh_GL)
519 call this%GLL_to_GL%map(wm_x_gl, wm_x%x(1,1,1,e), 1, this%Xh_GL)
520 call this%GLL_to_GL%map(wm_y_gl, wm_y%x(1,1,1,e), 1, this%Xh_GL)
521 call this%GLL_to_GL%map(wm_z_gl, wm_z%x(1,1,1,e), 1, this%Xh_GL)
524 total_div_gl = 0.0_rp
530 flux_gl = vx_gl * wm_x_gl
531 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
532 total_div_gl = total_div_gl + grad_x
533 flux_gl = vx_gl * wm_y_gl
534 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
535 total_div_gl = total_div_gl + grad_y
536 flux_gl = vx_gl * wm_z_gl
537 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
538 total_div_gl = total_div_gl + grad_z
541 call this%GLL_to_GL%map(temp_x, total_div_gl, 1, this%Xh_GLL)
544 total_div_gl = 0.0_rp
547 flux_gl = vy_gl * wm_x_gl
548 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
549 total_div_gl = total_div_gl + grad_x
550 flux_gl = vy_gl * wm_y_gl
551 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
552 total_div_gl = total_div_gl + grad_y
553 flux_gl = vy_gl * wm_z_gl
554 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
555 total_div_gl = total_div_gl + grad_z
558 call this%GLL_to_GL%map(temp_y, total_div_gl, 1, this%Xh_GLL)
561 total_div_gl = 0.0_rp
564 flux_gl = vz_gl * wm_x_gl
565 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
566 total_div_gl = total_div_gl + grad_x
567 flux_gl = vz_gl * wm_y_gl
568 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
569 total_div_gl = total_div_gl + grad_y
570 flux_gl = vz_gl * wm_z_gl
571 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
572 total_div_gl = total_div_gl + grad_z
575 call this%GLL_to_GL%map(temp_z, total_div_gl, 1, this%Xh_GLL)
580 idx = (e-1)*this%Xh_GLL%lxyz+1
581 do concurrent(i = 0:this%Xh_GLL%lxyz-1)
582 fx%x(i+idx,1,1,1) = fx%x(i+idx,1,1,1) + temp_x(i+1)
583 fy%x(i+idx,1,1,1) = fy%x(i+idx,1,1,1) + temp_y(i+1)
584 fz%x(i+idx,1,1,1) = fz%x(i+idx,1,1,1) + temp_z(i+1)
595 type(coef_t),
intent(in) :: coef
596 logical,
intent(in) :: moving_boundary
599 if (.not. moving_boundary)
return
602 call this%GLL_to_GL%map(this%coef_GL%drdx, coef%drdx, nel, this%Xh_GL)
603 call this%GLL_to_GL%map(this%coef_GL%dsdx, coef%dsdx, nel, this%Xh_GL)
604 call this%GLL_to_GL%map(this%coef_GL%dtdx, coef%dtdx, nel, this%Xh_GL)
606 call this%GLL_to_GL%map(this%coef_GL%drdy, coef%drdy, nel, this%Xh_GL)
607 call this%GLL_to_GL%map(this%coef_GL%dsdy, coef%dsdy, nel, this%Xh_GL)
608 call this%GLL_to_GL%map(this%coef_GL%dtdy, coef%dtdy, nel, this%Xh_GL)
610 call this%GLL_to_GL%map(this%coef_GL%drdz, coef%drdz, nel, this%Xh_GL)
611 call this%GLL_to_GL%map(this%coef_GL%dsdz, coef%dsdz, nel, this%Xh_GL)
612 call this%GLL_to_GL%map(this%coef_GL%dtdz, coef%dtdz, nel, this%Xh_GL)