All terms in form must have same rank
I have just started implementing nonlinear incompressible elasticity (neo-hookean material). In my simple problem there is a unit cube which is fixed at x=0; a traction force is applied at x=1 (ForceBoundary). I cannot understand what is wrong with the following code:
from dolfin import *
mesh = UnitCube(5,5,5)
V = VectorFunctionS
Q = FunctionSpace(
W = V*Q
mu = 4E5
(u,p) = TrialFunctions(W)
(v,q) = TestFunctions(W)
t = Constant(
I = Identity(3)
F = variable(I + grad(u))
J = variable(det(F))
S = variable(
boundary_parts = \
MeshFunction(
class ForceBoundary(
def inside(self, x, on_boundary):
tol = 1E-14 # tolerance for coordinate comparisons
return on_boundary and abs(x[0]-1) < tol
Gamma_0 = ForceBoundary()
Gamma_0.
a = inner(S,
def left_boundary(x, on_boundary):
return on_boundary and abs(x[0]) < DOLFIN_EPS
bc = DirichletBC(V, Constant(
w = Function(W)
problem = NonlinearVariat
solver = NonlinearVariat
set_log_
solver.solve()
I get this output:
Calling FFC just-in-time (JIT) compiler, this may take some time.
All terms in form must have same rank.
Traceback (most recent call last):
File "/Users/
problem = NonlinearVariat
File "/Applications/
F = Form(F, form_compiler_
File "/Applications/
common_cell)
File "/Applications/
return local_jit(*args, **kwargs)
File "/Applications/
return jit_compile(form, parameters=p, common_
File "/Applications/
return jit_form(
File "/Applications/
common_
File "/Applications/
analysis = analyze_
File "/Applications/
common_cell) for form in forms)
File "/Applications/
common_cell) for form in forms)
File "/Applications/
"All terms in form must have same rank.")
File "/Applications/
condition or error(*message)
File "<string>", line 1, in <lambda>
File "/Applications/
raise self._exception
Exception: All terms in form must have same rank.
Can you help me, please?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Anders Logg
- Solved:
- Last query:
- Last reply: