> On Sep 23, 2017, at 12:48 PM, Mark W. Lohry <[email protected]> wrote:
> 
> I'm currently using JFNK in an application where I don't have a hand-coded 
> jacobian, and it's working well enough but as expected the scaling isn't 
> great.
> 
> What is the general process for using PC with MatMFFDComputeJacobian? Does it 
> make sense to occasionally have petsc re-compute the jacobian via finite 
> differences, and then recompute the preconditioner? Any that just need the 
> sparsity structure?

 Mark

   Yes, this is a common approach. SNESSetLagJacobian -snes_lag_jacobian 

    The normal approach in SNES to use matrix-free for the operator and use 
finite differences to compute an approximate Jacobian used to construct 
preconditioners is to to create a sparse matrix with the sparsity of the 
approximate Jacobian (yes you need a way to figure out the sparsity, if you use 
DMDA it will figure out the sparsity for you). Then you use 

   SNESSetJacobian(snes,J,J, SNESComputeJacobianDefaultColor, NULL);

and use the options database option -snes_mf_operator


> Are there any PCs that don't work in the matrix-free context?

  If you do the above you can use almost all the PC since you are providing an 
explicit matrix from which to build the preconditioner

> Are there any example codes I overlooked?
> 
> Last but not least... can the Boomer-AMG preconditioner work with JFNK? To 
> really show my ignorance of AMG, can it actually be written as a matrix 
> P^-1(Ax-b)=0, , or is it just a linear operator?

  Again, if you provide an approximate Jacobian like above you can use it with 
BoomerAMG, if you provide NO explicit matrix you cannot use BoomerAMG or almost 
any other preconditioner.

   Barry

> 
> Thanks,
> Mark

Reply via email to