set boundary condition for one component of a vector variable

Asked by tedlai

V = VectorFunctionSpace(mesh, "CG", 2)
Q = FunctionSpace(mesh, "CG", 1)
W = V + Q

noslip = Constant((0, 0))
bc0 = DirichletBC(W.sub(0), noslip, sub_domains, 0)

In the above code, when I set the noslip dirichletBC for a boundary,
W.sub(0) represent a vector of two component,
can I just set only one component to zero, but left another component to be Newmann BC?

In this way, how can I writh it ?
perhaps it is a stupid quesion, anyway, I am quite new comer.

Question information

Language:
English Edit question
Status:
Solved
For:
FEniCS Project Edit question
Assignee:
No assignee Edit question
Solved by:
Garth Wells
Solved:
Last query:
Last reply:
Revision history for this message
Best Garth Wells (garth-wells) said :
#1

On 02/03/10 16:41, tedlai wrote:
> New question #102964 on FEniCS Project:
> https://answers.launchpad.net/fenics/+question/102964
>
> V = VectorFunctionSpace(mesh, "CG", 2)
> Q = FunctionSpace(mesh, "CG", 1)
> W = V + Q
>
> noslip = Constant((0, 0))
> bc0 = DirichletBC(W.sub(0), noslip, sub_domains, 0)
>
> In the above code, when I set the noslip dirichletBC for a boundary,
> W.sub(0) represent a vector of two component,
> can I just set only one component to zero, but left another component to be Newmann BC?
>

Try

     W.sub(0).sub(0)
     W.sub(0).sub(1)

or

     W.sub(0, 0)
     W.sub(0, 1)

I'm not sure of the latter will work from Python. If it doesn't, we can
extend the Python interface.

Garth

> In this way, how can I writh it ?
> perhaps it is a stupid quesion, anyway, I am quite new comer.
>
>
>

Revision history for this message
tedlai (lailai) said :
#2

Thanks Garth Wells, that solved my question.

Revision history for this message
tedlai (lailai) said :
#3

Thanks Garth, the first formulation really work, but it seems the later one did not work

Thank you.