Skip to content

Commit

Permalink
print wall time of poisson solver, try without modifying neighbors of…
Browse files Browse the repository at this point in the history
… the special element, zero guess in RK step 1
  • Loading branch information
fjansson committed Apr 1, 2022
1 parent 2f59d56 commit 729ce43
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
22 changes: 15 additions & 7 deletions src/modhypre.f90
Original file line number Diff line number Diff line change
Expand Up @@ -271,20 +271,20 @@ subroutine inithypre_grid
! similar to other diagonal values

!! from here on, it's the neighbors of the special element
values( (i+1+j*imax)*7 + 1) = 0 ! west link of east neighbor
values( (i-1+j*imax)*7 + 2) = 0 ! east link of west neighbor
values( (i+(j+1)*imax)*7 + 3) = 0 ! south link of north neighbor
values( (i+(j-1)*imax)*7 + 4) = 0 ! north link of south neighbor
!values( (i+1+j*imax)*7 + 1) = 0 ! west link of east neighbor
!values( (i-1+j*imax)*7 + 2) = 0 ! east link of west neighbor
!values( (i+(j+1)*imax)*7 + 3) = 0 ! south link of north neighbor
!values( (i+(j-1)*imax)*7 + 4) = 0 ! north link of south neighbor
end if
if (k == 11 .and. myidx == 0 .and. myidy == 0) then
i = imax/2
j = jmax/2
values( (i+j*imax)*7 + 5) = 0 ! down link of above neighbor
!values( (i+j*imax)*7 + 5) = 0 ! down link of above neighbor
end if
if (k == 9 .and. myidx == 0 .and. myidy == 0) then
i = imax/2
j = jmax/2
values( (i+j*imax)*7 + 6) = 0 ! up link of below neighbor
!values( (i+j*imax)*7 + 6) = 0 ! up link of below neighbor
end if


Expand Down Expand Up @@ -536,7 +536,7 @@ subroutine set_zero_guess()

subroutine solve_hypre(solver, p, converged)
use modmpi, only : myid, myidx, myidy
use modglobal, only : i1, j1, ih, jh, imax, jmax, kmax
use modglobal, only : i1, j1, ih, jh, imax, jmax, kmax, rk3step

implicit none

Expand Down Expand Up @@ -575,6 +575,14 @@ subroutine solve_hypre(solver, p, converged)

! use current values (ie. the solution to the previous call) as starting point

! ...except in the beginning of a full RK step
if(rk3step == 1) then
if (myid == 0) then
write(*,*) "Poisson solver: initial guess 0"
end if
call set_zero_guess()
end if

!-----------------------------------------------------------------------
! 2. Call a solver
!-----------------------------------------------------------------------
Expand Down
17 changes: 12 additions & 5 deletions src/modpois.f90
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ subroutine exitpois
use modfft2d, only : fft2dexit
use modhypre, only : exithypre_grid, exithypre_solver
use modfftw, only : fftwexit

implicit none

if (solver_id == 0) then
! FFT based solver
call fft2dexit(p,Fp,d,xyrt)
Expand All @@ -101,13 +101,16 @@ subroutine poisson
use modhypre, only : solve_hypre, set_zero_guess
use modfftw, only : fftwf, fftwb
use modfft2d, only : fft2df, fft2db

use mpi

implicit none

real wtime
logical converged

call fillps
wtime = MPI_Wtime()

call fillps

if (solver_id == 0) then
! Forward FFT
call fft2df(p, Fp)
Expand Down Expand Up @@ -148,6 +151,10 @@ subroutine poisson

call tderive

if (myid == 0) then
wtime = MPI_Wtime() - wtime
write (*,*) 'Poisson, time spent:', wtime, 's'
end if
end subroutine poisson

subroutine fillps
Expand Down

0 comments on commit 729ce43

Please sign in to comment.