[petsc-users] Issue with SNES Solver in Fortran - Converging with Zero Residual
Khaled Nabil Shar Abdelaziz
kabdelaz at purdue.edu
Fri Apr 14 11:39:43 CDT 2023
Hello,
I hope you are well. I am currently working with the SNES solver in Fortran, utilizing Newton's method. I have provided both the residual function and the Jacobian. However, I have encountered an issue that I hope you can help me with.
In the first non-linear iteration, the solver calculates a non-zero residual value and starts the KSP solver to minimize the error. However, in the second non-linear iteration, it returns an exact zero residual, considering it converged.
As a result, the first few steps provide a somewhat accurate solution, but after around 15 steps, the solution starts diverging rapidly. I assume this is due to accumulating errors, as the residual in subsequent steps becomes increasingly larger.
Here are some outputs from the solver:
start_SNES_petsc_solver: var_nd%name=u
0 SNES Function norm 3.412918650183e+01
Attempt!
0 KSP Residual norm 5.861642176595e-01
1 KSP Residual norm 1.411858179645e-01
2 KSP Residual norm 1.388288156571e-01
3 KSP Residual norm 4.900215159087e-02
4 KSP Residual norm 2.559630070894e-02
5 KSP Residual norm 1.007110997387e-02
6 KSP Residual norm 6.371175598940e-03
1 SNES Function norm 0.000000000000e+00
iteration= 1
SNESConvergedReason= 2
istep= 1
******************************
start_SNES_petsc_solver: var_nd%name=u
0 SNES Function norm 6.831896456736e+01
Attempt!
0 KSP Residual norm 5.850729730568e+00
1 KSP Residual norm 5.176135972454e+00
2 KSP Residual norm 5.106059774079e-01
3 KSP Residual norm 2.058573608172e-01
4 KSP Residual norm 8.430267458444e-02
5 KSP Residual norm 2.421049820170e-02
6 KSP Residual norm 1.387479046692e-02
7 KSP Residual norm 6.556624109622e-03
1 SNES Function norm 0.000000000000e+00
iteration= 1
SNESConvergedReason= 2
istep= 2
******************************
start_SNES_petsc_solver: var_nd%name=u
0 SNES Function norm 1.024330722398e+02
Attempt!
0 KSP Residual norm 1.324263482159e+01
1 KSP Residual norm 8.772774639367e+00
2 KSP Residual norm 8.717824082000e-01
3 KSP Residual norm 3.965086318719e-01
4 KSP Residual norm 1.380063519887e-01
5 KSP Residual norm 3.983781619335e-02
6 KSP Residual norm 1.690524902818e-02
7 KSP Residual norm 1.371656480592e-02
8 KSP Residual norm 4.598826535286e-03
1 SNES Function norm 0.000000000000e+00
iteration= 1
SNESConvergedReason= 2
istep= 3
******************************
start_SNES_petsc_solver: var_nd%name=u
0 SNES Function norm 1.371337889713e+02
Attempt!
0 KSP Residual norm 1.823603533770e+01
1 KSP Residual norm 1.823546028484e+01
2 KSP Residual norm 8.167385988622e-01
3 KSP Residual norm 1.930526020067e-01
4 KSP Residual norm 1.768873013055e-01
5 KSP Residual norm 2.692456250466e-02
6 KSP Residual norm 1.130530545617e-02
7 KSP Residual norm 6.934825615412e-03
1 SNES Function norm 0.000000000000e+00
iteration= 1
SNESConvergedReason= 2
istep= 4
******************************
start_SNES_petsc_solver: var_nd%name=u
0 SNES Function norm 1.717647834464e+02
Attempt!
0 KSP Residual norm 1.015846744437e+02
1 KSP Residual norm 7.622793741160e+00
2 KSP Residual norm 1.381803723895e+00
3 KSP Residual norm 1.305423467184e-01
4 KSP Residual norm 3.606398975875e-02
5 KSP Residual norm 3.463999556864e-02
6 KSP Residual norm 3.268229989659e-02
7 KSP Residual norm 8.847393497789e-03
1 SNES Function norm 0.000000000000e+00
iteration= 1
SNESConvergedReason= 2
Do you have any idea what might be causing this behavior? I appreciate any insights you might have.
Best,
Khaled
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230414/90c47500/attachment-0001.html>
More information about the petsc-users
mailing list