On Tue, Jun 7, 2011 at 10:44 AM, Danesh Daroui <span dir="ltr"><<a href="mailto:danesh.daroui@ltu.se">danesh.daroui@ltu.se</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
So, it is not implemented? That's too bad! ILU with drop threshold is<br>
very useful so I am wondering why it is not implemented yet? Do you have<br>
any plan to implement it?<br></blockquote><div><br></div><div>It is not very scalable, so it is only really useful in a serial code. We tend to focus</div><div>on parallel algorithms which are scalable. We don't have any plans to implement it,</div>
<div>but we do take code submissions.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Setting levels did work OK for me. I have another question. If I want to<br>
calculate the preconditioner once, and use it later to solve other<br>
equations, since I know that the preconditioner would be OK because I<br>
solve several equations in several iterations and I know that my<br>
coefficient matrix will not change that much so calculating the<br>
preconditioner at once would be OK. What routines should I call once and<br>
how can I apply the pre-calculated preconditioner each time I want to<br>
solve the equation?<br></blockquote><div><br></div><div>You would use KSPSetOperators() with SAME_PRECONDITIONER.</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;">
<br>
Thanks,<br>
<br>
D.<br>
<br>
<br>
<br>
On Tue, 2011-06-07 at 10:28 -0500, Barry Smith wrote:<br>
> Sorry for the confusion, it is our fault. We don't have a drop tolerance ILU hence PCFactorSetDropTolerance() isn't doing anything.<br>
><br>
> You can run with -pc_factor_levels M or call PCFactorSetLevels(pc,M) in the code where M is the size of the matrix.<br>
><br>
> Barry<br>
><br>
> On Jun 7, 2011, at 10:20 AM, Danesh Daroui wrote:<br>
><br>
> ><br>
> > Hi,<br>
> ><br>
> > I want to use incomplete LU preconditioner. My code works OK when I use<br>
> > no preconditioner and direct solver for test:<br>
> ><br>
> ><br>
> > ierr=KSPCreate(PETSC_COMM_WORLD, &ksp);<br>
> > ierr=KSPSetOperators(ksp, Mp, Mp, DIFFERENT_NONZERO_PATTERN);<br>
> > ierr=KSPSetTolerances(ksp, 1.e-2/Msize, 1.e-50, PETSC_DEFAULT,<br>
> > PETSC_DEFAULT);<br>
> ><br>
> > // GMRES iterative solver is used<br>
> > ierr=KSPSetType(ksp, KSPGMRES);<br>
> ><br>
> > // no PETSc preconditioner is used<br>
> > ierr=KSPGetPC(ksp, &prec);<br>
> > ierr=PCSetType(prec, PCLU);<br>
> ><br>
> > // set up the solver according to the options<br>
> > ierr=KSPSetFromOptions(ksp);<br>
> ><br>
> > ierr=KSPSetUp(ksp);<br>
> ><br>
> > // solve the equation using an iterative solver<br>
> > ierr=KSPSolve(ksp, bp, xp);<br>
> ><br>
> ><br>
> > Again for some tests, at the first step, I want to use ILU but create<br>
> > the exact LU and then change the parameters to tune the preconditioner<br>
> > and I almost know what values to set according to my tests in MATLAB. I<br>
> > use the code below to create the get exact LU, using ILU preconditioner:<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > ierr=KSPCreate(PETSC_COMM_WORLD, &ksp);<br>
> > ierr=KSPSetOperators(ksp, Mp, Mp, DIFFERENT_NONZERO_PATTERN);<br>
> > ierr=KSPSetTolerances(ksp, 1.e-2/Msize, 1.e-50, PETSC_DEFAULT,<br>
> > PETSC_DEFAULT);<br>
> ><br>
> > // GMRES iterative solver is used<br>
> > ierr=KSPSetType(ksp, KSPGMRES);<br>
> ><br>
> > // no PETSc preconditioner is used<br>
> > ierr=KSPGetPC(ksp, &prec);<br>
> > ierr=PCSetType(prec, PCILU);<br>
> ><br>
> > PetscReal dt=1e-10;<br>
> > PetscReal dtcol=0.1;<br>
> > PetscInt maxrowcount=M;<br>
> > PCFactorSetDropTolerance(prec, dt, dtcol, maxrowcount);<br>
> ><br>
> > // set up the solver according to the options<br>
> > ierr=KSPSetFromOptions(ksp);<br>
> ><br>
> > ierr=KSPSetUp(ksp);<br>
> ><br>
> > // solve the equation using an iterative solver<br>
> > ierr=KSPSolve(ksp, bp, xp);<br>
> ><br>
> ><br>
> > and my coefficient matrix is a square "MxM" matrix and I pass "M" as<br>
> > "maxrowcount". Using this code, the solver never converges while it<br>
> > solved the equation using previous code (direct solver). Can anybody let<br>
> > me know how can I get exact LU using ILU and what parameters should I<br>
> > change in the above code?<br>
> ><br>
> > Regards,<br>
> ><br>
> > D.<br>
> ><br>
> ><br>
><br>
><br>
<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>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<br>