DirichletBC does nothing for DG spaces
Issue #511
invalid
if I define a Dirichlet boundary condition on a DG space and apply it to a vector, nothing happens at all.
Please see attached minimal example. If you change the space to "CG", the result is as expected: All boundary dofs are 1. But if you leave it as "DG", no boundary condition is applied whatsoever...
from dolfin import *
mesh = UnitSquareMesh(100,100)
NSpaceS = FunctionSpace(mesh, "DG", 1)
N2 = Function(NSpaceS)
bc = DirichletBC(NSpaceS, 1.0, "on_boundary")
bc.apply(N2.vector())
File("./Test/N2.pvd", "compressed") << N2
Comments (3)
-
-
reporter Thanks! Looks like that does the trick!
-
- changed status to invalid
- Log in to comment
You probably want:
Which sets those nodes whose basis functions don't vanish at the boundary, rather than the default (topological) which only sets nodes for basis functions topologically associated with the boundary.