112 class(
schwarz_t),
target,
intent(inout) :: this
113 type(
space_t),
target,
intent(inout) :: Xh
114 type(
dofmap_t),
target,
intent(in) :: dof
115 type(
gs_t),
target,
intent(inout) :: gs_h
116 type(
mesh_t),
target,
intent(inout) :: msh
117 type(
bc_list_t),
target,
intent(inout):: bclst
122 call this%Xh_schwarz%init(
gll, xh%lx+2, xh%lx+2, xh%lx+2)
123 call this%dm_schwarz%init(msh, this%Xh_schwarz)
124 call this%gs_schwarz%init(this%dm_schwarz)
126 allocate(this%work1(this%dm_schwarz%size()))
127 allocate(this%work2(this%dm_schwarz%size()))
128 allocate(this%wt(xh%lx, xh%lx, 4, msh%gdim, msh%nelv))
130 call this%fdm%init(xh, dof, gs_h)
145 if (nthrds .gt. 1)
then
146 allocate(this%gs_h_local)
147 call this%gs_h_local%init(this%dof)
148 this%gs_h => this%gs_h_local
149 this%local_gs = .true.
152 this%local_gs = .false.
156 call device_map(this%work1, this%work1_d,this%dm_schwarz%size())
157 call device_map(this%work2, this%work2_d,this%dm_schwarz%size())
163 int(this%dof%size(),
i8) * int(c_sizeof(this%work1(1)),
i8))
164 call rone(this%work1, this%dof%size())
216 integer :: enx,eny,enz, n, ie, k, ns
217 real(kind=
rp),
parameter :: zero = 0.0
218 real(kind=
rp),
parameter :: one = 1.0
219 associate(work1 => this%work1, work2 => this%work2, msh => this%msh, &
220 xh => this%Xh, xh_schwarz => this%Xh_schwarz)
227 if(.not. msh%gdim .eq. 3) enz=1
228 ns = enx*eny*enz*msh%nelv
231 call rzero(work1, ns)
235 call schwarz_extrude(work1, 0, zero, work2, 0, one , enx, eny, enz, msh%nelv)
239 call this%gs_schwarz%op(work2, ns, gs_op_add)
243 call this%gs_schwarz%op(work2, ns, gs_op_add)
245 call schwarz_extrude(work2, 0, one, work1, 0, -one, enx, eny, enz, msh%nelv)
246 call schwarz_extrude(work2, 2, one, work2, 0, one, enx, eny, enz, msh%nelv)
257 call this%gs_h%op(work1, n, gs_op_add)
261 call this%gs_h%op(work1, n, gs_op_add)
266 if (msh%gdim .eq. 2)
then
269 if (this%msh%gdim.eq. 3)
then
279 integer,
intent(in) :: n, nelv
280 real(kind=rp),
intent(inout) :: wt(n,4,2,nelv)
281 real(kind=rp),
intent(inout) :: work(n,n)
284 wt(j,1,1,ie) = 1.0_rp / work(1,j)
285 wt(j,2,1,ie) = 1.0_rp / work(2,j)
286 wt(j,3,1,ie) = 1.0_rp / work(n-1,j)
287 wt(j,4,1,ie) = 1.0_rp / work(n,j)
290 wt(i,1,2,ie) = 1.0_rp / work(i,1)
291 wt(i,2,2,ie) = 1.0_rp / work(i,2)
292 wt(i,3,2,ie) = 1.0_rp / work(i,n-1)
293 wt(i,4,2,ie) = 1.0_rp / work(i,n)
301 integer,
intent(in) ::n, nelv, ie
302 real(kind=rp),
intent(inout) :: wt(n,n,4,3,nelv)
303 real(kind=rp),
intent(inout) :: work(n,n,n)
308 wt(j,k,1,1,ie) = 1.0_rp / work(1,j,k)
309 wt(j,k,2,1,ie) = 1.0_rp / work(2,j,k)
310 wt(j,k,3,1,ie) = 1.0_rp / work(n-1,j,k)
311 wt(j,k,4,1,ie) = 1.0_rp / work(n,j,k)
317 wt(i,k,1,2,ie) = 1.0_rp / work(i,1,k)
318 wt(i,k,2,2,ie) = 1.0_rp / work(i,2,k)
319 wt(i,k,3,2,ie) = 1.0_rp / work(i,n-1,k)
320 wt(i,k,4,2,ie) = 1.0_rp / work(i,n,k)
326 wt(i,j,1,3,ie) = 1.0_rp / work(i,j,1)
327 wt(i,j,2,3,ie) = 1.0_rp / work(i,j,2)
328 wt(i,j,3,3,ie) = 1.0_rp / work(i,j,n-1)
329 wt(i,j,4,3,ie) = 1.0_rp / work(i,j,n)
374 integer,
intent(in) :: l1, l2, nx, ny, nz, nelv
375 real(kind=rp),
intent(inout) :: arr1(nx,ny,nz,nelv), arr2(nx,ny,nz,nelv)
376 real(kind=rp),
intent(in) :: f1, f2
377 integer :: i, j, k, ie, i0, i1
384 arr1(l1+1 ,j,1,ie) = f1*arr1(l1+1 ,j,1,ie) &
385 +f2*arr2(l2+1 ,j,1,ie)
386 arr1(nx-l1,j,1,ie) = f1*arr1(nx-l1,j,1,ie) &
387 +f2*arr2(nx-l2,j,1,ie)
390 arr1(i,l1+1 ,1,ie) = f1*arr1(i,l1+1 ,1,ie) &
391 +f2*arr2(i,l2+1 ,1,ie)
392 arr1(i,ny-l1,1,ie) = f1*arr1(i,ny-l1,1,ie) &
393 +f2*arr2(i,nx-l2,1,ie)
400 arr1(l1+1 ,j,k,ie) = f1*arr1(l1+1 ,j,k,ie) &
401 +f2*arr2(l2+1 ,j,k,ie)
402 arr1(nx-l1,j,k,ie) = f1*arr1(nx-l1,j,k,ie) &
403 +f2*arr2(nx-l2,j,k,ie)
408 arr1(i,l1+1 ,k,ie) = f1*arr1(i,l1+1 ,k,ie) &
409 +f2*arr2(i,l2+1 ,k,ie)
410 arr1(i,nx-l1,k,ie) = f1*arr1(i,nx-l1,k,ie) &
411 +f2*arr2(i,nx-l2,k,ie)
416 arr1(i,j,l1+1 ,ie) = f1*arr1(i,j,l1+1 ,ie) &
417 +f2*arr2(i,j,l2+1 ,ie)
418 arr1(i,j,nx-l1,ie) = f1*arr1(i,j,nx-l1,ie) &
419 +f2*arr2(i,j,nx-l2,ie)
428 real(kind=rp),
dimension(this%dof%size()),
intent(inout) :: e, r
429 integer :: n, enx, eny, enz, ns
430 real(kind=rp),
parameter :: zero = 0.0_rp
431 real(kind=rp),
parameter :: one = 1.0_rp
432 type(c_ptr) :: e_d, r_d
433 associate(work1 => this%work1, work1_d => this%work1_d,&
434 work2 => this%work2, work2_d => this%work2_d)
437 enx=this%Xh_schwarz%lx
438 eny=this%Xh_schwarz%ly
439 enz=this%Xh_schwarz%lz
440 if(.not. this%msh%gdim .eq. 3) enz=1
441 ns = enx*eny*enz*this%msh%nelv
442 if (neko_bcknd_device .eq. 1)
then
443 r_d = device_get_ptr(r)
444 e_d = device_get_ptr(e)
445 call device_event_record(this%event, glb_cmd_queue)
446 call device_stream_wait_event(aux_cmd_queue, this%event, 0)
447 call device_schwarz_toext3d(work1_d, r_d, this%Xh%lx, &
448 this%msh%nelv, aux_cmd_queue)
449 call device_schwarz_extrude(work1_d, 0, zero, work1_d, 2, one, &
450 enx,eny,enz, this%msh%nelv,aux_cmd_queue)
452 this%gs_schwarz%bcknd%gs_stream = aux_cmd_queue
453 call this%gs_schwarz%op(work1, ns, gs_op_add,this%event)
454 call device_event_sync(this%event)
455 call device_schwarz_extrude(work1_d, 0, one, work1_d, 2, -one, &
456 enx, eny, enz, this%msh%nelv, aux_cmd_queue)
458 call this%fdm%compute(work2, work1,aux_cmd_queue)
460 call device_schwarz_extrude(work1_d, 0, zero, work2_d, 0, one, &
461 enx, eny, enz, this%msh%nelv, aux_cmd_queue)
462 call this%gs_schwarz%op(work2, ns, gs_op_add,this%event)
463 call device_event_sync(this%event)
465 call device_schwarz_extrude(work2_d, 0, one, work1_d, 0, -one, &
466 enx, eny, enz, this%msh%nelv, aux_cmd_queue)
467 call device_schwarz_extrude(work2_d, 2, one, work2_d, 0, one, &
468 enx, eny, enz, this%msh%nelv, aux_cmd_queue)
469 call device_schwarz_toreg3d(e_d, work2_d, this%Xh%lx, &
470 this%msh%nelv, aux_cmd_queue)
472 this%gs_h%bcknd%gs_stream = aux_cmd_queue
473 call this%gs_h%op(e, n, gs_op_add, this%event)
475 call this%bclst%apply_scalar(e, n, strm = aux_cmd_queue)
476 call device_col2(e_d,this%wt_d, n, aux_cmd_queue)
479 if (.not. this%local_gs)
then
480 call device_event_sync(this%event)
481 this%gs_h%bcknd%gs_stream = glb_cmd_queue
484 call this%bclst%apply_scalar(r, n)
489 enx, eny, enz, this%msh%nelv)
490 call this%gs_schwarz%op(work1, ns, gs_op_add)
492 enx, eny, enz, this%msh%nelv)
494 call this%fdm%compute(work2, work1)
498 enx, eny, enz, this%msh%nelv)
499 call this%gs_schwarz%op(work2, ns, gs_op_add)
501 enx, eny, enz, this%msh%nelv)
503 enx, eny, enz, this%msh%nelv)
508 call this%gs_h%op(e, n, gs_op_add)
509 call this%bclst%apply_scalar(e, n)
511 call schwarz_wt3d(e, this%wt, this%Xh%lx, this%msh%nelv)
518 integer,
intent(in) :: n, nelv
519 real(kind=rp),
intent(inout) :: e(n,n,n,nelv)
520 real(kind=rp),
intent(inout) :: wt(n,n,4,3,nelv)
521 integer :: ie, i, j, k
526 e(1,j,k,ie) = e(1,j,k,ie) * wt(j,k,1,1,ie)
527 e(2,j,k,ie) = e(2,j,k,ie) * wt(j,k,2,1,ie)
528 e(n-1,j,k,ie) = e(n-1,j,k,ie) * wt(j,k,3,1,ie)
529 e(n,j,k,ie) = e(n,j,k,ie) * wt(j,k,4,1,ie)
534 e(i,1,k,ie) = e(i,1,k,ie) * wt(i,k,1,2,ie)
535 e(i,2,k,ie) = e(i,2,k,ie) * wt(i,k,2,2,ie)
536 e(i,n-1,k,ie) = e(i,n-1,k,ie) * wt(i,k,3,2,ie)
537 e(i,n,k,ie) = e(i,n,k,ie) * wt(i,k,4,2,ie)
542 e(i,j,1,ie) = e(i,j,1,ie) * wt(i,j,1,3,ie)
543 e(i,j,2,ie) = e(i,j,2,ie) * wt(i,j,2,3,ie)
544 e(i,j,n-1,ie) = e(i,j,n-1,ie) * wt(i,j,3,3,ie)
545 e(i,j,n,ie) = e(i,j,n,ie) * wt(i,j,4,3,ie)