update example to write to unit 6 with formats, similar to petsc examples which work with pxse 2018 beta
& '-n',n,flg,ierr)
if (rank .eq. 0) then
- write(*,100) n
+ write(6,100) n
endif
100 format (/'1-D Laplacian Eigenproblem, n =',I3,' (Fortran)')
call EPSSolve(eps,ierr)
call EPSGetIterationNumber(eps,its,ierr)
if (rank .eq. 0) then
- write(*,110) its
+ write(6,110) its
endif
110 format (/' Number of iterations of the method:',I4)
! ** Optional: Get some information from the solver and display it
call EPSGetType(eps,tname,ierr)
if (rank .eq. 0) then
- write(*,120) tname
+ write(6,120) tname
endif
120 format (' Solution method: ',A)
call EPSGetDimensions(eps,nev,PETSC_NULL_INTEGER, &
& PETSC_NULL_INTEGER,ierr)
if (rank .eq. 0) then
- write(*,130) nev
+ write(6,130) nev
endif
130 format (' Number of requested eigenvalues:',I2)
call EPSGetTolerances(eps,tol,maxit,ierr)
if (rank .eq. 0) then
- write(*,140) tol, maxit
+ write(6,140) tol, maxit
endif
140 format (' Stopping condition: tol=',1P,E10.4,', maxit=',I4)
! ** Get number of converged eigenpairs
call EPSGetConverged(eps,nconv,ierr)
if (rank .eq. 0) then
- write(*,150) nconv
+ write(6,150) nconv
endif
150 format (' Number of converged eigenpairs:',I2/)
! ** Display eigenvalues and relative errors
if (nconv.gt.0) then
if (rank .eq. 0) then
- write(*,*) ' k ||Ax-kx||/||kx||'
- write(*,*) ' ----------------- ------------------'
+ write(6,'(a)') ' k ||Ax-kx||/||kx||'
+ write(6,'(a)') ' ----------------- ------------------'
endif
do i=0,nconv-1
! ** Get converged eigenpairs: i-th eigenvalue is stored in kr
! ** Compute the relative error associated to each eigenpair
call EPSComputeError(eps,i,EPS_ERROR_RELATIVE,error,ierr)
if (rank .eq. 0) then
- write(*,160) PetscRealPart(kr), error
+ write(6,160) PetscRealPart(kr), error
endif
160 format (1P,' ',E12.4,' ',E12.4)
enddo
if (rank .eq. 0) then
- write(*,*)
+ write(6,'(a)') ' '
endif
endif
