Example 11 : Preconditioning

For a detailed discussion on preconditioning in MOOSE, see Preconditioning System.

To summarize, an accurate and complete preconditioning matrix can be important for an efficient Preconditioned Jacobian-Free Newton-Krylove (PJFNK) solve. It's absolutely essential for solve_type = NEWTON. MOOSE has ultiple options for buiding the preconditioning matrix :

  • (Default) Block Diagonal Preconditioning

  • Single Matrix Preconditioner (SMP)

  • Finite Difference Preconditioner (FDP)

  • Physics Based Preconditioner (PBP)

Block diagonal preconditioning uses kernels' and integrated boundary conditions' computeQpJacobian methods to build a block diagonal matrix. It will not account for variable coupling. This is the default if a user does not specify a [Preconditiong] block in their input file.

The Single Matrix Preconditioner builds its matrix using kernels' and integrated BCs' computeQpJacobian and computeQpOffDiagJacobian methods, the latter of which is responsible for the contributions of coupled variables. A good, simple example of a computeQpOffDiagJacobian method is in CoupledForce. CoupledForce contributes a waek-form residual equal to

To determine the corresponding off-diagonal Jacobian contribution, one must take the deriative:

To make use of user-specified computeQpOffDiagJacobian methods, one should specify in his/her input file:

    type = SMP
    full = true

The user may also choose to omit certain off-diagonal entries from their SMP matrix; this is outlined in the detailed Preconditioning article.

To build a preconditioning matrix through finite differencing of the residuals, the user can specify in his/her input file:

    type = FDP
    full = true

This will create a near-perfect preconditioning matrix; however, it is extremely slow and will only work in serial. FDP should only be used for debugging purposes.

Complete source files