← Back to team overview

dolfin team mailing list archive

Re: [Question #114828]: Specifying DirichletBC on function sub-spaces of MixedFunctionSpace

 

Question #114828 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/114828

    Status: Open => Answered

Garth Wells proposed the following answer:

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
>

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.