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

ufl >= 2024 and Constant having a domain. #313

Open
dr-robertk opened this issue Oct 7, 2024 · 0 comments
Open

ufl >= 2024 and Constant having a domain. #313

dr-robertk opened this issue Oct 7, 2024 · 0 comments

Comments

@dr-robertk
Copy link
Contributor

In dune-fem we have not been able to upgrade to ufl beyond 22.2.0 because of the Constant (now having a domain) and the domain check being enforced in domain.py:221: (join_domains).

In our case this is, for example, the case when a Constant representing the time step dt is used in two different forms.

I think this is also related to the discussion in #267.

The following code triggers the problem:

import basix.ufl
import ufl

# Bulk problem: u - tau laplace u = u_n + tau f.
# but only setting up right hand side forcing 'tau f'
#
bc_el = basix.ufl.element("Lagrange", "triangle", 1, shape=(2, ))
bdomain = ufl.Mesh(bc_el)

# issue here: constant defined on bulk domain
tau = ufl.Constant(bdomain)

bel = basix.ufl.element("Lagrange", "triangle", 1)
bV = ufl.FunctionSpace(bdomain, bel)
bL = tau*ufl.inner(ufl.Coefficient(bV), ufl.TestFunction(bV)) * ufl.dx

#############################################################

# Surface problem: w - tau laplace w = w_n + tau g
# but only setting up right hand side forcing 'tau g'
sc_el = basix.ufl.element("Lagrange", "triangle", 1, shape=(3, ))
sdomain = ufl.Mesh(sc_el)

# issue here: can't use constant from bulk problem - using 'sdomain' works
# tau = ufl.Constant(sdomain)

sel = basix.ufl.element("Lagrange", "triangle", 1)
sV = ufl.FunctionSpace(sdomain, sel)

# This line results in
# ValueError: Found domains with different geometric dimensions.
sL = tau*ufl.inner(ufl.Coefficient(sV), ufl.TestFunction(sV)) * ufl.dx
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

No branches or pull requests

1 participant