Hello PETSc Users,

I am using Matrix-Free SNES solver with the following options
PETSC_OPTIONS="ksp_type gmres -snes_monitor_short -snes_mf -user_precond"

and shell-ILU preconditioner that I create as following:

! ===============================

      call PCSetType(pc,PCSHELL,ierr)
      call PCShellSetUp
      call PCShellSetApply(pc,PCShellApply,ierr)
      call PCShellSetName(pc,"ShellPC",ierr)

! ===============================

  subroutine PCShellSetUp()
    implicit none

     call SetInitialMatrix   ! Assambles matrix A

     call PCCreate(PETSC_COMM_WORLD,mf_prec,ierr)
     call PCSetType(mf_prec,PCILU,ierr)
     call PCSetOperators(mf_prec,A,A,ierr)
     call PCSetUp(mf_prec,ierr)
     call PCShellSetName(mf_prec,"LinPC",ierr)

  end subroutine PCShellSetUp

! ===============================

  subroutine PCShellApply(pc_tmp,x_tmp,y_tmp,ierr)
    implicit none
    PC  :: pc_tmp
    Vec :: x_tmp,y_tmp
    PetscErrorCode :: ierr

    call PCApply(mf_prec,x_tmp,y_tmp,ierr)

  end subroutine PCShellApply

! ===============================

* If matrix A changes during a simulation, how can I update preconditioner? Is calling "PCSetUp(mf_prec,ierr)" enough?

* Function PCView prints out information about type and size of preconditioner. Can I view/get preconditioner matrix itself? I want to compare it with reference matrix.

If I try to MatView factored matrix:
    call PCFactorGetMatrix(mf_prec,pcmat,ierr)
    call MatView(pcmat, PETSC_VIEWER_STDOUT_SELF,ierr)

Then I get the following error:
[0]PETSC ERROR: No viewers for factored matrix except ASCII info or info_detailed

Thanks!



Reply via email to