Dear all, I am trying to solve a simple problem (linear water wave equations), where I have the Laplace equation in a square domain with Neumann boundary conditions on the three sides and on the top boundary two equations are satisfied. I have the following code: -------------------------------------- V = FunctionSpace(mesh,"CG",1) eta0 = Function(V).interpolate(Expression("cos(2*pi*x[0])")) phi0 = Function(V) eta1 = Function(V) phi1 = Function(V) eta = TrialFunction(V) phi = TrialFunction(V) v = TestFunction(V) aeta = v*eta*ds(4) Leta = v*eta0*ds(4) + dt*inner(grad(v),grad(phi0))*dx eta_problem = LinearVariationalProblem(aeta,Leta,eta1) eta_solver = LinearVariationalSolver(eta_problem) aphi = v*phi*ds(4) Lphi = (v*phi0 - g*dt*v*eta1)*ds(4) phi_problem = LinearVariationalProblem(aphi,Lphi,phi1) phi_solver = LinearVariationalSolver(phi_problem) -------------------------------------- The error I get tells me that Object is in wrong state, and Matrix is missing diagonal entry 39. I thought this had to do with the problem being singular, so I tried to build the nullspace but I don't know how to define the VectorSpaceBasis. Any help would be appreciated. Thank you very much. Regards, Anna.