This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

issue with curl operator

–4 votes

Hello All,

I am facing issue while solving below weak form which involve curl curl function and grad function.
I am getting the below error. Please let me know what I should do to fix it:

*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
*** -------------------------------------------------------------------------*

Thank you,

Ratnesh

asked Mar 2, 2017 by ratnesh FEniCS Novice (190 points)

Please include a complete minimal example that reproduces the problem.

sorry about that. please give me some time. I will upload the example shortly.

Thanks

I am trying to solve the following problem:

Assume a unit square.

PDE: Laplacian(u) + grad(div u) = f subject to Homogeneous Dirichlet boundary condition for u over the domain given by a unit square.

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)
...