Hi,
I am trying to solve a nonlinear problem by imposing dirichlet boundary conditions. I got the error:
"Vector dimension (4 rows) does not match vector dimension (2) for application of boundary conditions."
Here you can find some important part of my code:
mesh = IntervalMesh(1,0,10)
A = FunctionSpace(mesh, "CG", 1)
Q = FunctionSpace(mesh, "CG", 1)
W = MixedFunctionSpace([A, Q])
def left (x, on_boundary):
tol = 1e-14
return on_boundary and abs(x [0]) < tol
bc_1 = DirichletBC(W.sub(1), Constant((100.0)), left)
bcs = [bc_1]
...
w = Function(W)
(a, q) = (w[0], w[1])
v = TestFunction(A)
F_nonlinear_1 = inner(grad(v)[0], q)dx
F_nonlinear_2 = inner (q, v)ds
F = F_nonlinear_1 + F_nonlinear_2
J = derivative(F, w)
...
problem = NonlinearVariationalProblem(F, w, bcs, J)
solver = NonlinearVariationalSolver(problem)
solver.solve()