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> 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
Web:            https://uwaterloo.ca/poulin-research-group/
Telephone:  +1 519 888 4567 x32637