How to define 'Expression' for one DoF for a vector-valued problem?

Dear FEniCS Community,

I have a question in my mind that has been bothering me for a while now. I could not find an answer to this question, and therefore, I am putting it here. Any help will be highly appreciated

Let’s say I have a vector-valued problem in a 3D domain. My DoFs are simply x,y, and z movements of corners or vertices of triangular elements and I am simply using 1st order Lagrange polynomial space for approximation.

My question is, lets say I have to define DirichletBC on Surface1 of my 3D domain, could I define it only for one DoF (let’s say value[2]) without setting the other two DoFs (value[0],value[1]) on this boundary to zero or not mentioning them at all? The values of the other two DoFs (value[0],value[1]) at an edge of this Surface1 are already defined as a DirichletBC at an edge of Surface2. Which means, both these surfaces share a common edge. Hence, I cannot set the other two DoFs (value[0],value[1]) of Surface1 to zero or some other value because I have already defined values for common nodes in the DirichletBC for Surface2. However, I do want to define the value for third DoF for Surface1 (value[2])

Moreover, the values of DirichletBC in my case are some interpolation functions which vary with the coordinates of my geometry, so I cannot just fix single values for these DoFs at these surfaces.

I hope you get my problem. Any help will be highly appreciated!


I would suggest apply a Dirichlet condition on the appropriate sub spaces. Something along these lines is shown in: Initial Conditions for mixed Element - #10 by dokken


Hey @dokken ,

Thanks for your answer. It did help me. :slight_smile: