KSP setup of ILU Preconditioner in PFLOTRAN

51 views
Skip to first unread message

Robert Annewandter

unread,
Jan 4, 2017, 7:52:22 AM1/4/17
to pflotr...@googlegroups.com
Hi all,

I like to recapture the solver and preconditioning behaviour of PFLOTRAN by a separate PETSc script, which uses exported Jacobian, residual and solution (last one to initialise a non zero guess) at a given Newton/SNES iteration. For that iteration, ideally I get the same linear solver convergence behaviour as PFLOTRAN has (when using -ksp_monitor_true_residual). I use GMRES with an ILU Preconditioner in PFLOTRAN.

Problem is, my PETSc script fails to provide convergence when using PCILU as preconditioner. So I wonder whether someone can point me to the relevant .f90 where the KSP is setup wrt to ILU. That would help me to setup my KSP solver correctly.

Many thanks!

Robert

Hammond, Glenn E

unread,
Jan 4, 2017, 11:13:55 AM1/4/17
to pflotr...@googlegroups.com

Robert,

 

Within PFLOTRAN, the KSP is set up automatically by the nonlinear solver (SNES).  PFLOTRAN is fairly “hands off” at that stage. 

 

What exactly are you looking for with respect to the ILU preconditioner?  Do you want all the settings for the KSP and PC?  If so, I believe that you can use KSPView and PCView to get many of the settings (e.g. the level of fill in ILU, GMRES restart, etc.).  You can also use KSPGetTolerances to obtain the convergence criteria used.  These calls will have to be embedded in PFLOTRAN.

 

What do you mean by the “PETSc script fails to provide convergence when using PCILU”?  If fails to provide convergence info for the preconditioner (PC) or for the Krylov solver (KSP)?  I would not expect convergence info. from the PC.

 

Once we narrow down the exact issue, we can approach the PETSc devs about this.

 

Glenn

--
You received this message because you are subscribed to the Google Groups "pflotran-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pflotran-dev/ebdd2d30-68fb-1250-7d8d-c28059dbfb27%40opengosim.com.

Robert Annewandter

unread,
Jan 5, 2017, 4:41:19 AM1/5/17
to pflotr...@googlegroups.com
Thanks Glenn!

I've attached named PETSc script for illustration purpose. Because I'm new to PETSc I'm interested in how exactly to setup KSP to closely reproduce PLFOTRAN's linear solver part, i.e. which PETSc commands to use with which options. I can then do generic testing and prototyping of the 2 Stage PC outside PFLOTRAN before I merge it with PFLOTRAN. The attached script now has the ILU issue resolved.

My wording re: script is failing was a bit sloppy. What I meant was that I get following error message when using ILU as preconditioner (and GMRES as Krylov solver):

"Linear solve did not converge due to DIVERGED_PCSETUP_FAILED iterations 0
               PCSETUP_FAILED due to FACTOR_NUMERIC_ZEROPIVOT "

I resolved it by looking into solver.f90 and using PCFactorSetShiftType(pc, MAT_SHIFT_INBLOCKS), specifically 
MAT_SHIFT_INBLOCKS made the difference (I tried other flags before coming across solver.f90).

Robert


main.c

Hammond, Glenn E

unread,
Jan 16, 2017, 4:06:44 PM1/16/17
to pflotr...@googlegroups.com

Robert,

 

Sorry for the delayed response.  You may also want to try adjusting the zero pivot tolerance (LU_ZERO_PIVOT_TOL), which can be done through the input deck:

 

http://documentation.pflotran.org/user_guide/cards/process_model_cards/linear_solver_card.html

Robert Annewandter

unread,
Jan 17, 2017, 8:00:53 AM1/17/17
to pflotr...@googlegroups.com
Thank you very much Glenn! I've already accounted for that via PCFactorSetZeroPivot( pc, 2.22045e-14);

We're able to reproduce iteration number and residual but somehow the solution is off by an order of magnitude. We're currently reducing the complexity of the toy PETSc script  and the core linear Solver part of PFLOTRAN to get to the bottom of this.

Robert


Reply all
Reply to author
Forward
0 new messages