Hi, everyone!
I’ve been working with FEniCS for some time, and I’m trying to implement a modified version of the IPCS scheme, related to the Navier-Stokes equations, to a continuum model for active nematics.
Having said that, my problem is the following, I’ve a dynamical equation for a symmetric and traceless 2x2 tensor. But when I use the method SOLVE I get the following error:
solve(): incompatible function arguments. The following argument types are supported:
1. (A: dolfin.cpp.la.GenericLinearOperator, x: dolfin.cpp.la.GenericVector, b: dolfin.cpp.la.GenericVector, method: str = ‘lu’, preconditioner: str = ‘none’) → int
Invoked with: <dolfin.cpp.la.Matrix object at 0x7f487ba38f90>, Coefficient(FunctionSpace(Mesh(VectorElement(FiniteElement(‘Lagrange’, triangle, 1), dim=2), 7), TensorElement(FiniteElement(‘Lagrange’, triangle, 2), shape=(2, 2), symmetry={(1, 0): (0, 1)})), 17), <dolfin.cpp.la.Vector object at 0x7f487ad19a90>, ‘bicgstab’, ‘hypre_amg’
Here I provide some parts of my code:
Vector = VectorElement(‘Lagrange’, mesh.ufl_cell(), 2);
T = TensorFunctionSpace(mesh, ‘Lagrange’, 2, symmetry = True);
V = FunctionSpace(mesh, Vector)
#—Define strain rate tensor symmetric gradient
def epsilon(u):
return sym(nabla_grad(u))
#—Define vorticity tensor
def omega(u):
return skew(nabla_grad(u))
#—Define L_ij tensor
def L(epsilon, omega):
L1 = 1./3 * (dot(lamb * epsilon + omega, Identity(len(u))))
L2 = 1./3 * (dot(Identity(len(u)), lamb * epsilon + omega))
return L1 + L2
#—Define N_ij tensor
def N(epsilon, omega, Q):
N1 = dot(lamb * epsilon + omega, Q)
N2 = 1/3. *dot(lamb * epsilon - omega, Q)
N3 = -2/3. * inner(Q, nabla_grad(u)) * lamb * (Q + Identity(len(u)))
return N1 + N2 #+ N3
#—Define variational problem for step 1
F1 = inner((Q - Q_n) / k, psi)*dx + inner(dot(u_n, nabla_grad(Q_n)), psi)*dx \
- inner(nabla_grad(Q_n), nabla_grad(psi))*dx \
- inner(L(epsilon(u_n), omega(u_n)), psi)*dx \
- inner(N(epsilon(u_n), omega(u_n), Q_n), psi)*dx
a1 = lhs(F1)
L1 = rhs(F1)
A1 = assemble(a1)
Time-stepping
t = 0
for n in range(ns):
# Update current time
t += dt
# Step 1: Tentative velocity step
b1 = assemble(L1)
solve(A1, Q_, b1, 'bicgstab', 'hypre_amg')
Hope you can help me.
Thanks!