Skip to content

[BUG]: different trial and test space with dirichlet boundary conditions should throw an error #3988

@mfeuerle

Description

@mfeuerle

Summarize the issue

I tried to solve a Petrov-Galerkin formulation with Fenicsx, where i used different Trial and Test spaces

U = fem.functionspace(msh, ("Lagrange", 1))
V = fem.functionspace(msh, ("Lagrange", 1))
u = ufl.TrialFunction(U)
v = ufl.TestFunction(V)

You can find the full description here:
https://fenicsproject.discourse.group/t/petrov-gelerkin-formulations-and-fenicsx/18369?u=mfeuerle

Applying Dirichlet boundary conditions to at least one of these spaces results in a problem within dolfinx that is not captured accordingly, even if the same Dirichlet conditions are applied to both spaces, effectively resulting in the same space, but as two different objects.

When trying to solve the resulting system e.g. using dolfinx.fem.petsc.LinearProblem or when assembling the system e.g. using dolfinx.fem.form followed by dolfinx.fem.assemble_matrix, dolfinx leaves the system in an unfinished state: it sets all rows and columns to zero, but then, realizing that Trial and Test space are not equal and there might not be a 1one1 realition between trial dofs and test dofs, it (correctly) does not set the 1.0 on the diagonal (this approach on Dirichlet boundary condition is just not able to handle Petrov-Galerkin formulations where different Trial and Test spaces are used). It should raise an error stating that it is not able to correctly handle this setting (different Trial and Test space + Dirichlet condition), instead of leaving the system in an unfinished state (handling of BCs is stopped half way and the resulting matrix is singular).

This is a bug report, for not raising an appropriate error. For the Feature request to actually support this, see #3989

How to reproduce the bug

See https://fenicsproject.discourse.group/t/petrov-gelerkin-formulations-and-fenicsx/18369?u=mfeuerle

Minimal Example (Python)

Output (Python)

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