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))
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)
391 call device_vdot3(this%tbf_d, this%vr_d, this%vs_d, this%vt_d, &
392 this%tx_d, this%ty_d, this%tz_d, n_gl)
395 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
398 call device_sub2(fs%x_d, this%temp_d, n)
400 else if ((neko_bcknd_sx .eq. 1) .or. (neko_bcknd_xsmm .eq. 1))
then
403 call this%GLL_to_GL%map(this%tx, vx%x, nel, this%Xh_GL)
404 call this%GLL_to_GL%map(this%ty, vy%x, nel, this%Xh_GL)
405 call this%GLL_to_GL%map(this%tz, vz%x, nel, this%Xh_GL)
408 call this%GLL_to_GL%map(this%temp, s%x, nel, this%Xh_GL)
411 call opgrad(this%vr, this%vs, this%vt, this%temp, c_gl)
414 call vdot3(this%tbf, this%vr, this%vs, this%vt, &
415 this%tx, this%ty, this%tz, n_gl)
418 call this%GLL_to_GL%map(this%temp, this%tbf, nel, this%Xh_GLL)
421 call sub2(fs%x, this%temp, n)
425 do e = 1, coef%msh%nelv
427 call this%GLL_to_GL%map(vx_gl, vx%x(1,1,1,e), 1, this%Xh_GL)
428 call this%GLL_to_GL%map(vy_gl, vy%x(1,1,1,e), 1, this%Xh_GL)
429 call this%GLL_to_GL%map(vz_gl, vz%x(1,1,1,e), 1, this%Xh_GL)
432 call this%GLL_to_GL%map(s_gl, s%x(1,1,1,e), 1, this%Xh_GL)
435 call opgrad(dsdx, dsdy, dsdz, s_gl, c_gl, e, e)
438 do i = 1, this%Xh_GL%lxyz
439 f_gl(i) = vx_gl(i)*dsdx(i) + vy_gl(i)*dsdy(i) + vz_gl(i)*dsdz(i)
443 call this%GLL_to_GL%map(temp, f_gl, 1, this%Xh_GLL)
445 idx = (e-1)*this%Xh_GLL%lxyz + 1
447 call sub2(fs%x(idx, 1, 1, 1), temp, this%Xh_GLL%lxyz)
477 fx, fy, fz, Xh, coef, n, dt)
479 type(field_t),
intent(inout) :: vx, vy, vz
480 type(field_t),
intent(inout) :: wm_x, wm_y, wm_z
481 type(field_t),
intent(inout) :: fx, fy, fz
482 type(space_t),
intent(in) :: Xh
483 type(coef_t),
intent(in) :: coef
484 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: vx_gl, vy_gl, vz_gl
485 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: wm_x_gl, wm_y_gl, wm_z_gl
486 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: flux_gl
487 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: grad_x, grad_y, grad_z
488 real(kind=rp),
dimension(this%Xh_GL%lxyz) :: total_div_gl
489 integer :: e, i, idx, nel, n_GL
490 real(kind=rp),
dimension(this%Xh_GLL%lxyz) :: temp_x, temp_y, temp_z
491 integer,
intent(in) :: n
492 real(kind=rp),
intent(in),
optional :: dt
495 n_gl = nel * this%Xh_GL%lxyz
497 associate(c_gl => this%coef_GL)
498 if (neko_bcknd_device .eq. 1)
then
499 call neko_error(
"ALE advection with dealiasing not " // &
500 "implemented yet for device")
501 else if ((neko_bcknd_sx .eq. 1) .or. (neko_bcknd_xsmm .eq. 1))
then
502 call neko_error(
"ALE advection with dealiasing not " // &
503 "implemented yet for device")
506 do e = 1, coef%msh%nelv
508 call this%GLL_to_GL%map(vx_gl, vx%x(1,1,1,e), 1, this%Xh_GL)
509 call this%GLL_to_GL%map(vy_gl, vy%x(1,1,1,e), 1, this%Xh_GL)
510 call this%GLL_to_GL%map(vz_gl, vz%x(1,1,1,e), 1, this%Xh_GL)
511 call this%GLL_to_GL%map(wm_x_gl, wm_x%x(1,1,1,e), 1, this%Xh_GL)
512 call this%GLL_to_GL%map(wm_y_gl, wm_y%x(1,1,1,e), 1, this%Xh_GL)
513 call this%GLL_to_GL%map(wm_z_gl, wm_z%x(1,1,1,e), 1, this%Xh_GL)
516 total_div_gl = 0.0_rp
522 flux_gl = vx_gl * wm_x_gl
523 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
524 total_div_gl = total_div_gl + grad_x
525 flux_gl = vx_gl * wm_y_gl
526 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
527 total_div_gl = total_div_gl + grad_y
528 flux_gl = vx_gl * wm_z_gl
529 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
530 total_div_gl = total_div_gl + grad_z
533 call this%GLL_to_GL%map(temp_x, total_div_gl, 1, this%Xh_GLL)
536 total_div_gl = 0.0_rp
539 flux_gl = vy_gl * wm_x_gl
540 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
541 total_div_gl = total_div_gl + grad_x
542 flux_gl = vy_gl * wm_y_gl
543 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
544 total_div_gl = total_div_gl + grad_y
545 flux_gl = vy_gl * wm_z_gl
546 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
547 total_div_gl = total_div_gl + grad_z
550 call this%GLL_to_GL%map(temp_y, total_div_gl, 1, this%Xh_GLL)
553 total_div_gl = 0.0_rp
556 flux_gl = vz_gl * wm_x_gl
557 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
558 total_div_gl = total_div_gl + grad_x
559 flux_gl = vz_gl * wm_y_gl
560 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
561 total_div_gl = total_div_gl + grad_y
562 flux_gl = vz_gl * wm_z_gl
563 call opgrad(grad_x, grad_y, grad_z, flux_gl, c_gl, e, e)
564 total_div_gl = total_div_gl + grad_z
567 call this%GLL_to_GL%map(temp_z, total_div_gl, 1, this%Xh_GLL)
572 idx = (e-1)*this%Xh_GLL%lxyz+1
573 do concurrent(i = 0:this%Xh_GLL%lxyz-1)
574 fx%x(i+idx,1,1,1) = fx%x(i+idx,1,1,1) + temp_x(i+1)
575 fy%x(i+idx,1,1,1) = fy%x(i+idx,1,1,1) + temp_y(i+1)
576 fz%x(i+idx,1,1,1) = fz%x(i+idx,1,1,1) + temp_z(i+1)
587 type(coef_t),
intent(in) :: coef
588 logical,
intent(in) :: moving_boundary
591 if (.not. moving_boundary)
return
594 call this%GLL_to_GL%map(this%coef_GL%drdx, coef%drdx, nel, this%Xh_GL)
595 call this%GLL_to_GL%map(this%coef_GL%dsdx, coef%dsdx, nel, this%Xh_GL)
596 call this%GLL_to_GL%map(this%coef_GL%dtdx, coef%dtdx, nel, this%Xh_GL)
598 call this%GLL_to_GL%map(this%coef_GL%drdy, coef%drdy, nel, this%Xh_GL)
599 call this%GLL_to_GL%map(this%coef_GL%dsdy, coef%dsdy, nel, this%Xh_GL)
600 call this%GLL_to_GL%map(this%coef_GL%dtdy, coef%dtdy, nel, this%Xh_GL)
602 call this%GLL_to_GL%map(this%coef_GL%drdz, coef%drdz, nel, this%Xh_GL)
603 call this%GLL_to_GL%map(this%coef_GL%dsdz, coef%dsdz, nel, this%Xh_GL)
604 call this%GLL_to_GL%map(this%coef_GL%dtdz, coef%dtdz, nel, this%Xh_GL)