FEniCS / ffcx

Next generation FEniCS Form Compiler for finite element forms
https://fenicsproject.org
Other
145 stars 38 forks source link

Double derivative on manifold #575

Closed jorgensd closed 1 year ago

jorgensd commented 1 year ago

Ref: https://github.com/FEniCS/dolfinx/issues/2677

import basix
import ufl
gdim = 2
cel = basix.ufl.element("Lagrange", "interval", 1, shape=(gdim,), gdim=gdim)
msh  = ufl.Mesh(cel)

el = basix.ufl.element("Lagrange", "interval", 2, gdim=gdim)
V = ufl.FunctionSpace(msh, el)
dx = ufl.Measure("dx", domain=msh)
u0 = ufl.Coefficient(V)
J = u0.dx(0).dx(0)*dx

forms = [J]

traceback:

Traceback (most recent call last):
  File "/usr/local/bin/ffcx", line 8, in <module>
    sys.exit(main())
  File "/root/shared/ffcx/ffcx/main.py", line 67, in main
    code_h, code_c = compiler.compile_ufl_objects(
  File "/root/shared/ffcx/ffcx/compiler.py", line 102, in compile_ufl_objects
    ir = compute_ir(analysis, object_names, prefix, options, visualise)
  File "/root/shared/ffcx/ffcx/ir/representation.py", line 198, in compute_ir
    irs = [_compute_integral_ir(fd, i, analysis.element_numbers, integral_names, finite_element_names,
  File "/root/shared/ffcx/ffcx/ir/representation.py", line 198, in <listcomp>
    irs = [_compute_integral_ir(fd, i, analysis.element_numbers, integral_names, finite_element_names,
  File "/root/shared/ffcx/ffcx/ir/representation.py", line 494, in _compute_integral_ir
    integral_ir = compute_integral_ir(itg_data.domain.ufl_cell(), itg_data.integral_type,
  File "/root/shared/ffcx/ffcx/ir/integral.py", line 84, in compute_integral_ir
    mt_table_reference = build_optimized_tables(
  File "/root/shared/ffcx/ffcx/ir/elementtables.py", line 361, in build_optimized_tables
    t = get_ffcx_table_values(quadrature_rule.points, cell,
  File "/root/shared/ffcx/ffcx/ir/elementtables.py", line 126, in get_ffcx_table_values
    tbl = tbl[basix_index(derivative_counts)]
IndexError: index 3 is out of bounds for axis 0 with size 3

Works with gdim=1

jorgensd commented 1 year ago

I believe it should be topological_dimension here: https://github.com/FEniCS/ffcx/blob/26d5556d9b40314fbe0096aa494faa35199e8e61/ffcx/ir/elementtables.py#L230-L231, any thoughts on this @mscroggs ?