[petsc-users] -snes_fd for problems with residuals with non-continuous first derivative?

Barry Smith bsmith at mcs.anl.gov
Fri Jul 7 10:34:05 CDT 2017


  Send the output with the monitoring turned on -snes_monitor -snes_linesearch_monitor


> On Jul 7, 2017, at 4:54 AM, Maximilian Hartig <imilian.hartig at gmail.com> wrote:
> 
> If I set the function count higher it results in a diverged line search error. And if I reduce the absolute residual tolerance it continues for one or two more timesteps before it fails again.
> 
> Thanks,
> Max
> 
> 2017-07-05 20:24 GMT+02:00 Barry Smith <bsmith at mcs.anl.gov>:
> 
> >    39 SNES Function norm 3.758101652998e-08
> >       0 KSP preconditioned resid norm 1.931834799209e-02 true resid norm 3.758101652998e-08 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 5.958979968059e-16 true resid norm 2.588244438237e-18 ||r(i)||/||b|| 6.887105983875e-11
> 
>    The SNES function norm is pretty small here are you sure you need it smaller.
> 
> > Nonlinear solve did not converge due to DIVERGED_FUNCTION_COUNT i
> 
>    You should just set the function count to say 1 billion so it doesn't stop the solution process.
> 
> 
> 
> 
> > On Jul 5, 2017, at 11:24 AM, Maximilian Hartig <imilian.hartig at gmail.com> wrote:
> >
> > The solver goes on for some timesteps, then it gets hung up in step 10. The output is as follows:
> >
> >   28 SNES Function norm 7.825649542035e-06
> >       0 KSP preconditioned resid norm 5.335581451751e+00 true resid norm 7.825649542035e-06 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 3.875747966342e-13 true resid norm 3.082821236889e-15 ||r(i)||/||b|| 3.939380648635e-10
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >    29 SNES Function norm 7.825641650401e-06
> >       0 KSP preconditioned resid norm 5.335568660325e+00 true resid norm 7.825641650401e-06 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 1.169064646930e-13 true resid norm 2.949237553452e-15 ||r(i)||/||b|| 3.768684646199e-10
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >    30 SNES Function norm 7.825633758775e-06
> >       0 KSP preconditioned resid norm 5.335575714181e+00 true resid norm 7.825633758775e-06 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 3.626528075820e-13 true resid norm 7.454935467844e-16 ||r(i)||/||b|| 9.526302530432e-11
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >    31 SNES Function norm 7.825625867144e-06
> >       0 KSP preconditioned resid norm 5.335574289757e+00 true resid norm 7.825625867144e-06 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 1.220021201426e-13 true resid norm 6.140701297052e-16 ||r(i)||/||b|| 7.846913973787e-11
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >    32 SNES Function norm 7.825617975525e-06
> >       0 KSP preconditioned resid norm 5.335556211708e+00 true resid norm 7.825617975525e-06 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 3.238615954344e-14 true resid norm 1.639170816829e-15 ||r(i)||/||b|| 2.094621564655e-10
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >    33 SNES Function norm 7.825610083913e-06
> >       0 KSP preconditioned resid norm 5.335545135100e+00 true resid norm 7.825610083913e-06 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 8.328043430360e-14 true resid norm 7.902728010647e-16 ||r(i)||/||b|| 1.009854557780e-10
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >    34 SNES Function norm 7.825609294752e-06
> >       0 KSP preconditioned resid norm 5.335519330054e+00 true resid norm 7.825609294752e-06 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 1.176339150741e-13 true resid norm 2.137240765649e-15 ||r(i)||/||b|| 2.731085446703e-10
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >    35 SNES Function norm 7.825608505592e-06
> >       0 KSP preconditioned resid norm 5.335552250936e+00 true resid norm 7.825608505592e-06 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 2.388837462586e-13 true resid norm 3.899327292367e-16 ||r(i)||/||b|| 4.982778386601e-11
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >    36 SNES Function norm 7.825607716432e-06
> >       0 KSP preconditioned resid norm 1.017554264638e-01 true resid norm 7.825607716432e-06 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 2.758703070887e-14 true resid norm 1.990491888342e-16 ||r(i)||/||b|| 2.543562059932e-11
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >    37 SNES Function norm 3.815837655573e-08
> >       0 KSP preconditioned resid norm 7.197730150406e+00 true resid norm 3.815837655573e-08 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 7.114599045039e-12 true resid norm 4.763264085142e-16 ||r(i)||/||b|| 1.248287929175e-08
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >    38 SNES Function norm 3.790245121284e-08
> >       0 KSP preconditioned resid norm 7.127517791828e+00 true resid norm 3.790245121284e-08 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 2.500976336448e-11 true resid norm 1.692661771456e-15 ||r(i)||/||b|| 4.465837214461e-08
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >    39 SNES Function norm 3.758101652998e-08
> >       0 KSP preconditioned resid norm 1.931834799209e-02 true resid norm 3.758101652998e-08 ||r(i)||/||b|| 1.000000000000e+00
> >       1 KSP preconditioned resid norm 5.958979968059e-16 true resid norm 2.588244438237e-18 ||r(i)||/||b|| 6.887105983875e-11
> >     Linear solve converged due to CONVERGED_RTOL iterations 1
> >   Nonlinear solve did not converge due to DIVERGED_FUNCTION_COUNT iterations 39
> > [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
> > [0]PETSC ERROR:
> > [0]PETSC ERROR: TSStep has failed due to DIVERGED_NONLINEAR_SOLVE, increase -ts_max_snes_failures or make negative to attempt recovery
> > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
> > [0]PETSC ERROR: Petsc Development GIT revision: v3.7.5-3342-gb122798  GIT Date: 2017-03-22 17:42:51 -0500
> > [0]PETSC ERROR: ./miniFEM on a arch-linux2-c-debug named iket127138 by hartig Wed Jul  5 18:09:53 2017
> > [0]PETSC ERROR: Configure options PETSC_ARCH=arch-linux2-c-debug --with-cc=mpigcc --with-cxx=mpicxx --with-fc=mpif90 --download-ml --download-parmetis --download-metis --download-hypre --download-mumps --download-scalapack
> > [0]PETSC ERROR: #1 TSStep() line 3818 in /home/hartig/petsc/src/ts/interface/ts.c
> > [0]PETSC ERROR: #2 TSSolve() line 4054 in /home/hartig/petsc/src/ts/interface/ts.c
> > [0]PETSC ERROR: #3 main() line 1829 in /home/hartig/Nextcloud/Dissertation/Code/Debugging/miniFEM.c
> > [0]PETSC ERROR: PETSc Option Table entries:
> > [0]PETSC ERROR: -def_petscspace_order 2
> > [0]PETSC ERROR: -eplast_petscspace_order 2
> > [0]PETSC ERROR: -ksp_converged_reason
> > [0]PETSC ERROR: -ksp_monitor_true_residual
> > [0]PETSC ERROR: -pc_type lu
> > [0]PETSC ERROR: -plast
> > [0]PETSC ERROR: -snes_converged_reason
> > [0]PETSC ERROR: -snes_fd
> > [0]PETSC ERROR: -snes_monitor
> > [0]PETSC ERROR: -snes_type newtonls
> > [0]PETSC ERROR: -ts_monitor
> > [0]PETSC ERROR: -vel_petscspace_order 2
> > [0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint at mcs.anl.gov----------
> >
> >
> > Thanks,
> > Max
> >
> >
> > 2017-06-30 17:14 GMT+02:00 Barry Smith <bsmith at mcs.anl.gov>:
> >
> >    What is the output from
> >
> >     -snes_monitor -ksp_monitor_true_residual -pc_type lu -ksp_converged_reason -snes_converged_reason
> >
> >
> > > On Jun 30, 2017, at 3:45 AM, Maximilian Hartig <imilian.hartig at gmail.com> wrote:
> > >
> > > Hello,
> > >
> > > I’m trying to implement plasticity and have problems getting the Petsc SNES to converge. To check if my residual formulation is correct I tried running with -snes_fd for an easy example as the Petsc FAQ suggest. I cannot seem to get the solver to converge at any cost.
> > > I already tried to impose bounds on the solution and moved to vinewtonrsls as a nonlinear solver. I checked and rechecked my residuals but I do not find an error there. I now have the suspicion that the -snes_fd option is not made for handling residuals who’s first derivatives are not continuous (e.g. have an “if” condition in them for the plasticity/ flow-condition). Can you confirm my suspicion? And is there another way to test my residual formulation separate from my hand-coded jacobian?
> > >
> > >
> > > Thanks,
> > > Max
> >
> >
> 
> 



More information about the petsc-users mailing list