Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend FormSplitter to handle restrictions #310

Merged
merged 6 commits into from
Oct 2, 2024

Conversation

jorgensd
Copy link
Member

@jorgensd jorgensd commented Oct 2, 2024

When extracting blocks, one can end up with PositiveRestriction(Zero()) in the form when using dS integrals, and extracting a block with no contribution.
MWE:

   domain = ufl.Mesh(FiniteElement("Lagrange", cell, 1, (d,), ufl.identity_pullback, ufl.H1))
    el_u = FiniteElement("Lagrange", cell, 2, (d, ), ufl.identity_pullback, ufl.H1)
    el_p = FiniteElement(
        "Lagrange", cell, 1, (), ufl.identity_pullback, ufl.H1)
    V = ufl.FunctionSpace(domain, el_u)
    Q = ufl.FunctionSpace(domain, el_p)
    W = ufl.MixedFunctionSpace(V, Q)
    u, p = ufl.TrialFunctions(W)
    v, q = ufl.TestFunctions(W) 
    a = ufl.inner(ufl.grad(u), ufl.grad(v))*ufl.dx + ufl.div(u)*q*ufl.dx + ufl.div(v)*p*ufl.dx
    a += ufl.inner(u("+"),v("+")) * ufl.dS
    a_blocks = ufl.extract_blocks(a)
    assert a_blocks[1][1] is None

does not return a zero form.

This PR extends FormSplitter such that
split(Restriction(expr))
now returns
Zero if split(expr)=Zero

@jorgensd jorgensd changed the title Add handling of case where a split returns a form with no arguments Extend FormSplitter to handle restrictions Oct 2, 2024
@jorgensd jorgensd added this pull request to the merge queue Oct 2, 2024
Merged via the queue into main with commit 8384202 Oct 2, 2024
21 checks passed
@jorgensd jorgensd deleted the dokken/form-split-no-arguments branch October 2, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant