Krishanu,
> I understood that the the Dirichlet boundary condition in this problem was
> being applied on only the top surface. But what I am trying to implement seems
> a little different to me. I will try to explain in a little more detail with
> an example in the following part.
>
> I have a a part of boundary with boundary indicator 2 which has two nodes.
> Each node has 3 degrees of freedom: displacements along x and y, and pressure.
>
> I am trying to implement x displacement to be 0 on both the nodes on this part
> of the boundary, and y displacement to be 0 on only one of these nodes. I felt
> that this is a little different from step-22 as in that case all the degrees
> of freedom corresponding to displacements on the part of the boundary (top
> surface) were constrained.
Yes, that should not be too difficult to do if you get the semantics right.
First, VectorTools::interpolate_boundary_values() has an additional argument
that lets you specify which vector components you want to constrain. So if you
mark a part of the boundary as, say, boundary_id=1, then you can call
VectorTools::interpolate_boundary_values() with an argument that makes sure
that both x and y displacement are set to something. If a different part of
the boundary, say with boundary_id=2, should have only the x-component
constrained, then you just call VectorTools::interpolate_boundary_values() for
that boundary but with a different optional argument that specifies that you
only want to select the x-component.
Regarding semantics: When you say "I have a a part of boundary with boundary
indicator 2 which has two nodes", then this is the wrong way to approach the
problem. Boundary conditions are posed on *parts of the boundary* (i.e.,
faces!), not at individual nodes. You should really think about this in terms
of the domain boundary, not in terms of the mesh you use to discretize the
domain. This also ensures that the right thing happens upon mesh refinement.