← Back to team overview

dolfin team mailing list archive

Re: Boundary conditions for vectors

 

On Fri, Nov 14, 2008 at 10:25:07AM -0000, Heitor Pina wrote:
> Hi all
> 
> I solved a Stokes problem on a rectangular cavity with zero velocity on the
> boundary (PyDolfin 0.8.0).
> So far so good. Then I wanted to solve the same problem except that only the
> vertical component of the velocity on the top boundary is set to zero, that
> is, v[1] = 0, the component v[0] being let unspecified and therefore
> pertaining to the set of degrees of freedom.

That won't work since you have specified that you want to set the
boundary condition for the velocity (both v[0] and v[1]). Then DOLFIN
asks you for the values (in the eval function) and if you then set
just v[1], v[0] will be undefined (and set to zero since DOLFIN zeros
the argument before calling eval).

> I thought naively  that this
> could be achieved by simply commenting out the statement values[0] = 0.0
> (see code below). But that does not seem to work as intended.
> So the question is: for vector variables how do we set Dirichlet boundary
> conditions for one component only?
> Any advice would be greatly appreciated.

For vector-valued elements that are created by composing scalar
elements (as I guess is what you have), it should be possible to
create a SubSystem that corresonds to v[1]:

  velocity_x = SubSystem(0, 1) # sub system 1 of sub system 0

If you have some vector-valued element that can't be broken down into
scalar components this won't work. On the other hand, if you use an
H(div) element like BDM or RT, you can directly set the normal
component as a Dirichlet condition (for no-slip).

-- 
Anders

Attachment: signature.asc
Description: Digital signature


References