[petsc-users] Problems about Preconditioner in SNES
Smith, Barry F.
bsmith at mcs.anl.gov
Wed Dec 19 22:10:07 CST 2018
> On Dec 19, 2018, at 9:47 PM, Yingjie Wu <yjwu16 at gmail.com> wrote:
>
>
>
> Yingjie Wu <yjwu16 at gmail.com> 于2018年12月19日周三 下午10:14写道:
> Thanks for your reply.
>
> I feel sorry that my last email was not very clear. Recently, I use Petsc to write a thermal program (including temperature, pressure, velocity field). I use the Matrix-Free method with user-defined precinditioning, in which the PC_TYPE is ILU (0).
>
> Due to the complexity of the direct relationship between the fields, I can only construct an approximate Jacobian matrix (which only contains the Jacobian matrix inside a single physical field, similar to block Jacobi preconditioning), and use this approximate Jacobian matrix as the preconditioning matrix.
> My preconditioning matrix construction method is to use SNESSetJacobian to construct the preconditioning matrix B (MatSetValues), but not to operate on the Jacobian matrix J (due to the use of Matrix Free method).
> At the same time, the elements of the preconditioning matrix are transformed, which changes with the change of the solution vector u, but the position and number of non-zero elements remain unchanged.
>
> So I wonder in particular whether the preprocessing matrix will be updated in the linear step (Gmres iteration step)? Because the solution vector will change in each linear step, the preconditioning matrix will change.
> "preconditioning matrix"
> Since I'm using the default settings, will the preconditioning matrix change in every linear step?
The preconditioner will not change at every linear step. In Newton's method (of any kind) the linearized problem is "frozen" for an entire Newton step (which includes multiple linear iterations). Hence the linear system being solved does not change with a Newton step
>
>
>
> I read an article about fgmres. This method applies to variable preconditioning matrices. Is it applicable to my problem?
No, really nothing to do with your situation,
Barry
>
> Thanks,
> Yingjie
>
> Smith, Barry F. <bsmith at mcs.anl.gov> 于2018年12月19日周三 下午1:51写道:
>
>
> > 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