[petsc-users] Problems about Preconditioner in SNES

Smith, Barry F. bsmith at mcs.anl.gov
Wed Dec 19 12:51:18 CST 2018



> On Dec 19, 2018, at 9:07 AM, Yingjie Wu via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> Respected Petsc developers:             
> Hi,             
> Recently, I developed a two-dimensional non-linear equations solver (SNES) using Petsc to solve temperature, velocity and pressure fields.  Since the coupling characteristics of the problem are complex, it is difficult to construct Jacobian matrix explicitly, so Matrix-Free method with Preconditioner is adopted.  I have the following questions about the Petsc's Preconditioner. 
> 
> 1. Is the preconditioning matrix updated in linear or non-linear steps?  

   At each nonlinear iteration the routine set with SNESSetJacobian() is called for you to provide the new Jacobian. 

> Because the elements in my preconditioning matrix are functions of variables (such as density is a function of temperature and pressure, and preconditioning matrix elements often contain density).  
> 
> 2.For some problems the preconditioning matrix element are constant, if it possible that the preconditioning matrix is constructed and decomposed only once at the beginning of the program and used for subsequent calculation? 

    Yes. PETSc only rebuilds the preconditioner after YOU change entries in the matrix with MatSetValues() etc. it knows if the matrix has not been changed (for example if you solve a linear problem with SNES) and doesn't rebuild the preconditioner.

> 
> 3. What is the difference between using Matrix-Free method and using normal Newton method for preconditioning matrix?  

   With Matrix-free you do not provide the elements to the matrix with MatSetValues() etc, with "normal" Newton's method you do. Really the only difference between the two is how the linear system is solved; Newton's method is the same in both cases.

> As far as I know, when using the Matrix-Free method, the type of preconditioning matrix needs to be defined as MATMFFD. Are there any other differences? 
> 
> Thanks,
> Yingjie



More information about the petsc-users mailing list