### problem in defining transpose of rank three tensors

51
views
0
8 weeks ago by
Hi All,

I am trying to solve a nonlinear elasticity problem but I have faced an error in defining the elasticity tensor that I should use transpose function.
I have tried to follow elasticity example here, step by step to define my elasticity tensor A(K) in term of displacement gradient.

\begin{equation*}
\mathsf{A}(K)\boldsymbol{:}\boldsymbol{M}= \mu (\boldsymbol{M}+\boldsymbol{M}^{T}) + (4\lambda\,\mathrm{tr}\, \boldsymbol{M}) \boldsymbol{I}.
\end{equation*}

That M is one of our Trial Functions, lambda and mio are constants and I is Identity.

here is part of my code:
from fenics import *

#Scaled variables

mio = 1

lda = 1

# Create mesh

mesh = UnitSquareMesh(2, 2)

# Define function spaces

CG = VectorElement("CG", mesh.ufl_cell(), 1, dim=2)

NED = VectorElement("N1curl", mesh.ufl_cell(), 1, dim=2)

RT = VectorElement("RT", mesh.ufl_cell(), 1, dim=2)

element = MixedElement([CG, NED, RT])

V = FunctionSpace(mesh, element)

w = Function(V)

#Define Trial and Test Functions

Y, M, Q = TrialFunctions(V)

yup, lamda, pii= TestFunctions(V)

#Define tensor gradient in bilinear form

def sigma(M):

return mio*(M + M . T) + (4*lda*tr(M))*Identity

​

The Error:

ufl.log.UFLException: Transposed is only defined for rank 2 tensors.​

So Is there any available transpose function for rank three tensors?

,

Ali.
Community: FEniCS Project
Add the complete code. A Minimum working example.
written 8 weeks ago by Miguel

Your M is from a vector function space, i.e., rank 1. It has to be from a tensor function space (rank 2), so you can transpose it.