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

**URL:** <https://fenicsproject.discourse.group/t/how-to-define-expression-for-one-dof-for-a-vector-valued-problem/8416>\
**Category:** variational formulation\
**Created:** [May 27, 2022, 3:51pm UTC](https://fenicsproject.discourse.group/t/how-to-define-expression-for-one-dof-for-a-vector-valued-problem/8416 "2022-05-27T15:51:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CuriousGuy](https://avatars.discourse-cdn.com/v4/letter/c/b5a626/32.png) [@CuriousGuy](https://fenicsproject.discourse.group/u/CuriousGuy)\
**Post date:** [May 27, 2022, 3:51pm UTC](https://fenicsproject.discourse.group/t/how-to-define-expression-for-one-dof-for-a-vector-valued-problem/8416/1 "2022-05-27T15:51:50Z")

</div>

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!

Thanks.

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [May 27, 2022, 4:31pm UTC](https://fenicsproject.discourse.group/t/how-to-define-expression-for-one-dof-for-a-vector-valued-problem/8416/2 "2022-05-27T16:31:15Z")

</div>

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](https://fenicsproject.discourse.group/t/initial-conditions-for-mixed-element/2032/10)

---

<div class="post-metadata">

**Author:** ![CuriousGuy](https://avatars.discourse-cdn.com/v4/letter/c/b5a626/32.png) [@CuriousGuy](https://fenicsproject.discourse.group/u/CuriousGuy)\
**Post date:** [May 30, 2022, 9:28am UTC](https://fenicsproject.discourse.group/t/how-to-define-expression-for-one-dof-for-a-vector-valued-problem/8416/3 "2022-05-30T09:28:08Z")

</div>

Hey @dokken ,

Thanks for your answer. It did help me. 🙂
