# 2D iovtk Files corrupted

**URL:** <https://community.freefem.org/t/2d-iovtk-files-corrupted/80>\
**Category:** General Discussion\
**Created:** [June 21, 2019, 2:03pm UTC](https://community.freefem.org/t/2d-iovtk-files-corrupted/80 "2019-06-21T14:03:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![riahi](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@riahi](https://community.freefem.org/u/riahi)\
**Post date:** [June 21, 2019, 2:03pm UTC](https://community.freefem.org/t/2d-iovtk-files-corrupted/80/1 "2019-06-21T14:03:06Z")

</div>

Dear FF+±Users & Developers,  
I’m facing an issue with iovtk 2d where both binary and ASCII files are corrupted. Paraview is unable to read correctly the files.  
I have used version ff++3.36 ff+±4.0 on Ubuntu and MacOS and still having the same issue.  
Please if you have any alternatives or patching of the bug please share it.  
mk.

---

<div class="post-metadata">

**Author:** ![simon.garnotel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/simon.garnotel/32/11_2.png) [@simon.garnotel](https://community.freefem.org/u/simon.garnotel)\
**Post date:** [June 24, 2019, 9:11am UTC](https://community.freefem.org/t/2d-iovtk-files-corrupted/80/2 "2019-06-24T09:11:44Z")

</div>

Hi,

Are you sure that your solution is correct (no NaN or Inf) using plot in FreeFEM ?  
If there is some NaN of Inf in the .vtu or .vtk file, Paraview is unable to open the file.

---

<div class="post-metadata">

**Author:** ![riahi](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@riahi](https://community.freefem.org/u/riahi)\
**Post date:** [June 26, 2019, 6:11am UTC](https://community.freefem.org/t/2d-iovtk-files-corrupted/80/3 "2019-06-26T06:11:47Z")

</div>

Hi Simon,  
I double checked and I don’t find any NAN in my ascii .vtk . I think I realize what is the issue: Actually, if I want to plot a vector field let’s say, [u,v] I should not put the any other fem function beside like for instance in the Navier stokes equation (even take the example that ff++ gives)  
when I try to savevtk( [u,v,],p,…) the file will become corrupted and paraview pops errors while loading the files. I had to do savevtk( [u,v,],…) without the pressure p.  
This only occurs for me in the 2d calculation case. The 3d case is fine.  
Thank you again and best wishes,  
mk.

---

<div class="post-metadata">

**Author:** ![simon.garnotel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/simon.garnotel/32/11_2.png) [@simon.garnotel](https://community.freefem.org/u/simon.garnotel)\
**Post date:** [June 26, 2019, 11:10am UTC](https://community.freefem.org/t/2d-iovtk-files-corrupted/80/4 "2019-06-26T11:10:53Z")

</div>

Some important remarks:

- you must save in P1
- you can save multiple data, for example here velocity and pressure

What I do:

```auto
fespace PV(Th, P1);
PV uu=u, vv=v; // interpolate in P1
string dataname = "u p"; // variable name in Paraview
int[int] order = [1, 1]; // order (default in 0)
savevtk("res.vtu", Th, [uu, vv], p, dataname=dataname, order=order);

```

Does it works for you?

---

<div class="post-metadata">

**Author:** ![jsmacd](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jsmacd](https://community.freefem.org/u/jsmacd)\
**Post date:** [April 4, 2023, 11:56pm UTC](https://community.freefem.org/t/2d-iovtk-files-corrupted/80/5 "2023-04-04T23:56:24Z")

</div>

What is the dataname argument used for?

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [April 5, 2023, 5:49am UTC](https://community.freefem.org/t/2d-iovtk-files-corrupted/80/6 "2023-04-05T05:49:47Z")

</div>

It passes the names (space-separated) to the paraview file so that they are labeled when loaded in paraview.
