SNESPruneJacobianColor#
Remove nondiagonal zeros in the Jacobian matrix and update the MatMFFD
coloring information based on the new nonzero structure
Synopsis#
#include "petscsnes.h"
#include "petscdm.h"
PetscErrorCode SNESPruneJacobianColor(SNES snes, Mat J, Mat B)
Collective
Input Parameters#
snes - the
SNES
contextJ - Jacobian matrix (not altered in this routine)
B - newly computed Jacobian matrix to use with preconditioner (generally the same as
J
)
Notes#
This function improves the MatMFFD
coloring performance when the Jacobian matrix is overallocated or contains
many constant zeros entries, which is typically the case when the matrix is generated by a DM
and multiple fields are involved.
Users need to make sure that the Jacobian matrix is properly filled to reflect the sparsity
structure. For MatMFFD
coloring, the values of nonzero entries are not important. So one can
usually call SNESComputeJacobian()
with randomized input vectors to generate a dummy Jacobian.
SNESComputeJacobian()
should be called before SNESSolve()
but after SNESSetUp()
.
See Also#
SNES: Nonlinear Solvers, SNESComputeJacobianDefaultColor()
, MatEliminateZeros()
, MatFDColoringCreate()
, MatFDColoringSetFunction()
Level#
intermediate
Location#
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages