# Convert variable to mixed element form

**URL:** <https://community.freefem.org/t/convert-variable-to-mixed-element-form/169>\
**Category:** General Discussion\
**Created:** [November 5, 2019, 7:09pm UTC](https://community.freefem.org/t/convert-variable-to-mixed-element-form/169 "2019-11-05T19:09:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nish-ant](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@nish-ant](https://community.freefem.org/u/nish-ant)\
**Post date:** [November 5, 2019, 7:09pm UTC](https://community.freefem.org/t/convert-variable-to-mixed-element-form/169/1 "2019-11-05T19:09:16Z")

</div>

I am following the tutorial on [transient Stokes solver](https://doc.freefem.org/tutorials/timeDependentStokes.html). In the last code snippet, I find the following line:

`w1[]=sol; u=w1; v= w2; p=wp;`

which saves the solution from `w1[]` corresponding to a `P2,P2,P1` mixed space to individual variables `u`,`v`,`p` corresponding to spaces in `P2`,`P2`,`P1` respectively.

I want to do the opposite of it where I have variables in individual spaces and convert them to a combined mixed element space. I want to achieve this so that it becomes easier to write the data using `ofstream` and access it in another code.

Thanks.

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 5, 2019, 7:24pm UTC](https://community.freefem.org/t/convert-variable-to-mixed-element-form/169/2 "2019-11-05T19:24:20Z")

</div>

It’s written in the same tutorial.

```auto
    Xh [w1, w2, wp] = [var1, var2, var3];
    cout << w1[] << endl;

```
