problem in defining transpose of rank three tensors

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.

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

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?


Thank you in advance.
Community: FEniCS Project
Add the complete code. A Minimum working example.
written 8 weeks ago by Miguel  

1 Answer

8 weeks ago by
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.
Please login to add an answer/comment or follow this question.

Similar posts:
Search »