firedrakeproject / firedrake

Firedrake is an automated system for the portable solution of partial differential equations using the finite element method (FEM)
https://firedrakeproject.org
Other
498 stars 157 forks source link

Can't make vector spaces of serendipity elements on hexes #1780

Closed pefarrell closed 4 years ago

pefarrell commented 4 years ago

The following snippet

from firedrake import *
N = 1
base = UnitSquareMesh(N, N, quadrilateral=True)
mesh = ExtrudedMesh(base, N)
V = VectorFunctionSpace(mesh, "S", 1)

yields the error

Traceback (most recent call last):
  File "svector.py", line 6, in <module>
    V = VectorFunctionSpace(mesh, "S", 1)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/firedrake/firedrake/functionspace.py", line 180, in VectorFunctionSpace
    return FunctionSpace(mesh, element, name=name)
  File "<decorator-gen-44>", line 2, in FunctionSpace
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/PyOP2/pyop2/profiling.py", line 60, in wrapper
    return f(*args, **kwargs)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/firedrake/firedrake/functionspace.py", line 140, in FunctionSpace
    new = impl.FunctionSpace(topology, element, name=name, real_tensorproduct=real_tensorproduct)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/firedrake/firedrake/functionspaceimpl.py", line 277, in __init__
    finat_element = create_element(element)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/tsfc/tsfc/finatinterface.py", line 281, in create_element
    restriction=restriction)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/tsfc/tsfc/finatinterface.py", line 308, in _create_element
    finat_element, deps = convert(ufl_element, **kwargs)
  File "/usr/lib/python3.6/functools.py", line 807, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/tsfc/tsfc/finatinterface.py", line 208, in convert_vectorelement
    scalar_elem, deps = _create_element(element.sub_elements()[0], **kwargs)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/tsfc/tsfc/finatinterface.py", line 308, in _create_element
    finat_element, deps = convert(ufl_element, **kwargs)
  File "/usr/lib/python3.6/functools.py", line 807, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/tsfc/tsfc/finatinterface.py", line 182, in convert_finiteelement
    return lmbda(cell, element.degree()), set()
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/FInAT/finat/fiat_elements.py", line 297, in __init__
    super(Serendipity, self).__init__(FIAT.Serendipity(cell, degree))
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/fiat/FIAT/serendipity.py", line 128, in __init__
    self.dual = self.get_dual_set()
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/fiat/FIAT/serendipity.py", line 139, in get_dual_set
    L = T.construct_subelement(1)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20200608-mpich/src/fiat/FIAT/reference_element.py", line 718, in construct_subelement
    for c, d in zip(self.cells, dimension)])
TypeError: zip argument #2 must support iteration

The construction of vector function spaces of serendipity elements works on quads.

pefarrell commented 4 years ago

I was on an old branch, doesn't happen on master.