Functionspace in 3D problem
7 months ago by
I work on a 3D elasticity project. I want to create a 3D functionnal space with V, but when the gradient of a function in this space seems to be a (3,2) dimension matrix, so I deduced the the function is a 2D vector. How the define a 3D functional space (it doesn't seems to work in my code ) ?
my code :
and the error message:
[...] V = VectorFunctionSpace(mesh,"P",1,dim=3) u_ = TestFunction(V) v = TrialFunction(V) u = Function(V, name="Deplacement") def eps(w): return sym(grad(w)) def sigma(w): return lmbda*tr(eps(w))*Identity(2) + 2*mu*eps(w) Wdef = inner(sigma(v), eps(u_))*dx Wext = dot (ps, u_)*ds(6)
Best Regards and thank you.
Cannot take symmetric part of rectangular matrix with dimensions (3, 2). Traceback (most recent call last): File "script_tube.py", line 58, in <module> Wdef = inner(sigma(v), eps(u_))*dx File "script_tube.py", line 55, in sigma return lmbda*tr(eps(w))*Identity(2) + 2*mu*eps(w) File "script_tube.py", line 52, in eps return sym(grad(w)) File "/usr/lib/python2.7/dist-packages/ufl/operators.py", line 294, in sym return Sym(A) File "/usr/lib/python2.7/dist-packages/ufl/tensoralgebra.py", line 466, in __new__ error("Cannot take symmetric part of rectangular matrix with dimensions %s." % (sh,)) File "/usr/lib/python2.7/dist-packages/ufl/log.py", line 172, in error raise self._exception_type(self._format_raw(*message)) ufl.log.UFLException: Cannot take symmetric part of rectangular matrix with dimensions (3, 2). Aborted (core dumped)
Community: FEniCS Project
7 months ago by
Identity(2)when you should be using
Identity(3). This won't fix the issue with
shape(grad(u_))though. On another note, have you double checked the geometric and topological dimensions of your mesh once it is loaded? E.g.
Please login to add an answer/comment or follow this question.