Thank you Dmitry. Yes, I am now fully understanding what '-snes_mf' and '-snes_mf_operator' are doing. Got a bit confused by the '-snes' keyword used in Moose. As you mentioned, this is for input completeness sake, so I guess there are default options as this keyword is used. I will dig out what are those default options.
Appreciate your answer. Ling On Thu, Sep 27, 2012 at 12:30 PM, Dmitry Karpeev <karpeev at mcs.anl.gov>wrote: > > > On Thu, Sep 27, 2012 at 1:22 PM, Matthew Knepley <knepley at gmail.com>wrote: > >> On Thu, Sep 27, 2012 at 2:13 PM, Zou (Non-US), Ling <ling.zou at >> inl.gov>wrote: >> >>> Thank you Matt. >>> >>> I've noticed that there is a different option '-snes_fd', and I guess >>> PETSc will use finite difference method for both Jacobian (action) and >>> Preconditioner? >>> >> >> -snes_fd uses FD to create the entire dense Jacobian. This is just for >> testing. -snes_mf uses FD to evaluate the action >> of the Jacobian on a vector. >> >> >>> By the way, do you have any comments on my another question? >>> ==================== >>> One more question, if I pass '-snes' to PETSc, since it is direct >>> Newton's method, I assume it will explicitly construct a Jacobian. Does >>> this Jacobian come from user provided Jacobian or from the finite >>> difference Jacobian? >>> ==================== >>> >> Ling, > -snes isn't really a PETSc option. I think Moose recommends using it for > "completeness" and in contrast to -snes_mf or -snes_mf_operator, > so that users aren't confused about what's being used to compute the > Jacobian when both -snes_mf and -snes_mf_operator are omitted. > I'll copy this to to moose-users, in case it is useful there. > > -snes_mf will implement the action of the Jacobian approximately by > differencing the residual. No preconditioner matrix will be used. > -snes_mf_operator is like -snes_mf, except the user-provided > preconditioner matrix will be used. > -snes_fd will *assemble* both the Jacobian and the preconditioner matrix > using the same residual-differencing algorithm as in -snes_mf. > > Dmitry. > > > >> The option -snes does not do anything. I am not sure what you are asking >> here. If you mean, >> what is used when you pass -snes_mf or -snes_mf_operator, it is FD, not >> the user provided >> Jacobian routine if it exists. >> >> Matt >> >> >>> Best, >>> >>> Ling >>> >>> On Thu, Sep 27, 2012 at 12:09 PM, Matthew Knepley <knepley at >>> gmail.com>wrote: >>> >>>> On Thu, Sep 27, 2012 at 2:01 PM, Zou (Non-US), Ling <ling.zou at >>>> inl.gov>wrote: >>>> >>>>> Dear all, >>>>> >>>>> I have a question on the PETSc option '-snes_mf_operator'. >>>>> I am reading the <PETSc Users Manual Revision 3.3>. On page 100, >>>>> 2nd paragraph, it says: >>>>> >>>>> >>>>> ============================================================================== >>>>> "However, it allows us to check the analytic Jacobian we construct in >>>>> FormJacobian() by passing the -snes_mf_operator flag. This causes PETSc to >>>>> approximate the Jacobian using finite differencing of the function >>>>> evaluation (discussed in section 5.6), and the analytic Jacobian >>>>> becomes merely the preconditioner." >>>>> >>>>> ============================================================================== >>>>> >>>>> I wonder, if the '-snes_mf_operator' option is used, the Jacobian will >>>>> always be calculated from the finite difference method while >>>>> ignore whatever has been provided from user. >>>>> >>>> Yes, yhe action will be FD, but it will take the user provided operator >>>> to form a preconditioner from. >>>> >>>> Matt >>>> >>>> >>>>> One more question, if I pass '-snes' to PETSc, since it is direct >>>>> Newton's method, I assume it will explicitly construct a Jacobian. Does >>>>> this Jacobian come from user provided Jacobian or from the finite >>>>> difference Jacobian? >>>>> >>>>> >>>>> Thanks, >>>>> >>>>> >>>>> Ling >>>>> >>>>> >>>> >>>> >>>> -- >>>> What most experimenters take for granted before they begin their >>>> experiments is infinitely more interesting than any results to which their >>>> experiments lead. >>>> -- Norbert Wiener >>>> >>> >>> >> >> >> -- >> What most experimenters take for granted before they begin their >> experiments is infinitely more interesting than any results to which their >> experiments lead. >> -- Norbert Wiener >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120927/f2c7c155/attachment-0001.html>