Re: [firedrake] problem solving a linear system
This section of the documentation might help: http://www.firedrakeproject.org/solving-interface.html#debugging-convergence... On 21 June 2017 at 15:40, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
Hello,
We are trying to solve a 2-layer Quasi-Geostrophic model to determine a steady linear solution, basically building on a demo that we already wrote.
When we try running it we get the following error, copied below.
It seems to have a problem with the nonlinear solver, even though we are solving a linear problem. Can anyone give us some advice on how we might be able to fix this?
Code is attached in case you wanted to see the details.
Cheers, Francis
(firedrake) fpoulin@domlt32:~/Dropbox/Research_Keegan/Code$ python test.py Traceback (most recent call last): File "test.py", line 91, in <module> soln0 = steadylinearQG2d(Ztrial, Ztest, Gwinds, bcs) File "test.py", line 46, in steadylinearQG2d linear_solver.solve() File "/home/fpoulin/software/firedrake/src/firedrake/ firedrake/variational_solver.py", line 223, in solve solving_utils.check_snes_convergence(self.snes) File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/solving_utils.py", line 233, in check_snes_convergence %s""" % (snes.getIterationNumber(), msg)) firedrake.exceptions.ConvergenceError: Nonlinear solve failed to converge after 0 nonlinear iterations. Reason: Inner linear solve failed to converge after 0 iterations with reason: unknown reason (petsc4py enum incomplete?), try with -snes_converged_reason and -ksp_converged_reason
------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo
email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 <(519)%20888-4567>
Thank you Andrew. We will look at that closely. But if we are solving a linear system using LU then we shouldn't be using snes though should we? That is the error we are getting in convergence. ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Andrew McRae <A.T.T.McRae@bath.ac.uk> Sent: Wednesday, June 21, 2017 10:47:53 AM To: firedrake@imperial.ac.uk Cc: Keegan Cove Subject: Re: [firedrake] problem solving a linear system This section of the documentation might help: http://www.firedrakeproject.org/solving-interface.html#debugging-convergence... On 21 June 2017 at 15:40, Francis Poulin <fpoulin@uwaterloo.ca<mailto:fpoulin@uwaterloo.ca>> wrote: Hello, We are trying to solve a 2-layer Quasi-Geostrophic model to determine a steady linear solution, basically building on a demo that we already wrote. When we try running it we get the following error, copied below. It seems to have a problem with the nonlinear solver, even though we are solving a linear problem. Can anyone give us some advice on how we might be able to fix this? Code is attached in case you wanted to see the details. Cheers, Francis (firedrake) fpoulin@domlt32:~/Dropbox/Research_Keegan/Code$ python test.py Traceback (most recent call last): File "test.py", line 91, in <module> soln0 = steadylinearQG2d(Ztrial, Ztest, Gwinds, bcs) File "test.py", line 46, in steadylinearQG2d linear_solver.solve() File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/variational_solver.py", line 223, in solve solving_utils.check_snes_convergence(self.snes) File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/solving_utils.py", line 233, in check_snes_convergence %s""" % (snes.getIterationNumber(), msg)) firedrake.exceptions.ConvergenceError: Nonlinear solve failed to converge after 0 nonlinear iterations. Reason: Inner linear solve failed to converge after 0 iterations with reason: unknown reason (petsc4py enum incomplete?), try with -snes_converged_reason and -ksp_converged_reason ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca<mailto:fpoulin@uwaterloo.ca> Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637<tel:(519)%20888-4567>
On 21/06/17 15:58, Francis Poulin wrote:
Thank you Andrew. We will look at that closely.
But if we are solving a linear system using LU then we shouldn't be using snes though should we? That is the error we are getting in convergence.
We always use SNES, but for linear problems it is set to ksponly (so it's equivalent to just using KSP). That error looks like potentially you had a zero pivot in the LU factorisation? What does running the solve with: "ksp_converged_reason": True, "snes_converged_reason": True, (in addition to your other parameters) say? Lawrence
Thanks for the suggestion. I tried those two and obtained the following. It suggests that I try snes_converged_reason but I think I did. Maybe I'm not specifying the parameters correctly? Any ideas what else I can try? Cheers, Francis Saving file at /QG2L-Stommel-psi-u-q.ipynb Linear firedrake_0_ solve did not converge due to DIVERGED_PCSETUP_FAILED iterations 0 PCSETUP_FAILED due to FACTOR_NUMERIC_ZEROPIVOT Nonlinear firedrake_0_ solve did not converge due to DIVERGED_LINEAR_SOLVE iterations 0 Traceback (most recent call last): File "test.py", line 93, in <module> soln0 = steadylinearQG2d(Ztrial, Ztest, Gwinds, bcs) File "test.py", line 48, in steadylinearQG2d linear_solver.solve() File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/variational_solver.py", line 223, in solve solving_utils.check_snes_convergence(self.snes) File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/solving_utils.py", line 233, in check_snes_convergence %s""" % (snes.getIterationNumber(), msg)) firedrake.exceptions.ConvergenceError: Nonlinear solve failed to converge after 0 nonlinear iterations. Reason: Inner linear solve failed to converge after 0 iterations with reason: unknown reason (petsc4py enum incomplete?), try with -snes_converged_reason and -ksp_converged_reason ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> Sent: Wednesday, June 21, 2017 11:01:49 AM To: firedrake@imperial.ac.uk Subject: Re: [firedrake] problem solving a linear system On 21/06/17 15:58, Francis Poulin wrote:
Thank you Andrew. We will look at that closely.
But if we are solving a linear system using LU then we shouldn't be using snes though should we? That is the error we are getting in convergence.
We always use SNES, but for linear problems it is set to ksponly (so it's equivalent to just using KSP). That error looks like potentially you had a zero pivot in the LU factorisation? What does running the solve with: "ksp_converged_reason": True, "snes_converged_reason": True, (in addition to your other parameters) say? Lawrence _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
On 21/06/17 17:00, Francis Poulin wrote:
Saving file at /QG2L-Stommel-psi-u-q.ipynb Linear firedrake_0_ solve did not converge due to DIVERGED_PCSETUP_FAILED iterations 0 PCSETUP_FAILED due to FACTOR_NUMERIC_ZEROPIVOT
This is your problem. You have a 0 on the diagonal of your operator. If you are sure it is non-singular, try adding: "pc_factor_mat_solver_package": "mumps" to your solver options. Lawrence
Thank you Lawrence. The 1-layer case is non-singular so the 2-layer should also be non-singular, I would think. I made the change you suggested and that seemed to help a lot. Now I need to understand the solution. Cheers, Francis ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> Sent: Wednesday, June 21, 2017 12:54:53 PM To: firedrake@imperial.ac.uk Subject: Re: [firedrake] problem solving a linear system On 21/06/17 17:00, Francis Poulin wrote:
Saving file at /QG2L-Stommel-psi-u-q.ipynb Linear firedrake_0_ solve did not converge due to DIVERGED_PCSETUP_FAILED iterations 0 PCSETUP_FAILED due to FACTOR_NUMERIC_ZEROPIVOT
This is your problem. You have a 0 on the diagonal of your operator. If you are sure it is non-singular, try adding: "pc_factor_mat_solver_package": "mumps" to your solver options. Lawrence _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
participants (3)
- 
                
                Andrew McRae
- 
                
                Francis Poulin
- 
                
                Lawrence Mitchell