Hello Andrew, Thanks for pointing that out. I have looked at the Burger equation demo more and think I understand it better. If you go to the following link you will see that there is a revised version of the code. Now I solve the linear problem first, since that should be used as an initial guess. Then I want to solve the Nonlinear Variational Problem. https://github.com/francispoulin/firedrakeQG/blob/master/fofonoff_qg.py Unfortunately, I haven't figured out how to get the syntax correct. I'm only using a Function, with the guess an the variable to determine, and a Test Function. Any advice would be greatly appreciated. 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 Andrew McRae [A.T.T.McRae@bath.ac.uk] Sent: Friday, December 09, 2016 4:49 PM To: Firedrake Project Subject: Re: [firedrake] Problems with NonlinearVariationalProblem Hi Francis, The residual should be linear in the Test Function, and TrialFunctions should not appear at all (a Function should be used instead). Best, Andrew On 9 Dec 2016 8:58 p.m., "Francis Poulin" <fpoulin@uwaterloo.ca<mailto:fpoulin@uwaterloo.ca>> wrote: Hello, We have been following the documentation and examples to learn how to solve nonlinear problems in Firedrake. We want to solve the classical Fofonoff problem in a one-layer Quasi-Geostrophic problem. We have set up a nonlinear variational problem, following the Camassa-Holm demo. Unfortunately, whenever we try it we get an error saying that our for is not a linear form. Which is true, but since we are using NonlinearVariationalProblem, I presume this should be ok. Traceback (most recent call last): File "fofonoff_qg.py", line 41, in <module> psi_problem = NonlinearVariationalProblem(L, psi_soln, bcs=bc) File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/variational_solver.py", line 47, in __init__ raise ValueError("Provided residual is not a linear form") ValueError: Provided residual is not a linear form Our code can be found on github. https://github.com/francispoulin/firedrakeQG/blob/master/fofonoff_qg.py If anyone has any advice or other examples that do this successfully, we would love to know more. Cheers, Francis ------------------ 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>