← Back to team overview

dolfin team mailing list archive

Boundary conditions for vectors

 

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. 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.
--
Best regards
        Heitor Pina

--------------------------------------------
#  Velocity on top
class Toplid(Function):
    def __init__(self, mesh):
        Function.__init__(self, mesh)
    def eval(self, values, x):
        #values[0] = 0.0
        values[1] = 0.0
    def rank(self):
        return 1
    def dim(self, i):
        return 2



Follow ups

References