Redesign of essential boundary conditions
Replace current Dirichlet boundary condition design with constrained function spaces
Blueprint information
- Status:
- Complete
- Approver:
- None
- Priority:
- Medium
- Drafter:
- None
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- Superseded
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
- Anders Logg
Related branches
Related bugs
Sprints
Whiteboard
Problem:
Mathematically, an essential boundary condition is typically associated with a constrained function space. For example: the natural space for the Laplacian with zero Dirichlet boundary conditions is H^1_0.
In DOLFIN on the other hand, an essential boundary condition is represented using a DirichletBC, which acts on the linear algebra level.
Bottomline, there is a certain mismatch between the mathematical abstraction and the current implementation. Further, it tends to be a bit cumbersome to pass the boundary conditions around 'everywhere'.
Suggested fix:
Add the possibility of constraining function spaces:
V = FunctionSpace(...)
domain = SubDomain (or MeshFunction)
g = Expression (or Function)
V.constrain
Implementational thoughts:
- The information about the essential boundary condition should thus now lie with the function space. Hence, no need to send boundary conditions around :)
- I guess the constraint information will only be invoked when assembling element tensors over the function space.
AL: I think this looks good. We could also allow bc as an argument to constrain:
V.constrain(bc)
And we could also allow bc as an argument to the constructor:
V = FunctionSpace(mesh, "CG", 1, bc)
AL: Update. This last suggestion won't work since bc requires V in its constructor. But it makes sense to allow spaces to be constrained. This can work by having V.constrain(domain, g) and letting that call create a DirichletBC stored as part of the FunctionSpace.