Hello Firedrakers,

Thanks everyone for a very interesting Workshop.  It was great to meet everyone that was able to attend and learn about all the diverse range of problems people are working on. 

I have a question to follow up on discussions from the workshop.  I am not sure if this quite of question is appropriate for Slack so I thought I would send an email.  If you prefer Slack I will happily go there next time.

On Wednesday morning David pointed out that my nonlinear solver for the Quasi-Geostrophic model has a problem in that I computed the Laplacian of a field, which is one too many derivatives.  I now know that's bad and think this could really fix up my convergence issues.  Thanks David!

I rewrote the problem in terms of a velocity, a vorticity and a streamfunction and coded it up.  There are three fields instead of one so it is bigger but at least I don't get any double derivatives.  I am pretty sure that the linear part is correct since the solution looks identical to what I had before.  Unfortunately, after spending a lot of time on the nonlinear problem, I can't seem to get the syntax right.    Even when I try a much simpler nonlinear term it still gives me the same error.   The version that I have now can be found at the following link:

https://github.com/francispoulin/firedrakeQG/blob/master/QG1L_Stommel_psiuq.py

The error can be found below.

I tried putting a Constant(0)* in front of the nonlinear term, like I think Lawrence showed me how to do, but I seemed to get the syntax wrong on that as well. The fact that Linear and Nonlinear firedrake fail to converge means that it's not even trying because I messed up something.  Any advice on how I can fix up my syntax?

Cheers, Francis


$ python QG1L_Stommel_psiuq.py
  Linear firedrake_1_ solve did not converge due to DIVERGED_PCSETUP_FAILED iterations 0
                 PCSETUP_FAILED due to FACTOR_NUMERIC_ZEROPIVOT
Nonlinear firedrake_1_ solve did not converge due to DIVERGED_LINEAR_SOLVE iterations 0
Traceback (most recent call last):
  File "QG1L_Stommel_psiuq.py", line 114, in <module>
    nonlinear_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 160, 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_convered_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