Hello all,
I am trying to solve the following problem:
PDE: Laplacian(u) + grad(div u) = f subject to Homogeneous Dirichlet boundary condition for u over the domain given by a unit square.
Code:
from __future__ import print_function
from fenics import *
from dolfin import *
import numpy as np
mesh = UnitSquareMesh(101,101)
V= FunctionSpace(mesh, 'P', 1)
def boundaryX0(x):
return x[0] <DOLFIN_EPS and x[0]> 1.0-DOLFIN_EPS and x[1]<DOLFIN_EPS and x[1]> 1-DOLFIN_EPS
u0= Constant(0.0)
bc= DirichletBC(V, u0, boundaryX0)
f= Constant(1.0)
v=TestFunction(V)
u= TrialFunction(V)
a= inner(curl(u), curl(v))*dx - dot(grad(u),grad(v))*dx - dot(grad(u),grad(v))*dx
L=-inner(f,div(v))*dx
u=Function(V)
solve(a==L,u,bc)
I am getting the following error:
Calling FFC just-in-time (JIT) compiler, this may take some time.
Component and shape length don't match.
Traceback (most recent call last):
RuntimeError:
*** -------------------------------------------------------------------------
*** Error: Unable to perform just-in-time compilation of form.
*** Reason: ffc.jit failed with message:
UFLException: Component and shape length don't match.
.
*** Where: This error was encountered inside jit.py.
*** Process: 0
*** DOLFIN version: 2016.2.0
*** Git changeset: unknown
*** -------------------------------------------------------------------------
Please help me out in finding the problem.
Thank you.
Ratnesh