Skip to content

Let dolfinx.fem.forms._zero_form compile on mixed-domain problems. #3975

@jorgensd

Description

@jorgensd

Summarize the issue

Currently this assumes no entity maps.

How to reproduce the bug

Run the following code

Minimal Example (Python)

from mpi4py import MPI
import numpy as np
import dolfinx
import ufl

mesh = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 10, 10)
submesh, entity_map = dolfinx.mesh.create_submesh(
    mesh,
    mesh.topology.dim,
    np.arange(mesh.topology.index_map(mesh.topology.dim).size_local, dtype=np.int32)[
        :-2
    ],
)[:2]

V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
Q = dolfinx.fem.functionspace(submesh, ("Lagrange", 1))

u = ufl.TrialFunction(V)
v = ufl.TestFunction(Q)
a = ufl.ZeroBaseForm((u, v))
dolfinx.fem.form(a, entity_maps=[entity_map])

Output (Python)

Traceback (most recent call last):
  File "/root/shared/networks_fenicsx/mwe.py", line 21, in <module>
    dolfinx.fem.form(a, entity_maps=[entity_map])
  File "/root/shared/dolfinx/python/dolfinx/fem/forms.py", line 449, in form
    return _create_form(form)
           ^^^^^^^^^^^^^^^^^^
  File "/root/shared/dolfinx/python/dolfinx/fem/forms.py", line 443, in _create_form
    return _zero_form(form)
           ^^^^^^^^^^^^^^^^
  File "/root/shared/dolfinx/python/dolfinx/fem/forms.py", line 419, in _zero_form
    f = ftype(
        ^^^^^^
RuntimeError: Incompatible mesh. argument entity_maps must be provided.

Version

main branch

DOLFINx git commit

No response

Installation

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions