[petsc-users] snes options for rough solution

Praveen C cpraveen at gmail.com
Tue Dec 13 00:07:56 CST 2016


You are right, this problem needs adaptive time stepping. Can you recommend
some papers/books on this, wrt schemes implemented in Petsc.

I could write my problem in Petsc and solve with backward euler and snes (I
was using fenics before). I will try TS next.

Matt, I tried -snes_fd which takes more iterations than with exact
Jacobian, and gives same answer. So my exact Jacobian should be ok.

I have been learning petsc since a few months, and it is great that I can
already solve my problems with it. Its been a lot of fun coding with petsc.

Best
praveen

On Mon, Dec 12, 2016 at 11:08 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
>   Very cool problem.
>
>    I think you should use TS to solve it. TS has higher order solvers with
> adaptive time-stepping, likely at the very beginning it will end up with a
> very small time step but then quickly increase the time-step. Frankly it is
> goofy to use backward Euler with fixed time step on this problem; you'll
> find that TS is no harder to use than SNES, you just need to use
> TSSetRHSFunction() and TSSetRHSJacobian() and select an implicit solver.
>
>    Barry
>
> > On Dec 12, 2016, at 2:29 AM, Praveen C <cpraveen at gmail.com> wrote:
> >
> > Hello Matt
> >
> > I have attached the detailed output.
> >
> > Fenics automatically computes Jacobian, so I think Jacobian should be
> correct. I am not able to run the Fenics code without giving the Jacobian.
> I am currently writing a C code where I can test this.
> >
> > This equation is bit weird. Its like this
> >
> > u_t = ( K u_x)_x
> >
> > K = u / sqrt(u_x^2 + eps^2)
> >
> > If u > 0, then this is a nonlinear parabolic eqn. Problem is that eps =
> h (mesh size), so at extrema, it is like
> >
> > u_t = (u/eps)*u_xx
> >
> > and (1/eps) is approximating a delta function.
> >
> > Best
> > praveen
> >
> > On Mon, Dec 12, 2016 at 12:41 PM, Matthew Knepley <knepley at gmail.com>
> wrote:
> > On Mon, Dec 12, 2016 at 1:04 AM, Matthew Knepley <knepley at gmail.com>
> wrote:
> > On Mon, Dec 12, 2016 at 12:56 AM, Praveen C <cpraveen at gmail.com> wrote:
> > Increasing number of snes iterations, I get convergence.
> >
> > So it is a problem of initial guess being too far from the solution of
> the nonlinear equation.
> >
> > Solution can be seen here
> >
> > https://github.com/cpraveen/fenics/blob/master/1d/cosmic_
> ray/cosmic_ray.ipynb
> >
> > Also, how is this a parabolic equation? It looks like u/|u'| to me,
> which does not look parabolic at all.
> >
> >   Matt
> >
> > Green curve is solution after two time steps.
> >
> > It took about 100 snes iterations in first time step and about 50 in
> second time step.
> >
> > I use exact Jacobian and direct LU solve.
> >
> > I do not believe its the correct Jacobian. Did you test it as I asked?
> Also run with
> >
> >   -snes_monitor -ksp_monitor_true_residual -snes_view
> -snes_converged_reason
> >
> > and then
> >
> >   -snes_fd
> >
> > and send all the output
> >
> >    Matt
> >
> > Thanks
> > praveen
> >
> >
> >
> > --
> > 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
> >
> > <log.txt>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20161213/6ea013c0/attachment-0001.html>


More information about the petsc-users mailing list