[petsc-users] Newton methods that converge all the time

Matthew Knepley knepley at gmail.com
Thu Nov 30 07:49:05 CST 2017


On Thu, Nov 30, 2017 at 7:41 AM, Buesing, Henrik <
hbuesing at eonerc.rwth-aachen.de> wrote:

> Dear Matt,
>
>
>
> I wanted to try out NGMRES. I am using options [1] from your tutorial
> slides. This works fine with SNES ex19, but fails with error [2] when I use
> my code. When I use my code with SNES options “-snes_type newtonls
> -snes_linesearch_type l2” it runs fine.
>
>
>
> Is this me doing something wrong in FormJacobian or what could this be? Is
> there a SNES example with MatSetValuesStencil I could try with NGMRES?
>

1) There should be more to the stack frame. I assume you call
MatSetValuesStencil(). Do you use PetscFunctionBegin/Return() in that
function? It would add to the stack

2) I am guessing that you are using a DMDA. There should be an ISL2G there
automatically. It does not make sense to me that its gone,
and ex19 works that way. The first thing to do to track it down is to get
the full stack. Then I think we probably need an example small
enough to run here to track through everything, unless you are good with
teh debugger.

  Thanks,

    Matt


> Thank you!
> Henrik
>
>
>
>
>
>
>
> [1]
>
>
>
> -snes_type ngmres -npc_snes_max_it 1 -snes_converged_reason -npc_snes_type
> fas -npc_fas_coarse_snes_converged_reason -npc_fas_levels_snes_type
> newtonls -npc_fas_levels_snes_max_it 6 -npc_fas_levels_snes_linesearch_type
> basic -npc_fas_levels_snes_max_linear_solve_fail 30
> -npc_fas_levels_ksp_max_it 20 -npc_fas_levels_snes_converged_reason
> -npc_fas_coarse_snes_linesearch_type basic
>
>
>
> [2]
>
>
>
> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
>
> [0]PETSC ERROR: Null argument, when expecting valid pointer
>
> [0]PETSC ERROR: Null Object: Parameter # 1
>
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
>
> [0]PETSC ERROR: Petsc Release Version 3.8.2, unknown
>
> [0]PETSC ERROR: /rwthfs/rz/cluster/work/hb111949/Descramble/1D_Model/
> steam/JUBE/ngmres/debug/shem_fw64gnu_steam.x on a arch-linux2-c-debug
> named linuxbmc0004.rz.RWTH-Aachen.DE by hb111949 Thu Nov 30 14:35:56 2017
>
> [0]PETSC ERROR: Configure options --download-fblaslapack --with-cc=mpicc
> --with-fc=mpif90 --with-cxx=mpicxx --download-hypre --download-superlu_dist
> --download-suitesparse --download-scalapack --download-blacs
> --download-hdf5 --download-parmetis --download-metis --with-debugging=1
> --download-mumps
>
> [0]PETSC ERROR: #1 ISLocalToGlobalMappingApply() line 639 in
> /rwthfs/rz/cluster/home/hb111949/Code/petsc/src/vec/is/utils/isltog.c
>
> [0]PETSC ERROR: #2 MatSetValuesLocal() line 2139 in
> /rwthfs/rz/cluster/home/hb111949/Code/petsc/src/mat/interface/matrix.c
>
> [0]PETSC ERROR: #3 MatSetValuesStencil() line 1550 in
> /rwthfs/rz/cluster/home/hb111949/Code/petsc/src/mat/interface/matrix.c
>
>
>
>
>
> --
>
> Dipl.-Math. Henrik Büsing
>
> Institute for Applied Geophysics and Geothermal Energy
>
> E.ON Energy Research Center
>
> RWTH Aachen University
>
> ------------------------------------------------------
>
> Mathieustr. 10
> <https://maps.google.com/?q=Mathieustr.+10&entry=gmail&source=g>
> |    Tel +49 (0)241 80 49907 <+49%20241%208049907>
>
> 52074 Aachen, Germany     |    Fax +49 (0)241 80 49889
> <+49%20241%208049889>
>
> ------------------------------------------------------
>
> http://www.eonerc.rwth-aachen.de/GGE
>
> hbuesing at eonerc.rwth-aachen.de
>
> ------------------------------------------------------
>
>
>
> *Von:* Matthew Knepley [mailto:knepley at gmail.com]
> *Gesendet:* 07 November 2017 12:54
> *An:* Buesing, Henrik <hbuesing at eonerc.rwth-aachen.de>
> *Cc:* petsc-users <petsc-users at mcs.anl.gov>
> *Betreff:* Re: [petsc-users] Newton methods that converge all the time
>
>
>
> On Tue, Nov 7, 2017 at 4:19 AM, Buesing, Henrik <
> hbuesing at eonerc.rwth-aachen.de> wrote:
>
> Dear all,
>
>
>
> I am solving a system of nonlinear, transient PDEs. I am using Newton’s
> method in every time step to solve the nonlinear algebraic equations. Of
> course, Newton’s method only converges if the initial guess is sufficiently
> close to the solution.
>
> This is often not the case and Newton’s method diverges. Then, I reduce
> the time step and try again. This can become prohibitively costly, if the
> time steps get very small. I am thus looking for variants of Newton’s
> method, which have a bigger convergence radius or ideally converge all the
> time.
>
>
>
> I tried out the pseudo-timestepping described in
> http://www.mcs.anl.gov/petsc/petsc-current/src/ts/examples/
> tutorials/ex1f.F.html.
>
>
>
> However, this does converge even worse. I am seeing breakdown when I have
> phase changes (e.g. liquid to two-phase).
>
>
>
> I was under the impression that pseudo-timestepping should converge
> better. Thus, my question:
>
> Am I doing something wrong or is it possible that Newton’s method
> converges and pseudo-timestepping does not?
>
> Thank you for any insight on this.
>
>
>
> Hi Hendrik,
>
>
>
> I would try using NGMRES as a nonlinear preconditioner. I have an example
> in my tutorial slides for using it with SNES ex19.
>
> I hope this will work because I suspect that around the phase boundary
> Newton directions are noisy, since sometimes you
>
> step into the other phase. NGMRES takes a few directions (you set the m)
> and then picks the best one.
>
>
>
>   Hopefully this helps,
>
>
>
>      Matt
>
>
>
> Henrik
>
>
>
>
>
> --
>
> Dipl.-Math. Henrik Büsing
>
> Institute for Applied Geophysics and Geothermal Energy
>
> E.ON Energy Research Center
>
> RWTH Aachen University
>
> ------------------------------------------------------
>
> Mathieustr. 10
> <https://maps.google.com/?q=Mathieustr.+10&entry=gmail&source=g>
> |    Tel +49 (0)241 80 49907 <+49%20241%208049907>
>
> 52074 Aachen, Germany     |    Fax +49 (0)241 80 49889
> <+49%20241%208049889>
>
> ------------------------------------------------------
>
> http://www.eonerc.rwth-aachen.de/GGE
>
> hbuesing at eonerc.rwth-aachen.de
>
> ------------------------------------------------------
>
>
>
>
>
>
>
> --
>
> 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
>
>
>
> https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
>



-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20171130/44d4846e/attachment-0001.html>


More information about the petsc-users mailing list