# Failed to split a vector

**URL:** <https://fenicsproject.discourse.group/t/failed-to-split-a-vector/14629>\
**Category:** dolfinx\
**Created:** [May 11, 2024, 8:43pm UTC](https://fenicsproject.discourse.group/t/failed-to-split-a-vector/14629 "2024-05-11T20:43:23Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Jesus\_Vellojin](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/jesus_vellojin/32/6485_2.png) [@Jesus\_Vellojin](https://fenicsproject.discourse.group/u/Jesus_Vellojin)\
**Post date:** [May 12, 2024, 3:51pm UTC](https://fenicsproject.discourse.group/t/failed-to-split-a-vector/14629/4 "2024-05-12T15:51:33Z")

</div>

Hi.

When working with mixed formulations, like `VectorFunctionSpace`, you need to collapse the functions (see for example [Meaning of .collapse()](https://fenicsproject.discourse.group/t/meaning-of-collapse/10641/2) or [here](https://fenicsproject.discourse.group/t/writing-xdmf-file-leads-to-inf-nan-values/13830/4)):

Taking

```auto
grad_uh_x=grad_uh_x.collapse()
grad_uh_y=grad_uh_y.collapse()
print(uh.x.array.shape, grad_uh_value.x.array.shape, grad_uh_y.x.array.shape)

```

gives

```auto
(81,) (162,) (81,)

```

as expected.

Cheers.

---

_[View the full topic](https://fenicsproject.discourse.group/t/failed-to-split-a-vector/14629)._
