Specifying DirichletBC on function sub-spaces of MixedFunctionSpace

Asked by Krishna Garikipati on 2010-06-16

Hi,

I am using MixedFunctionSpace:
# Create FunctionSpaces
Q = FunctionSpace(mesh, "CG", 1)
V = VectorFunctionSpace(mesh, "CG", 1)
U = MixedFunctionSpace([Q, V])

and am trying to specify a Dirichlet BC on the 0 subspace of V with something like:
right= compile_subdomains("(x[0] > 9.0) && on_boundary")
disp = Constant(0.0)
bcr = DirichletBC(V.sub(0), disp, right)

This seems to work (no ffc errors), but evidently the desired BC is not imposed strongly in the plotted solution.

I tried:
bcr = DirichletBC(U[1][0], disp, right)

as suggested in SubSpace.h, but it gives
Traceback (most recent call last):
  File "tumor51.py", line 76, in <module>
    bcr = DirichletBC(U[1][0], disp, right)
TypeError: 'MixedFunctionSpace' object does not support indexing

Is there another way to address subspaces of subspaces in DirichletBC?

 ---Krishna

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
2010-06-16
Last reply:
2010-06-16
Garth Wells (garth-wells) said : #1

On 16/06/10 18:21, Krishna Garikipati wrote:
> New question #114828 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/114828
>
> Hi,
>
> I am using MixedFunctionSpace:
> # Create FunctionSpaces
> Q = FunctionSpace(mesh, "CG", 1)
> V = VectorFunctionSpace(mesh, "CG", 1)
> U = MixedFunctionSpace([Q, V])
>
> and am trying to specify a Dirichlet BC on the 0 subspace of V with something like:
> right= compile_subdomains("(x[0]> 9.0)&& on_boundary")
> disp = Constant(0.0)
> bcr = DirichletBC(V.sub(0), disp, right)
>
> This seems to work (no ffc errors), but evidently the desired BC is not imposed strongly in the plotted solution.
>

The computed solution doesn't satisfy the bc?

> I tried:
> bcr = DirichletBC(U[1][0], disp, right)
>
> as suggested in SubSpace.h, but it gives
> Traceback (most recent call last):
> File "tumor51.py", line 76, in<module>
> bcr = DirichletBC(U[1][0], disp, right)
> TypeError: 'MixedFunctionSpace' object does not support indexing
>
>
> Is there another way to address subspaces of subspaces in DirichletBC?
>

   bcr = DirichletBC(V.sub(1).sub(0), disp, right)

Garth

> ---Krishna
>

Can you help with this problem?

Provide an answer of your own, or ask Krishna Garikipati for more information if necessary.

To post a message you must log in.