[petsc-dev] snes/examples/tutorials/ex27.c

Jed Brown jedbrown at mcs.anl.gov
Tue Nov 15 17:24:08 CST 2011


On Tue, Nov 15, 2011 at 17:13, Barry Smith <bsmith at mcs.anl.gov> wrote:

>   Hmm, if I write my code to use SNES to solve a nonlinear system and
> decide I want to instead use Ptc I have to write new code and a whole knew
> interface.
>
>   If I wrote my code to use Jacobi and decided I wanted to try ILU should
> I have to write a new code?
>

Well, suppose you were allergic to assembled matrices, so you had a
MatShell and implemented Jacobi so that you could use Chebychev/Jacobi
smoothers. Now you want to do ILU. Sounds like you have to either assemble
a matrix or implement MatFactor*. (Coloring is a special trick, so let's
pretend it doesn't exist for the moment.)


> Obviously not so why is your case different? I just add a mass matrix (for
> example) and say I want to use Ptc with SNES or don't even add a mass
> matrix just say I want to use Ptc.
>

The problem is that it's often not physical for the mass matrix to be the
identity. The lid-driven cavity is a classical example of this, the
transient term should only be added to the vorticity and temperature
equations. It's physically nonsense to add a transient term to the velocity
(in velocity-vorticity form).

So sure, we can "guess" a bunch of stuff that you didn't tell us to
automatically put together a damped Newton method, but to do Ptc, you have
to provide the pseudo-transient form. It would be far more silly to tell
someone that to move from goofy damped Newton to Ptc with a proper
transient term involves rewriting for a different interface. But if you
don't do that, then you are going to have to add a
SNESSetPseudotransientJacobian() or some such special-purpose interface.

Use TS if your problem has a meaningful transient form, it's the more
general interface.


> > I think it would be more confusing to use SNES because then we would
> need to augment the SNES interface so the user can provide the IJacobian.
> Having another function signature that the user has to implement is BAD.
>
>   I think using TS to solve a nonlinear equation is more confusing.
>

If you add the interface, then YOU are going to be responsible for
explaining to users why there are two ways to add a transient term, but
only one can be used for time stepping.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111115/c228b3cd/attachment.html>


More information about the petsc-dev mailing list