Hello,
How can I perform the inner product of the strain field with a fourth order tensor?
from dolfin import *
import numpy
mesh = Mesh('mesh.xml')
# Define Space
V = FunctionSpace(mesh, 'CG', 1)
W = VectorFunctionSpace(mesh, 'CG', 1)
WW = FunctionSpace(mesh, 'DG', 0)
p, q = TrialFunction(V), TestFunction(V)
u, v = TrialFunction(W), TestFunction(W)
xi2 = numpy.array([[1,0,0], [0,1,0], [0,0,1]])
ns = numpy.array([2**(-1/2),2**(-1/2),0])
ndn = numpy.zeros((3,3))
n4 = numpy.zeros((3,3,3,3))
def epsilon(u):
return sym(grad(u))
for i in range(2):
for j in range(2):
ndn[i,j] = ns[i]*ns[j]
for i1 in range(0,2):
for i2 in range(0,2):
for i3 in range(0,2):
for i4 in range(0,2):
n4[i1,i2,i3,i4] = ndn[i1,i3]*xi2[i2,i4] + ndn[i1,i4]*xi2[i2,i3] + ndn[i2,i4]*xi2[i1,i3] + ndn[i2,i3]*xi2[i1,i4]
prod = inner(n4,epsilon(u))