# Plot in 3d with .vtu (visualization with paraview)

**URL:** <https://community.freefem.org/t/plot-in-3d-with-vtu-visualization-with-paraview/58>\
**Category:** General Discussion\
**Created:** [May 24, 2019, 8:33pm UTC](https://community.freefem.org/t/plot-in-3d-with-vtu-visualization-with-paraview/58 "2019-05-24T20:33:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aicha](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Aicha](https://community.freefem.org/u/Aicha)\
**Post date:** [May 24, 2019, 8:33pm UTC](https://community.freefem.org/t/plot-in-3d-with-vtu-visualization-with-paraview/58/1 "2019-05-24T20:33:30Z")

</div>

Hi

i have to plot the Following function:

q(x/eps,y/eps,z/eps)=1 if (x/eps,y/eps,z/eps) \in B\_{\delta}+ Z^3, else 0.

where B\_{delta} is the ball with radius

\delta= ((3/4)_(1/(w_pi)))^{1/3}

we choise eps=0.1 and w=2000.

The problem is that in .vtu we Don’t ditingue the ball when q=1 to the rest when q=0.

I search in the doc but i Don’t find how we save .vtu in 3d (i choice 3d in paraview). So there is an solution?

And the image after copilation Don’t show the ball.

Thank you in advance to the help. There is the code:

’ ’ ’ freefem  
load “UMFPACK64”  
defaulttoUMFPACK64();

load “iovtk”

load “msh3”

verbosity=1;

func real q (real t, real s, real c,real w) {  
real t1 = t - rint(t);  
real s1 = s - rint(s);  
real c1 = c -rint©;  
real delta= ((3./4.)_(1./(pi_w)))^(1/3);  
if ( square(s1)+square(t1)+square(c1) \<= square(delta))  
return 1;  
else  
return 0.0;  
};  
real eps=0.2, w=2000.;

mesh3 Th=cube(30,30,30);  
fespace Wh(Th,P2,periodic=[[1,x,z],[3,x,z],[2,y,z],[4,y,z],[5,x,y],[6,x,y]]);  
Wh uplot;  
int[int] Order= [1];

uplot=q(x/eps,y/eps,z/eps,w);  
plot(uplot,wait=1,dim=3);  
savevtk(“q.vtu”,Th,uplot,dataname=“qdelta”, order=Order);

Kind regards

---

<div class="post-metadata">

**Author:** ![mojtaba.barzegari](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mojtaba.barzegari/32/20_2.png) [@mojtaba.barzegari](https://community.freefem.org/u/mojtaba.barzegari)\
**Post date:** [May 27, 2019, 5:29pm UTC](https://community.freefem.org/t/plot-in-3d-with-vtu-visualization-with-paraview/58/2 "2019-05-27T17:29:33Z")

</div>

Hi,

Sorry I cannot understand the problem clearly, but if your problem is you cannot produce any result out of this code, the reason is you forgot to put a dot in the formula that calculates radius of the balls. It should be changed to this:

```
real delta = ((3./4.) *(1./(pi* w)))^(1./3);

```

`"1/3"` equals 0, while `"1./3"` is 0.333.
