← Back to team overview

dolfin team mailing list archive

[Bug 492208] Re: Symmetric TensorFunctionSpace

 

Here is a simple test. It works fine without symmetry.

** Attachment added: "elasticity_mixed_formulation.py"
   http://launchpadlibrarian.net/36467446/elasticity_mixed_formulation.py

-- 
Symmetric TensorFunctionSpace
https://bugs.launchpad.net/bugs/492208
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.

Status in DOLFIN: Won't Fix

Bug description:
Dolfin ver. 0.9.2:

Creating of a function space with symmetric tensor fails.

Minimal example:
====
from dolfin import *
mesh = UnitSquare(3,3)
S = TensorFunctionSpace(mesh, "CG", 1, symmetry=True)
====

Workaround:
====
from dolfin import *
mesh = UnitSquare(3,3)
dim = 2
symmetry = dict( ((i,j), (j,i)) for i in range(dim) for j in range(dim) if i > j )
S = TensorFunctionSpace(mesh, "CG", 1, symmetry=symmetry)
====

The reason is that in dolfin/functionspace.py:297, TensorFunctionSpace.__init__ already sets the shape and then ufl/finiteelement.py, TensorElement.__init__ doesn't know how to handle the symmetry=Yes

Fix:
Deleting lines 296-299 in dolfin/functionspace.py:
====
        # Create subspaces
        if shape == None: 
            dim = mesh.topology().dim()
            shape = (dim,dim)
====

Another (additional) possibilty is, if TensorElement.__init__ would also handle symmetry=Yes for arbitrary quadratic shapes.





References