On 24 Jul 2015, at 11:25, Justin Chang <jychang48@gmail.com> wrote:
Thanks for the responses guys. However, I am running into issues regarding Dirichlet bcs for P2/P0 elements. Attached is the code:
I am trying to apply homogeneous boundary conditions in the P0 space, and when I looked at the documentation online it said to use DirichletBC(Q, <value>, <boundary_id>, method="geometric") but I am getting these kinds of errors:
Aha, this is a simple problem. When you define a MixedFunctionSpace and then want to apply boundary conditions on a part of the space, you must define the boundary condition on an indexed subspace, rather than the original space. That is: V = ... Q = ... W = V*Q bc = DirichletBC(W.sub(1), ...) rather than bc = DirichletBC(Q, ...) This is in the documentation (http://firedrakeproject.org/variational-problems.html#incorporating-boundary...) but maybe not clearly enough. Making this change, and your code runs fine. I note in passing, that the DirichletBC constructor can take a list of boundary ids as well as just a single id. So, since all the boundary condition values are the same you can replace your six separate BC objects by: bcs = DirichletBC(W.sub(1), 0, (1, 2, 3, 4, 5, 6), method="geometric") Cheers, Lawrence