<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 31, 2015 at 9:03 PM, Juris Vencels <span dir="ltr"><<a href="mailto:juris.vencels@gmail.com" target="_blank">juris.vencels@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hello PETSc Users,<br>
<br>
I am using Matrix-Free SNES solver with the following options<br>
PETSC_OPTIONS="ksp_type gmres -snes_monitor_short -snes_mf
-user_precond"<br>
<br>
and shell-ILU preconditioner that I create as following:<br></div></blockquote><div><br></div><div>This is not the canonical PETSc way to do this. We would suggest using the matrix A</div><div>as the preconditioner matrix which you would give back in FormJacobian(). Then all</div><div>the reforming would be handled automatically.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
! ===============================<br>
<br>
call PCSetType(pc,PCSHELL,ierr)<br>
call PCShellSetUp<br>
call PCShellSetApply(pc,PCShellApply,ierr)<br>
call PCShellSetName(pc,"ShellPC",ierr)<br>
<br>
! ===============================<br>
<br>
subroutine PCShellSetUp() <br>
implicit none<br>
<br>
call SetInitialMatrix ! Assambles matrix A<br>
<br>
call PCCreate(PETSC_COMM_WORLD,mf_prec,ierr)<br>
call PCSetType(mf_prec,PCILU,ierr)<br>
call PCSetOperators(mf_prec,A,A,ierr)<br>
call PCSetUp(mf_prec,ierr)<br>
call PCShellSetName(mf_prec,"LinPC",ierr)<br>
<br>
end subroutine PCShellSetUp<br>
<br>
! ===============================<br>
<br>
subroutine PCShellApply(pc_tmp,x_tmp,y_tmp,ierr)<br>
implicit none<br>
PC :: pc_tmp<br>
Vec :: x_tmp,y_tmp<br>
PetscErrorCode :: ierr<br>
<br>
call PCApply(mf_prec,x_tmp,y_tmp,ierr)<br>
<br>
end subroutine PCShellApply<br>
<br>
! ===============================<br>
<br>
* If matrix A changes during a simulation, how can I update
preconditioner? Is calling "PCSetUp(mf_prec,ierr)" enough?<br>
<br>
* 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.<br>
<br>
If I try to MatView factored matrix:<br>
call PCFactorGetMatrix(mf_prec,pcmat,ierr)<br>
call MatView(pcmat, PETSC_VIEWER_STDOUT_SELF,ierr)<br>
<br>
Then I get the following error:<br>
[0]PETSC ERROR: No viewers for factored matrix except ASCII info
or info_detailed<br>
<br>
Thanks!<br>
<br>
<br>
<br>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>