### Error: Unable to define linear variational problem

158

views

0

Hi,

I'm currently learning FEniCS and tried to implement a very basic variant of the system I'm ultimately trying to solve.

I tried to follow the nonlinear-poisson demo to introduce nonlinearities into my system, but ran into the following problem:

*** Error: Unable to define linear variational problem a(u, v) == L(v) for all v.

*** Reason: Expecting the left-hand side to be a bilinear form (not rank 1).

*** Where: This error was encountered inside LinearVariationalProblem.cpp.

*** Process: 0

***

*** DOLFIN version: 2017.2.0

*** Git changeset: unknown

however, I can't see where that rank 1 is coming from, unless it comes from the linearization step.

What am I doing wrong?

Thanks for your help!

```
from dolfin import *
mesh = UnitIntervalMesh(20)
V = VectorFunctionSpace(mesh, "Lagrange", 1, 3)
p0 = Constant(1)
T0 = Constant(2)
w0 = Constant(3)
u0 = (p0, T0, w0)
def inlet_boundary(x, on_boundary):
return x[0] < DOLFIN_EPS
bc = DirichletBC(V,u0, inlet_boundary)
u = Function(V)
p,T,w = split(u)
v = TestFunction(V)
a_p = Dx(p,0)*T
a_T = Dx(T,0)
a_w = Dx(w,0)
L_p = Constant(1)
L_T = Constant(0)
L_w = Constant(0)
a = (a_p*v[0]+a_T*v[1]+a_w*v[2])*dx
L = (L_p*v[0]+L_T*v[1]+L_w*v[2])*dx
solve(a==L, u, bc, solver_parameters={"newton_solver":{"relative_tolerance":1e-6}})
```

Community: FEniCS Project

Please login to add an answer/comment or follow this question.

but the iteration immediately diverges, so there's more debugging to do.

That gets me one step further, at least, so now I can try to get the newton solver to converge.

Edit:Found the problem for the convergence: Initial guess of u_=0 is evil and should be avoided :D

Thanks again for your help!