Edge conditions with non-Lagrange elements #2821
-
Hello! I am trying to implement a mixed Poisson problem in Firedrake and my installation raises the following error when trying to define Dirichlet boundary conditions:
The error is simple enough to understand, but I'm curious as to why this is the case when the mixed Poisson tutorial assigns boundary conditions with Brezzi-Douglas-Marini elements. ¿Is the tutorial outdated, or am I missing something? If necessary, please see the MRE below. from firedrake import (
BoxMesh, FunctionSpace, FacetNormal, TrialFunctions, TestFunctions, inner,
div, dx, ds, DirichletBC, as_vector, Function, solve
)
mesh = BoxMesh(5, 5, 5, 10, 10, 10)
V_h = FunctionSpace(mesh, 'BDM', 1)
Q_h = FunctionSpace(mesh, 'DG', 0)
W_h = V_h * Q_h
n = FacetNormal(mesh)
(u, p) = TrialFunctions(W_h)
(v, q) = TestFunctions(W_h)
a = inner(u, v)*dx
a += inner(p, div(v))*dx
a += inner(div(u), q)*dx
L = inner(v, n)*ds(1)
bc_in = DirichletBC(W_h.sub(0), as_vector([1.0, 0.0, 0.0]), 1)
bc_air = DirichletBC(W_h.sub(0), as_vector([0.0, 0.0, 0.0]), [range(3, 7)])
x = Function(W_h)
solve(a == L, x, bcs=[bc_in, bc_air])
# Error is raised, but conflicts with
# https://www.firedrakeproject.org/demos/poisson_mixed.py.html |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think what you meant to do is:
instead of:
The most general form of |
Beta Was this translation helpful? Give feedback.
I think what you meant to do is:
instead of:
The most general form of
sub_domain
argument is tuple of tuples; ifsub_domain = ((3, 4), (5, ), (4, 5, 6))
, for instance, the boundary condition is applied on the intersection of boundaries 3 and 4, on boundary 5, and on the intersection of boundaries 4, 5, and 6. Currently, this most general form is only useful for Lagrange elements. (I should document this.)If you pass a tuple
(3, 4, 5, 6)
, say, assub_domain
, it is internally converted to((3, ), (4, ), (5, ), (6, ))
.[…