# [petsc-users] snes + matrix free + coloring

Jed Brown jedbrown at mcs.anl.gov
Wed Oct 10 17:17:58 CDT 2012

```You can set this as the Jacobian routine.

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESDefaultComputeJacobianColor.html

This example, cited in the link above, creates a coloring.

http://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex45.c.html

On Wed, Oct 10, 2012 at 5:13 PM, <panourg at mech.upatras.gr> wrote:

> It makes sense because i want to compute the preconditioner only per some
> time steps of my finite element code whereas in other times step
> (non-linear systems) i dont compute the prec and only the mf works using
> the same prec from previous step.
>
> Finally, could you tell me a source with all these functions so that i can
> solve my problem?
>
> Thanks
>
>
>
>
> > On Wed, Oct 10, 2012 at 4:33 PM, <panourg at mech.upatras.gr> wrote:
> >
> >> What do you mean when you say that i do not use a matrix free method at
> >> all?
> >>
> >> With matrix-free method only the operator is "free". Not the
> >> preconditioning matrix.
> >>
> >
> > Yes, but if you are assembling the Jacobian using coloring, but then only
> > using it as a preconditioner and using a separate matrix-free finite
> > differencing step to apply the operator, then you are just goofing off.
> Of
> > course you can do it, but it doesn't make sense.
> >
> >
> >>
> >> For this i always set -snes_mf_operator option.
> >>
> >> Either way is any way to have preconditioner without forming the its
> >> prec
> >> matrix??
> >>
> >>
> > Sure, but you have to understand the problem, e.g., multilevel structure,
> > plane waves, an embedded discretization. If you want to use PETSc's
> > automatic preconditioners instead of rolling your own, then you should
> > assemble the operator.
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121010/e64a2e83/attachment.html>
```