Tensor determinant in nonlinear variational problem
Here's my code, which seeks to calculate the velocity which will produce a given second invariant of the strain rate tensor:
from dolfin import *
n = 6.
i,j = indices(2)
def eta(u):
# Calculate strain rate tensor
epsij = (u[i].dx(j) + u[j].dx(i))
#epsij = (Dx(u[i],j) + Dx(u[j],i))
eps = as_matrix(epsij, (i,j))
# Second invariant of 2x2 matrix is its determinant
#return det(eps)**((1-n)/n)
return det(eps)
m = UnitSquareMesh(
V = VectorFunctionS
P = FunctionSpace(
S0 = MixedFunctionSp
u_a = Function(S0)
v,p = split(u_a)
v_t, p_t = TestFunctions(S0)
F = eta(v)*p_t*dx
u = Function(S0)
solve(F == 0,u)
And here's what happens when I try to run it.
No Jacobian form specified for nonlinear variational problem.
Differentiating residual form F to obtain Jacobian J = F'.
All terms in form must have same rank.
Traceback (most recent call last):
File "StrainRateTest
solve(F == 0,u)
File "/usr/lib/
_solve_
File "/usr/lib/
form_
File "/usr/lib/
J = Form(J, form_compiler_
File "/usr/lib/
common_cell)
File "/usr/lib/
return local_jit(*args, **kwargs)
File "/usr/lib/
return jit_compile(form, parameters=p, common_
File "/usr/lib/
return jit_form(
File "/usr/lib/
element_
File "/usr/lib/
element_
File "/usr/lib/
ufl_
File "/usr/lib/
if not condition: error(*message)
File "/usr/lib/
raise self._exception
ufl.log.
1. Why does UFL see more than one term in the form?
2. What am I doing wrong?
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Stav Gold for more information if necessary.