Quadrilateral Mesh reordering error

Issue #1089 resolved
Bhavesh Shrimali created an issue

Are quad elements fully supported in dolfin-2019.1.0 ? I was trying to import a quad mesh.

from dolfin import *
msh = Mesh()
f = XDMFFile(MPI.comm_world,'test_quadMesh.xdmf')
f.read(msh)

However it returns the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to order quadrilateral cell.
*** Reason:  Cell is not orderable.
*** Where:   This error was encountered inside QuadrilateralCell.cpp.
*** Process: 0
***
*** DOLFIN version: 2019.1.0
*** Git changeset:  74d7efe1e84d65e9433fd96c50f1d278fa3e3f3f
*** -------------------------------------------------------------------------

I am able to visualize the mesh in Paraview, which seems to suggest that there is no problem, as such, with the mesh per se.

I have also tried using the MeshEditor() without much success (it returned the same error as above). Looking it up on the list of issues, I found https://bitbucket.org/fenics-project/dolfin/issues/997/quad-hex-meshes-need-ordering-check, but this is marked as resolved in 2018.1.0. I am using the 2019.1.0 docker image to test this.

Comments (5)

  1. Bhavesh Shrimali reporter

    Update: Everything is fine up until the point I create a function space.

    import dolfin as df 
    
    msh = df.Mesh()
    e = df.MeshEditor()
    e.open(msh,'quadrilateral',2,2)
    e.init_vertices(num_nodes)
    e.init_cells(num_elems)
    
    for i, nval in enumerate(nodes):
        e.add_vertex(i,nval)
    
    for elem in cells:
        e.add_cell(elem[0],np.array([elem[1], elem[2], elem[4], elem[3]],int))
    
    e.close(order=False)
    
    V=df.FunctionSpace(msh,'CG',2)
    

    which returns

    Calling FFC just-in-time (JIT) compiler, this may take some time.
    Elapsed wall, usr, sys time: 0.0102284, 0, 0.01 (Init dofmap)
    Traceback (most recent call last):
      File "test_quads_convert.py", line 69, in <module>
        V=df.FunctionSpace(msh,'CG',2)
      File "/usr/local/lib/python3.6/dist-packages/dolfin/function/functionspace.py", line 33, in __init__
        self._init_convenience(*args, **kwargs)
      File "/usr/local/lib/python3.6/dist-packages/dolfin/function/functionspace.py", line 100, in _init_convenience
        self._init_from_ufl(mesh, element, constrained_domain=constrained_domain)
      File "/usr/local/lib/python3.6/dist-packages/dolfin/function/functionspace.py", line 50, in _init_from_ufl
        dolfin_dofmap = cpp.fem.DofMap(ufc_dofmap, mesh)
    RuntimeError:
    
    *** -------------------------------------------------------------------------
    *** DOLFIN encountered an error. If you are not able to resolve this issue
    *** using the information listed below, you can ask for help at
    ***
    ***     fenics-support@googlegroups.com
    ***
    *** Remember to include the error message listed below and, if possible,
    *** include a *minimal* running example to reproduce the error.
    ***
    *** -------------------------------------------------------------------------
    *** Error:   Unable to create mapping of degrees of freedom.
    *** Reason:  Mesh is not ordered according to the UFC numbering convention. Consider calling mesh.order().
    *** Where:   This error was encountered inside DofMapBuilder.cpp.
    *** Process: 0
    ***
    *** DOLFIN version: 2019.1.0
    *** Git changeset:  74d7efe1e84d65e9433fd96c50f1d278fa3e3f3f
    *** -------------------------------------------------------------------------
    

    and if I give the additional argument msh.order() to FunctionSpace() it gives the same error as before:

    Ordering mesh.
    Traceback (most recent call last):
      File "test_quads_convert.py", line 69, in <module>
        V=df.FunctionSpace(msh,'CG',2, msh.order())
    RuntimeError:
    
    *** -------------------------------------------------------------------------
    *** DOLFIN encountered an error. If you are not able to resolve this issue
    *** using the information listed below, you can ask for help at
    ***
    ***     fenics-support@googlegroups.com
    ***
    *** Remember to include the error message listed below and, if possible,
    *** include a *minimal* running example to reproduce the error.
    ***
    *** -------------------------------------------------------------------------
    *** Error:   Unable to order quadrilateral cell.
    *** Reason:  Cell is not orderable.
    *** Where:   This error was encountered inside QuadrilateralCell.cpp.
    *** Process: 0
    ***
    *** DOLFIN version: 2019.1.0
    *** Git changeset:  74d7efe1e84d65e9433fd96c50f1d278fa3e3f3f
    *** -------------------------------------------------------------------------
    
  2. Jan Blechta

    Adding the quads/hexes support into FEniCS was a bit rushed. It turned out that FEniCS needs a fundamental rewrite of mesh/dofmap/assembly to handle general quad/hex meshes. Such meshes should be fully supported in dolfinx, which should soon have an alpha release. In the mean time, DOLFIN supports some built-in quad/hex meshes (which are ordered by design) but most likely fails with general quad/hex meshes (which are difficult or impossible to order). See also #997 for details.

  3. Bhavesh Shrimali reporter

    Thanks for the reply Jan! I have been experimenting with dolfinxof late. If you feel that dolfin may support general quad/hex meshes, feel free to reopen this issue. But I feel it best to close this in favor of moving to dolfinx

  4. Log in to comment