Skip to content

BUG: HCT doesn't work at very high order #4152

Open
@pefarrell

Description

@pefarrell

Describe the bug

HCT works for degrees < 13, but fails at degree 13.

Steps to Reproduce
Steps to reproduce the behavior:

python -c "from firedrake import *; mesh = UnitSquareMesh(2, 2); V = FunctionSpace(mesh, 'HCT', 13)"

Expected behavior
I expected the function space to be created without error.

Error message

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/firedrake/firedrake/functionspace.py", line 105, in FunctionSpace
    return impl.WithGeometry.make_function_space(mesh, element, name=name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/firedrake/firedrake/functionspaceimpl.py", line 373, in make_function_space
    new = FunctionSpace(topology, element, name=name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/firedrake/firedrake/functionspaceimpl.py", line 522, in __init__
    self.set_shared_data()
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/firedrake/firedrake/functionspaceimpl.py", line 531, in set_shared_data
    sdata = get_shared_data(self._mesh, element)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/firedrake/firedrake/functionspacedata.py", line 541, in get_shared_data
    return FunctionSpaceData(mesh, ufl_element, boundary_set)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/firedrake/firedrake/functionspacedata.py", line 420, in __init__
    finat_element = create_element(ufl_element)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/firedrake/firedrake/functionspacedata.py", line 42, in create_element
    finat_element = _create_element(ufl_element)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/fiat/finat/element_factory.py", line 321, in create_element
    finat_element, deps = _create_element(ufl_element,
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/fiat/finat/element_factory.py", line 351, in _create_element
    finat_element, deps = convert(ufl_element, **kwargs)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/functools.py", line 909, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/fiat/finat/element_factory.py", line 225, in convert_finiteelement
    return lmbda(cell, element.degree(), **finat_kwargs), set()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/fiat/finat/hct.py", line 18, in __init__
    super().__init__(FIAT.HsiehCloughTocher(cell, degree))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/fiat/FIAT/hct.py", line 88, in __init__
    super().__init__(poly_set, dual, degree, formdegree=formdegree)
  File "/home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/src/fiat/FIAT/finite_element.py", line 143, in __init__
    B = old_coeffs.reshape((shp[0], -1))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: cannot reshape array of size 34250 into shape (127,newaxis)

Environment:

  • OS: Ubuntu
  • Python version: 3.12.3
  • Output of firedrake-status
  • Any relevant environment variables or modifications [eg: PYOP2_DEBUG=1]
Firedrake Configuration:
    package_manager: False
    minimal_petsc: False
    mpicc: /home/farrellp/local/firedrake/firedrake-dev-20250112-mpich-mkl/src/petsc/linux-gnu-c-opt/bin/mpicc
    mpicxx: /home/farrellp/local/firedrake/firedrake-dev-20250112-mpich-mkl/src/petsc/linux-gnu-c-opt/bin/mpicxx
    mpif90: /home/farrellp/local/firedrake/firedrake-dev-20250112-mpich-mkl/src/petsc/linux-gnu-c-opt/bin/mpif90
    mpiexec: /home/farrellp/local/firedrake/firedrake-dev-20250112-mpich-mkl/src/petsc/linux-gnu-c-opt/bin/mpiexec
    mpihome: /home/farrellp/local/firedrake/firedrake-dev-20250112-mpich-mkl/src/petsc/linux-gnu-c-opt/
    disable_ssh: False
    honour_petsc_dir: True
    with_parmetis: False
    slepc: True
    packages: ['git+ssh://github.com/firedrakeproject/Irksome.git#egg=Irksome']
    honour_pythonpath: False
    opencascade: False
    torch: False
    jax: False
    petsc_int_type: int32
    cache_dir: /home/farrellp/git/install-scripts/firedrake/firedrake-dev-20250112-mpich-mkl/.cache
    complex: False
    remove_build_files: False
    with_blas: None
    netgen: True
Additions:
    None
Environment:
    PYTHONPATH: None
    PETSC_ARCH: linux-gnu-c-opt
    PETSC_DIR: /home/farrellp/local/firedrake/firedrake-dev-20250112-mpich-mkl/src/petsc
Status of components:
---------------------------------------------------------------------------
|Package             |Branch                        |Revision  |Modified  |
---------------------------------------------------------------------------
|Irksome             |master                        |3ba45c3   |False     |
|fiat                |master                        |8839f876  |False     |
|firedrake           |master                        |c2500aa39 |False     |
|h5py                |firedrake                     |06d2da80  |False     |
|libsupermesh        |master                        |f87cbfd   |False     |
|loopy               |main                          |ad07454c  |True      |
|petsc               |firedrake                     |4354988f8b6|False     |
|pyadjoint           |master                        |da58d45   |False     |
|pytest-mpi          |main                          |f5668e4   |False     |
|slepc               |firedrake                     |cfa875895 |False     |
|ufl                 |master                        |5da0ab98  |False     |
---------------------------------------------------------------------------

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions