[petsc-users] infinite loop with NEWTONTR?
Barry Smith
bsmith at mcs.anl.gov
Sun Apr 27 23:34:21 CDT 2014
I have run your code. I changed to use -snes_type newtonls and also -snes_mf_operator there is something wrong with your Jacobian:
Without -snes_mf_operator
0 SNES Function norm 1.821611413735e+03
0 KSP Residual norm 1821.61
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
1 KSP Residual norm 0.000167024
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
2 KSP Residual norm 7.66595e-06
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
3 KSP Residual norm 4.4581e-07
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
4 KSP Residual norm 3.77537e-08
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
5 KSP Residual norm 2.20453e-09
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
6 KSP Residual norm 1.711e-10
Linear solve converged due to CONVERGED_RTOL iterations 6
with -snes_mf_operator
0 SNES Function norm 1.821611413735e+03
0 KSP Residual norm 1821.61
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
1 KSP Residual norm 1796.39
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
2 KSP Residual norm 1786.2
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
3 KSP Residual norm 1741.11
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
4 KSP Residual norm 1733.92
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
5 KSP Residual norm 1726.57
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
6 KSP Residual norm 1725.35
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
7 KSP Residual norm 1723.89
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
8 KSP Residual norm 1715.41
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
9 KSP Residual norm 1713.72
Linear solve converged due to CONVERGED_ITS iterations 1
Linear solve converged due to CONVERGED_RTOL iterations 1
10 KSP Residual norm 1702.84
Linear solve converged due to CONVERGED_ITS iterations 1
…
This means your Jacobian is wrong. Your first order of business is to fix your Jacobian. I noticed in previous emails your discussion with Jed about switching to MatGetLocalSubMatrix() and using -snes_type test YOU NEED TO DO THIS. You will get no where with an incorrect Jacobian. You need to fix your Jacobian before you do anything else! No amount of other options or methods will help you with a wrong Jacobian! Once you have a correct Jacobian if you still have convergence problems let us know and we can make further suggestions.
Barry
On Apr 25, 2014, at 7:31 AM, Norihiro Watanabe <norihiro.w at gmail.com> wrote:
> Hi,
>
> In my simulation, nonlinear solve with the trust regtion method got stagnent after linear solve (see output below). Is it possible that the method goes to inifite loop? Is there any parameter to avoid this situation?
>
> 0 SNES Function norm 1.828728087153e+03
> 0 KSP Residual norm 91.2735
> Linear solve converged due to CONVERGED_ITS iterations 1
> Linear solve converged due to CONVERGED_RTOL iterations 3
> 1 KSP Residual norm 3.42223
> Linear solve converged due to CONVERGED_STEP_LENGTH iterations 1
>
>
> Thank you in advance,
> Nori
More information about the petsc-users
mailing list