Dear Firedrakers,
  I have a bit of code where I want to construct a broken function space corresponding to a given function space.

My code is:
Vdg_elt = BrokenElement(V.ufl_element())
Vdg = FunctionSpace(state.mesh, Vdg_elt)

This returns an error:
  File "/home/cjc1/repositories/dcore/gusto/advection.py", line 199, in __init__
    Vdg = FunctionSpace(state.mesh, Vdg_elt)
  File "<decorator-gen-291>", line 2, in FunctionSpace
  File "/home/cjc1/firedrake/src/PyOP2/pyop2/profiling.py", line 59, in wrapper
    return f(*args, **kwargs)
  File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspace.py", line 131, in FunctionSpace
    new = impl.FunctionSpace(topology, element, name=name)
  File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspaceimpl.py", line 245, in __init__
    sdata = get_shared_data(mesh, fiat_element)
  File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspacedata.py", line 558, in get_shared_data
    return FunctionSpaceData(mesh, fiat_element)
  File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspacedata.py", line 310, in __init__
    self.bt_masks = get_bt_masks(mesh, edofs_key, fiat_element)
  File "<decorator-gen-281>", line 2, in get_bt_masks
  File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspacedata.py", line 56, in cached
    result = f(mesh, key, *args, **kwargs)
  File "/home/cjc1/firedrake/src/firedrake/firedrake/functionspacedata.py", line 205, in get_bt_masks
    facet_dofs = horiz_facet_support_dofs(fiat_element)
  File "/home/cjc1/firedrake/src/fiat/FIAT/tensor_product.py", line 355, in horiz_facet_support_dofs
    assert isinstance(elem.ref_el, TensorProductCell)
AttributeError: DiscontinuousElement instance has no attribute 'ref_el'

What is the right way to do this?

all the best
--cjc

--