# How i can use Vector Expression?

**URL:** <https://fenicsproject.discourse.group/t/how-i-can-use-vector-expression/5994>\
**Category:** variational formulation\
**Created:** [June 9, 2021, 12:46pm UTC](https://fenicsproject.discourse.group/t/how-i-can-use-vector-expression/5994 "2021-06-09T12:46:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TherealSova](https://avatars.discourse-cdn.com/v4/letter/t/74df32/32.png) [@TherealSova](https://fenicsproject.discourse.group/u/TherealSova)\
**Post date:** [June 9, 2021, 12:46pm UTC](https://fenicsproject.discourse.group/t/how-i-can-use-vector-expression/5994/1 "2021-06-09T12:46:36Z")

</div>

I have one expression, but this scalar:

```auto
vel_in = Expression("dp/mu * (1/2 * x[2]*x[2] + 16*h*h/(pi*pi))* \
				(1/pow(1,3)*cos(1/4 * pi*x[2]/h)*(1 - cosh(1/4 * pi * x[1]/h)/cosh(1/4 * pi)) - \
				  1/pow(3,3)*cos(3/4 * pi*x[2]/h)*(1 - cosh(3/4 * pi * x[1]/h)/cosh(3/4 * pi)) + \
				  1/pow(5,3)*cos(5/4 * pi*x[2]/h)*(1 - cosh(5/4 * pi * x[1]/h)/cosh(5/4 * pi)) - \
				  1/pow(7,3)*cos(7/4 * pi*x[2]/h)*(1 - cosh(7/4 * pi * x[1]/h)/cosh(7/4 * pi)) + \
				  1/pow(9,3) * cos(9/4 * pi*x[2]/h)*(1 - cosh(9/4 * pi * x[1]/h)/cosh(9/4 * pi)) \
				)", dp=20, h=0.0002, mu=mu, degree = 2)

```

I want to set this expression on x[1] in boundary condition. I try:

```auto
bcp_inflow_top = DirichletBC(V, Constant((0,vel_in,0)), facet_domains, 14)

```

and try:

```auto
bcp_inflow_top = DirichletBC(V, (0,vel_in,0), facet_domains, 14)

```

But i have error.

---

<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:** [June 9, 2021, 12:53pm UTC](https://fenicsproject.discourse.group/t/how-i-can-use-vector-expression/5994/2 "2021-06-09T12:53:29Z")

</div>

See for instance: [Stokes equations with an iterative solver — DOLFIN documentation](https://fenicsproject.org/olddocs/dolfin/latest/python/demos/stokes-iterative/demo_stokes-iterative.py.html?highlight=stokes#implementation)

---

<div class="post-metadata">

**Author:** ![TherealSova](https://avatars.discourse-cdn.com/v4/letter/t/74df32/32.png) [@TherealSova](https://fenicsproject.discourse.group/u/TherealSova)\
**Post date:** [June 9, 2021, 3:42pm UTC](https://fenicsproject.discourse.group/t/how-i-can-use-vector-expression/5994/3 "2021-06-09T15:42:51Z")

</div>

Is it possible to solve an equation from a vector for only one scalar component?  
I want to solve Poisson’s equation for only one of the components of a vector

---

<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:** [June 9, 2021, 5:19pm UTC](https://fenicsproject.discourse.group/t/how-i-can-use-vector-expression/5994/4 "2021-06-09T17:19:49Z")

</div>

If you have made a vector space, you would need to collapse the sub space to solve a Poisson equation for only one component. Your questions is very generic, does not contain a minimal example illustrating what you want to do, and does as far as I can tell not relate to the original question.
