← Back to team overview

dolfin team mailing list archive

[Bug 492208] [NEW] Symmetric TensorFunctionSpace

 

Public bug reported:

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.

** Affects: dolfin
     Importance: Undecided
         Status: New

-- 
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: New

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.





Follow ups

References