10 use,
intrinsic :: iso_c_binding
17 integer :: comm_xy, comm_yz
18 logical,
save :: interface_initialized = .false.
19 logical,
save :: mesh_to_grid_initialized = .false.
21 integer :: alloc_local_xy, nin_local_xy, nout_local_xy, idx_in_local_xy, idx_out_local_xy
22 integer :: alloc_local_yz, nin_local_yz, nout_local_yz, idx_in_local_yz, idx_out_local_yz
25 real(DP),
allocatable ::
p(:)
28 integer,
allocatable ::
p(:)
31 type(
real_p),
allocatable :: send_buffers(:)
32 type(
real_p),
allocatable :: rec_buffers(:)
33 integer,
allocatable :: dest_pids(:)
34 integer,
allocatable :: dest_slots(:)
35 integer,
allocatable :: dest_indexes(:)
36 integer,
allocatable :: dest_lengths(:)
38 integer,
allocatable :: src_pids(:)
39 integer,
allocatable :: src_lengths(:)
40 integer,
allocatable :: src_slots(:,:,:)
41 integer,
allocatable :: src_indexes(:,:,:)
51 use mesh, only : shape_x, start_x, end_x
53 use soln, only : vmult
54 use size_m
, only : nx1, ny1, nz1
57 use fft, only : p_forward, p_backward, w_forward, w_backward
59 use mesh, only : boundaries
61 REAL(DP),
intent(out) :: U (:)
62 REAL(DP),
intent(inout) :: RHS (:)
64 real(DP),
allocatable :: rhs_coarse(:), soln_coarse(:)
65 real(DP),
allocatable :: tmp_fine(:,:,:,:)
68 real(DP),
allocatable :: plane_xy(:,:,:), plane_yx(:,:,:), plane_zy(:,:,:)
75 if (.not. interface_initialized)
then
83 allocate(tmp_fine(nx1, ny1, nz1, nelm))
86 tmp_fine(1, 1, 1, i) = rhs(1 + (i-1)*8)
87 tmp_fine(nx1,1, 1, i) = rhs(2 + (i-1)*8)
88 tmp_fine(1, ny1,1, i) = rhs(3 + (i-1)*8)
89 tmp_fine(nx1,ny1,1, i) = rhs(4 + (i-1)*8)
90 tmp_fine(1, 1, nz1, i) = rhs(5 + (i-1)*8)
91 tmp_fine(nx1,1, nz1, i) = rhs(6 + (i-1)*8)
92 tmp_fine(1, ny1,nz1, i) = rhs(7 + (i-1)*8)
93 tmp_fine(nx1,ny1,nz1, i) = rhs(8 + (i-1)*8)
98 allocate(rhs_coarse(nelm))
100 forall(i = 1 : nelm) rhs_coarse(i) = ( &
101 + tmp_fine(1,1,1,i) &
102 + tmp_fine(nx1,1,1,i) &
103 + tmp_fine(1,ny1,1,i) &
104 + tmp_fine(nx1,ny1,1,i) &
105 + tmp_fine(1,1,nz1,i) &
106 + tmp_fine(nx1,1,nz1,i) &
107 + tmp_fine(1,ny1,nz1,i) &
108 + tmp_fine(nx1,ny1,nz1,i) &
112 allocate(plane_xy(0:shape_x(1)-1, 0:nin_local_xy-1, 0:nin_local_yz-1) )
119 if (boundaries(2) ==
'P ')
then
120 call
fft_r2r(plane_xy, shape_x(1), int(nin_local_xy * nin_local_yz), p_forward, rescale)
122 call
fft_r2r(plane_xy, shape_x(1), int(nin_local_xy * nin_local_yz), w_forward, rescale)
125 allocate(plane_yx(0:shape_x(2)-1, 0:nout_local_xy-1, 0:nin_local_yz-1) )
129 if (boundaries(1) ==
'P ')
then
130 call
fft_r2r(plane_yx, shape_x(2), int(nout_local_xy * nin_local_yz), p_forward, rescale)
132 call
fft_r2r(plane_yx, shape_x(2), int(nout_local_xy * nin_local_yz), w_forward, rescale)
135 allocate(plane_zy(0:shape_x(3)-1, 0:nout_local_xy-1, 0:nout_local_yz-1) )
139 if (boundaries(5) ==
'P ')
then
140 call
fft_r2r(plane_zy, shape_x(3), int(nout_local_xy * nout_local_yz), p_forward, rescale)
142 call
fft_r2r(plane_zy, shape_x(3), int(nout_local_xy * nout_local_yz), w_forward, rescale)
146 call
poisson_kernel(plane_zy, shape_x, start_x, end_x, boundaries)
149 if (boundaries(5) ==
'P ')
then
150 call
fft_r2r(plane_zy, shape_x(3), int(nout_local_xy * nout_local_yz), p_backward, rescale)
152 call
fft_r2r(plane_zy, shape_x(3), int(nout_local_xy * nout_local_yz), w_backward, rescale)
155 allocate(plane_yx(0:shape_x(2)-1, 0:nout_local_xy-1, 0:nin_local_yz-1) )
159 if (boundaries(1) ==
'P ')
then
160 call
fft_r2r(plane_yx, shape_x(2), int(nout_local_xy * nin_local_yz), p_backward, rescale)
162 call
fft_r2r(plane_yx, shape_x(2), int(nout_local_xy * nin_local_yz), w_backward, rescale)
165 allocate(plane_xy(0:shape_x(1)-1, 0:nin_local_xy-1, 0:nin_local_yz-1))
169 if (boundaries(2) ==
'P ')
then
170 call
fft_r2r(plane_xy, shape_x(1), int(nin_local_xy * nin_local_yz), p_backward, rescale)
172 call
fft_r2r(plane_xy, shape_x(1), int(nin_local_xy * nin_local_yz), w_backward, rescale)
176 rescale = 1._dp / (rescale *
sum(bm1(:,:,:,1)))
177 plane_xy = plane_xy * rescale
181 allocate(soln_coarse(nelm)); soln_coarse = 0._dp
187 tmp_fine(1, 1, 1, i) = soln_coarse(i)
188 tmp_fine(nx1, 1, 1, i) = soln_coarse(i)
189 tmp_fine(1 , ny1, 1, i) = soln_coarse(i)
190 tmp_fine(nx1, ny1, 1, i) = soln_coarse(i)
191 tmp_fine(1, 1, nz1, i) = soln_coarse(i)
192 tmp_fine(nx1, 1, nz1, i) = soln_coarse(i)
193 tmp_fine(1 , ny1, nz1, i) = soln_coarse(i)
194 tmp_fine(nx1, ny1, nz1, i) = soln_coarse(i)
197 tmp_fine = tmp_fine * vmult
202 u(1+(i-1)*8) = tmp_fine(1, 1, 1, i)
203 u(2+(i-1)*8) = tmp_fine(nx1,1, 1, i)
204 u(3+(i-1)*8) = tmp_fine(1, ny1,1, i)
205 u(4+(i-1)*8) = tmp_fine(nx1,ny1,1, i)
206 u(5+(i-1)*8) = tmp_fine(1, 1, nz1, i)
207 u(6+(i-1)*8) = tmp_fine(nx1,1, nz1, i)
208 u(7+(i-1)*8) = tmp_fine(1, ny1,nz1, i)
209 u(8+(i-1)*8) = tmp_fine(nx1,ny1,nz1, i)
219 use input, only : param
220 integer,
intent(in) :: comm_world !>
221 integer,
intent(in) :: shape_x(3) !>
223 integer(C_INTPTR_T) :: shape_c(3)
224 integer :: nxy, nyz, ixy, iyz
225 integer :: nid, ierr, i
231 if (param(49) >= 1)
then
232 comm_size = min(comm_size, int(param(49)))
234 comm_size = min(comm_size, shape_x(1) * shape_x(2))
235 comm_size = min(comm_size, shape_x(2) * shape_x(3))
236 comm_size = min(comm_size, shape_x(1) * shape_x(3))
238 nxy = int(2**int(log(
real(comm_size))/log(2.) / 2))
240 if (nid < comm_size)
then
241 ixy = ((nxy*nid/comm_size) * shape_x(3)) / nxy
246 if (ierr /= 0)
write(*,*)
"Comm split xy failed", nid
247 if (nid >= comm_size)
then
249 if (ierr /= 0)
write(*,*)
"Comm free xy failed", nid
253 if (nid < comm_size)
then
254 iyz = (mod(nid,nyz) * shape_x(2)) / nyz
259 if (ierr /= 0)
write(*,*)
"Comm split yz failed", nid
260 if (nid >= comm_size)
then
262 if (ierr /= 0)
write(*,*)
"Comm free yz failed", nid
265 if (nid < comm_size)
then
267 idx_in_local_xy = (mod(nid,nxy) * shape_x(2)) / nxy
268 idx_out_local_xy = (mod(nid,nxy) * shape_x(1)) / nxy
269 idx_in_local_yz = ((nxy*nid/comm_size) * shape_x(3)) / nyz
270 idx_out_local_yz = ((nxy*nid/comm_size) * shape_x(2)) / nyz
271 nin_local_yz = shape_x(3) / nxy; nout_local_yz = shape_x(2)/nxy
272 nin_local_xy = shape_x(2) / nyz; nout_local_xy = shape_x(1)/nyz
275 nin_local_xy = 0; nout_local_xy = 0
276 nin_local_yz = 0; nout_local_yz = 0
277 idx_in_local_xy = -1; idx_out_local_xy = -1
278 idx_in_local_yz = -1; idx_out_local_yz = -1
279 alloc_local_xy = 0; alloc_local_yz = 0
285 if (nid == i)
write(*,
'(A,15(I5))')
"MAX:", nid, alloc_local_xy, nin_local_xy, nout_local_xy, &
286 alloc_local_yz, nin_local_yz, nout_local_yz, &
287 idx_in_local_xy, idx_out_local_xy, idx_in_local_yz, idx_out_local_yz, &
295 if (param(75) < 1)
then
301 interface_initialized = .true.
306 integer,
intent(in) :: ix, iy, iz
307 integer,
intent(in) :: shape_x(3)
308 integer,
intent(in) :: shape_p(2)
310 xyz_to_pid = (iz * shape_p(2) / shape_x(3)) * shape_p(1) + (iy * shape_p(1) / shape_x(2))
318 integer,
intent(in) :: nelm
319 integer,
intent(in) :: shape_x(3)
321 integer :: i, j, ieg, src_pid, dest_pid, npids, slot
322 integer :: idx, idy, idz
324 integer :: shape_p(2)
326 shape_p(1) = int(sqrt(
real(comm_size)))
327 shape_p(2) = int(sqrt(
real(comm_size)))
329 allocate(dest_pids(nelm))
334 dest_pid =
xyz_to_pid(ix(1), ix(2), ix(3), shape_x, shape_p)
337 if (dest_pid == dest_pids(j))
then
345 dest_pids(slot) = dest_pid
348 deallocate(dest_pids)
349 allocate(dest_pids(npids))
350 allocate(dest_lengths(npids))
351 allocate(dest_slots(nelm))
352 allocate(dest_indexes(nelm))
358 dest_pid =
xyz_to_pid(ix(1), ix(2), ix(3), shape_x, shape_p)
361 if (dest_pid == dest_pids(j))
then
369 dest_pids(slot) = dest_pid
372 dest_lengths(slot) = dest_lengths(slot) + 1
373 dest_indexes(i) = dest_lengths(slot)
376 allocate(src_pids(shape_x(1) * nin_local_xy * nin_local_yz))
378 do idz = idx_in_local_yz, idx_in_local_yz + nin_local_yz - 1
379 do idy = idx_in_local_xy, idx_in_local_xy + nin_local_xy - 1
380 do idx = 0, shape_x(1)-1
381 ieg = 1 + idx + idy * shape_x(1) + idz * shape_x(1) * shape_x(2)
385 if (src_pid == src_pids(j))
then
393 src_pids(slot) = src_pid
400 allocate(src_pids(npids))
401 allocate(src_lengths(npids))
402 allocate(src_slots(0:shape_x(1)-1, 0:nin_local_xy-1, 0:nin_local_yz-1))
403 allocate(src_indexes(0:shape_x(1)-1, 0:nin_local_xy-1, 0:nin_local_yz-1))
406 do idz = idx_in_local_yz, idx_in_local_yz + nin_local_yz - 1
407 do idy = idx_in_local_xy, idx_in_local_xy + nin_local_xy - 1
408 do idx = 0, shape_x(1)-1
409 ieg = 1 + idx + idy * shape_x(1) + idz * shape_x(1) * shape_x(2)
413 if (src_pid == src_pids(j))
then
421 src_pids(slot) = src_pid
423 src_slots(idx,idy-idx_in_local_xy, idz-idx_in_local_yz) = slot
424 src_lengths(slot) = src_lengths(slot) + 1
425 src_indexes(idx,idy-idx_in_local_xy, idz-idx_in_local_yz) = src_lengths(slot)
430 allocate(send_buffers(
size(dest_pids)))
431 do i = 1,
size(dest_lengths)
432 allocate(send_buffers(i)%p(dest_lengths(i)))
434 allocate(rec_buffers(
size(src_pids)))
435 do i = 1,
size(src_lengths)
436 allocate(rec_buffers(i)%p(src_lengths(i)))
440 if (nid == 0)
write(*,*)
"Finished init", nelm
446 use parallel, only : nekcomm, nekreal
448 use mpif, only : mpi_status_ignore
450 real(DP),
intent(in) :: mesh(:)
451 real(DP),
intent(out) :: grid(0:,0:,0:)
452 integer,
intent(in) :: shape_x(3)
454 integer,
allocatable :: mpi_reqs(:)
455 integer :: n_mpi_reqs
456 integer :: i, idx, idy, idz, ierr
458 integer :: slot, index_in_slot
461 if (.not. mesh_to_grid_initialized)
then
463 mesh_to_grid_initialized = .true.
468 send_buffers(dest_slots(i))%p(dest_indexes(i)) =
mesh(i)
471 allocate(mpi_reqs(
size(src_pids)+
size(dest_pids))); n_mpi_reqs = 0
472 do i = 1,
size(dest_pids)
473 n_mpi_reqs = n_mpi_reqs + 1
474 call
mpi_isend(send_buffers(i)%p, dest_lengths(i), &
475 nekreal, dest_pids(i), 0, nekcomm, mpi_reqs(n_mpi_reqs), ierr)
478 do i = 1,
size(src_pids)
479 n_mpi_reqs = n_mpi_reqs + 1
480 call
mpi_irecv(rec_buffers(i)%p, src_lengths(i), &
481 nekreal, src_pids(i), 0, nekcomm, mpi_reqs(n_mpi_reqs), ierr)
485 call
mpi_wait(mpi_reqs(i), mpi_status_ignore, ierr)
489 do idx = 0, shape_x(1)-1
490 do idy = idx_in_local_xy, idx_in_local_xy + nin_local_xy - 1
491 do idz = idx_in_local_yz, idx_in_local_yz + nin_local_yz - 1
492 slot = src_slots(idx, idy-idx_in_local_xy, idz-idx_in_local_yz)
493 index_in_slot = src_indexes(idx, idy-idx_in_local_xy, idz-idx_in_local_yz)
494 grid(idx, idy-idx_in_local_xy, idz-idx_in_local_yz) = &
495 rec_buffers(slot)%p(index_in_slot)
504 use parallel, only : nekcomm, nekreal
506 use mpif, only : mpi_status_ignore
508 real(DP),
intent(in) :: grid(0:,0:,0:)
509 real(DP),
intent(out) :: mesh(:)
510 integer,
intent(in) :: shape_x(3)
512 integer,
allocatable :: mpi_reqs(:)
513 integer :: n_mpi_reqs
514 integer :: i, idx, idy, idz, ierr
515 integer :: slot, index_in_slot
519 do idx = 0, shape_x(1)-1
520 do idy = idx_in_local_xy, idx_in_local_xy + nin_local_xy - 1
521 do idz = idx_in_local_yz, idx_in_local_yz + nin_local_yz - 1
522 slot = src_slots(idx, idy-idx_in_local_xy, idz-idx_in_local_yz)
523 index_in_slot = src_indexes(idx, idy-idx_in_local_xy, idz-idx_in_local_yz)
524 rec_buffers(slot)%p(index_in_slot) = grid(idx, idy-idx_in_local_xy, idz-idx_in_local_yz)
529 allocate(mpi_reqs(
size(src_pids)+
size(dest_pids))); n_mpi_reqs = 0
530 do i = 1,
size(src_pids)
531 n_mpi_reqs = n_mpi_reqs + 1
532 call
mpi_isend(rec_buffers(i)%p, src_lengths(i), &
533 nekreal, src_pids(i), 0, nekcomm, mpi_reqs(n_mpi_reqs), ierr)
537 do i = 1,
size(dest_pids)
538 n_mpi_reqs = n_mpi_reqs + 1
539 call
mpi_irecv(send_buffers(i)%p, dest_lengths(i), &
540 nekreal, dest_pids(i), 0, nekcomm, mpi_reqs(n_mpi_reqs), ierr)
544 call
mpi_wait(mpi_reqs(i), mpi_status_ignore, ierr)
550 mesh(i) = send_buffers(dest_slots(i))%p(dest_indexes(i))
559 real(DP),
intent(inout) :: grid(0:,0:,0:)
560 integer,
intent(in) :: shape_x(3)
561 real(DP),
intent(in) :: start_x(3)
562 real(DP),
intent(in) :: end_x(3)
563 character(3),
intent(in) :: boundaries(6)
564 real(DP) :: kx, ky, kz
565 real(DP),
allocatable,
save :: ks(:,:,:)
566 integer :: idz, idy, idx
569 if (.not.
allocated(ks))
then
570 allocate(ks(0:shape_x(3)-1, 0:nout_local_xy-1, 0:nout_local_yz-1))
571 do idz = 0, shape_x(3) - 1
572 do idy = 0, nout_local_yz - 1
573 do idx = 0, nout_local_xy - 1
574 if (boundaries(2) ==
'P ')
then
575 kx =
wavenumber(idx + idx_out_local_xy, shape_x(1), &
576 end_x(1)-start_x(1), p_forward)
578 kx =
wavenumber(idx + idx_out_local_xy, shape_x(1), &
579 end_x(1)-start_x(1), w_forward)
582 if (boundaries(1) ==
'P ')
then
583 ky =
wavenumber(idy + idx_out_local_yz, shape_x(2), &
584 end_x(2)-start_x(2), p_forward)
586 ky =
wavenumber(idy + idx_out_local_yz, shape_x(2), &
587 end_x(2)-start_x(2), w_forward)
590 if (boundaries(5) ==
'P ')
then
592 end_x(3)-start_x(3), p_forward)
595 end_x(3)-start_x(3), w_forward)
598 if (kx**2. + ky**2. + kz**2. < 1.e-9_dp)
then
599 ks(idz,idx,idy) = 0._dp
601 ks(idz, idx, idy) = 1._dp / ( &
618 use size_m
, only : nelv
619 use mesh, only : shape_x
623 use fft, only :p_forward, p_backward, w_forward, w_backward
626 real(DP),
allocatable :: rhs_coarse(:), soln_coarse(:)
629 real(DP),
allocatable :: plane_xy(:,:,:), plane_yx(:,:,:), plane_zy(:,:,:)
636 allocate(rhs_coarse(nelm))
638 rhs_coarse(i) =
lglel(i)
642 allocate(plane_xy(0:shape_x(1)-1, 0:nin_local_xy-1, 0:nin_local_yz-1) )
647 call
fft_r2r(plane_xy, shape_x(1), int(nin_local_xy * nin_local_yz), p_forward, rescale)
649 allocate(plane_yx(0:shape_x(2)-1, 0:nout_local_xy-1, 0:nin_local_yz-1) )
653 call
fft_r2r(plane_yx, shape_x(2), int(nout_local_xy * nin_local_yz), p_forward, rescale)
655 allocate(plane_zy(0:shape_x(3)-1, 0:nout_local_xy-1, 0:nout_local_yz-1) )
659 call
fft_r2r(plane_zy, shape_x(3), int(nout_local_xy * nout_local_yz), w_forward, rescale)
662 call
fft_r2r(plane_zy, shape_x(3), int(nout_local_xy * nout_local_yz), w_backward, rescale)
664 allocate(plane_yx(0:shape_x(2)-1, 0:nout_local_xy-1, 0:nin_local_yz-1) )
668 call
fft_r2r(plane_yx, shape_x(2), int(nout_local_xy * nin_local_yz), p_backward, rescale)
670 allocate(plane_xy(0:shape_x(1)-1, 0:nin_local_xy-1, 0:nin_local_yz-1))
674 call
fft_r2r(plane_xy, shape_x(1), int(nin_local_xy * nin_local_yz), p_backward, rescale)
676 plane_xy = plane_xy * (1._dp/ rescale)
678 allocate(soln_coarse(nelm)); soln_coarse = 0._dp
683 err = abs(soln_coarse(i) -
lglel(i))
684 if (err > 0.001)
then
685 write(*,*)
"WARNING: shuffle not working", nid, i, nid*nelm + i, err
689 if (nid == 0)
write(*,*)
"Passed shuffle test"
694 use size_m
, only : nelv
695 use mesh, only : shape_x
700 real(DP),
allocatable :: rhs_coarse(:)
703 integer :: idx, idy, idz
704 real(DP),
allocatable :: plane_xy(:,:,:), plane_yx(:,:,:), plane_zy(:,:,:)
711 allocate(rhs_coarse(nelm))
714 rhs_coarse(i) =
lglel(i)
718 allocate(plane_xy(0:shape_x(1)-1, 0:nin_local_xy-1, 0:nin_local_yz-1) )
722 do idx = 0, shape_x(1)-1
723 do idy = idx_in_local_xy, idx_in_local_xy + nin_local_xy - 1
724 do idz = idx_in_local_yz, idx_in_local_yz + nin_local_yz - 1
725 ieg = 1 + idx + idy * shape_x(1) + idz * shape_x(1) * shape_x(2)
726 err = abs(plane_xy(idx, idy-idx_in_local_xy, idz-idx_in_local_yz) - ieg)
727 if (err > 0.001)
then
728 write(*,
'(A,6(I6))')
"WARNING: confused about k after init", nid, idx, idy, idz, ieg, int(plane_xy(idy,idx,idz))
734 if (nid == 0)
write(*,*)
"Passed init"
739 allocate(plane_yx(0:shape_x(2)-1, 0:nout_local_xy-1, 0:nin_local_yz-1) )
743 do idx = 0, nout_local_xy - 1
744 do idy = 0, shape_x(2) - 1
745 do idz = 0, nin_local_yz - 1
746 ieg = 1 + idx + idx_out_local_xy + shape_x(1)*idy &
747 + shape_x(1) * shape_x(2) * (idz + idx_in_local_yz)
748 err = abs(plane_yx(idy,idx,idz) - ieg)
749 if (err > 0.001)
then
750 write(*,
'(A,6(I6))')
"WARNING: confused about k after xy", nid, idx, idy, idz, ieg, int(plane_yx(idy,idx,idz))
756 if (nid == 0)
write(*,*)
"Passed xy transpose"
758 allocate(plane_zy(0:shape_x(3)-1, 0:nout_local_xy-1, 0:nout_local_yz-1) )
762 do idx = 0, nout_local_xy - 1
763 do idy = 0, nout_local_yz - 1
764 do idz = 0, shape_x(3) - 1
765 ieg = 1 + idx + idx_out_local_xy + shape_x(1)*(idy + idx_out_local_yz) &
766 + shape_x(1) * shape_x(2) * idz
767 err = abs(plane_zy(idz,idx,idy) - ieg)
768 if (err > 0.001)
then
769 write(*,
'(A,6(I6))')
"WARNING: confused about k after yz", nid, idx, idy, idz, ieg, int(plane_zy(idz,idx,idy))
775 if (nid == 0)
write(*,*)
"Passed yz transpose"
781 use size_m
, only : lx1, ly1, lz1, nelv
782 use mesh, only : shape_x, start_x, end_x
786 use mesh, only : boundaries
788 use fft, only : p_forward, p_backward
789 use fft, only : w_forward, w_backward
792 real(DP),
allocatable :: rhs_fine(:,:,:,:)
793 real(DP),
allocatable :: rhs_coarse(:), soln_coarse(:)
797 real(DP),
allocatable :: plane_xy(:,:,:), plane_yx(:,:,:), plane_zy(:,:,:)
802 allocate(rhs_fine(lx1,ly1,lz1,nelm))
803 allocate(rhs_coarse(nelm))
806 rhs_coarse(i) = cos(8.*pi * (ix(3) / shape_x(3))) &
807 + cos(2.*pi * (ix(3) / shape_x(3)))
809 if (nid == 0)
write(*,*)
"COS TEST: rhs ", sqrt(
sum(rhs_coarse*rhs_coarse))
812 allocate(plane_xy(0:shape_x(1)-1, 0:nin_local_xy-1, 0:nin_local_yz-1) )
818 call
fft_r2r(plane_xy, shape_x(1), int(nin_local_xy * nin_local_yz), p_forward, rescale)
820 allocate(plane_yx(0:shape_x(2)-1, 0:nout_local_xy-1, 0:nin_local_yz-1) )
824 call
fft_r2r(plane_yx, shape_x(2), int(nout_local_xy * nin_local_yz), p_forward, rescale)
826 allocate(plane_zy(0:shape_x(3)-1, 0:nout_local_xy-1, 0:nout_local_yz-1) )
830 call
fft_r2r(plane_zy, shape_x(3), int(nout_local_xy * nout_local_yz), w_forward, rescale)
833 call
poisson_kernel(plane_zy, shape_x, start_x, end_x, boundaries)
836 call
fft_r2r(plane_zy, shape_x(3), int(nout_local_xy * nout_local_yz), w_backward, rescale)
838 allocate(plane_yx(0:shape_x(2)-1, 0:nout_local_xy-1, 0:nin_local_yz-1) )
842 call
fft_r2r(plane_yx, shape_x(2), int(nout_local_xy * nin_local_yz), p_backward, rescale)
844 allocate(plane_xy(0:shape_x(1)-1, 0:nin_local_xy-1, 0:nin_local_yz-1))
848 call
fft_r2r(plane_xy, shape_x(1), int(nin_local_xy * nin_local_yz), p_backward, rescale)
849 plane_xy = plane_xy * (1._dp/ rescale)
853 allocate(soln_coarse(nelm)); soln_coarse = 0._dp
855 if (nid == 0)
write(*,*)
"COS TEST: u_c ", &
856 sqrt(
sum(soln_coarse*soln_coarse)) * (2._dp * pi /(end_x(1)-start_x(1)))**2._dp
integer function gllel(ieg)
static double sum(struct xxt *data, double v, uint n, uint tag)
subroutine dssum(u)
Direct stiffness sum.
subroutine transpose_test()
subroutine poisson_kernel(grid, shape_x, start_x, end_x, boundaries)
subroutine mpi_wait(irequest, istatus, ierror)
subroutine shuffle_test()
subroutine init_mesh_to_grid(nelm, shape_x)
subroutine grid_to_mesh(grid, mesh, shape_x)
integer function, dimension(3) ieg_to_xyz(ieg)
subroutine mpi_comm_split(comm, icolor, ikey, comm_new, ierror)
subroutine mpi_irecv(data, n, datatype, iproc, itag, comm, irequest, ierror)
real(dp) function dnekclock()
integer function lglel(iel)
subroutine, public transpose_grid(grid, grid_t, shape_x, idx, idx_t, comm)
Global (parallel) transform of grid data.
integer function gllnid(ieg)
subroutine init_comm_infrastructure(comm_world, shape_x)
one-time setup of communication infrastructure for poisson_mod
integer function xyz_to_pid(ix, iy, iz, shape_x, shape_p)
subroutine mesh_to_grid(mesh, grid, shape_x)
subroutine, public spectral_solve(u, rhs)
subroutine mpi_comm_rank(comm, me, ierror)
subroutine, public fft_r2r(u, length, num, kind, rescale)
Compute a number of 1D FFTs or DCTs.
subroutine mpi_comm_free(comm, ierror)
subroutine mpi_comm_size(comm, nprocs, ierror)
real(dp) function, public wavenumber(i, N, L, kind)
Get the wavenumber of the ith mode.
subroutine mpi_isend(data, n, datatype, iproc, itag, comm, request, ierror)