# How to associate the length of vector with the size of cells,When we draw the CellData vector flux on the corresponding XYZ coordinates?

**URL:** https://discourse.paraview.org/t/how-to-associate-the-length-of-vector-with-the-size-of-cells-when-we-draw-the-celldata-vector-flux-on-the-corresponding-xyz-coordinates/8804
**Category:** ParaView Support
**Created:** [January 20, 2022, 8:08am UTC](https://discourse.paraview.org/t/how-to-associate-the-length-of-vector-with-the-size-of-cells-when-we-draw-the-celldata-vector-flux-on-the-corresponding-xyz-coordinates/8804 "2022-01-20T08:08:36Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![sofeiya2021](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sofeiya2021/32/7148_2.png) [@sofeiya2021](https://discourse.paraview.org/u/sofeiya2021)
#### Post date: [January 20, 2022, 8:08am UTC](https://discourse.paraview.org/t/how-to-associate-the-length-of-vector-with-the-size-of-cells-when-we-draw-the-celldata-vector-flux-on-the-corresponding-xyz-coordinates/8804/1 "2022-01-20T08:08:36Z")

</div>

In my VTK file ,there is CellData flux,flux is a vector with 3 coordinate values.

 ![CellData_vectorflux1](https://discourse.paraview.org/uploads/default/original/2X/9/963fda419d319deb3984bb81ce6b1deddfa1f6a2.png)  
When we draw the CellData vector flux on the corresponding XYZ coordinates,use the glyph filter to generate and visualize arrows or other glyph geometry at each point.The effect is shown in the figure below。  
 ![vector显示效果](https://discourse.paraview.org/uploads/default/original/2X/9/99390f9a9703a563fe79ffb643759aa704f45e81.png)  
But this effect is not in line with our requirements. We hope that the arrow of flux will be associated with the geometric size of element. The length of the arrow should be 0.7 to 0.9 based on the line segment between the vector and element.  
What shall I do? Can I set it through paraview software?  
Now I have calculated the intersection of vector flux and elements through C + +. How can I express it in VTK file to display it correctly in paraview?

---

<div class="post-metadata">

### Author: ![pavel](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pavel/32/8287_2.png) [@pavel](https://discourse.paraview.org/u/pavel)
#### Post date: [January 25, 2022, 3:53pm UTC](https://discourse.paraview.org/t/how-to-associate-the-length-of-vector-with-the-size-of-cells-when-we-draw-the-celldata-vector-flux-on-the-corresponding-xyz-coordinates/8804/2 "2022-01-25T15:53:06Z")

</div>

Hi Sofeiya,

If I undestand your question correctly, you can use ‘Python calculator’ filter to create a new array of vectors with the proper length (according to each cell size) and proper direction (according to Flux data). Here is an example how to create a new array of vectors where dx depends on the cell volume, and dy and dz are constant values:

![tree](https://discourse.paraview.org/uploads/default/original/2X/c/c2a8ed2f1cab7bd6548ae42fcb4b55924c7e8ab3.png)

![VECX](https://discourse.paraview.org/uploads/default/original/2X/f/f711b1bff76ee2a42a777714378d27d375741772.png)

![VECY](https://discourse.paraview.org/uploads/default/original/2X/0/035b282a0d36ae0050a63c5f0564fdd16c8185c0.png)

 ![VECZ](https://discourse.paraview.org/uploads/default/original/2X/a/af4dec0054ba5b9a335c00459dd9de44e73c2da3.png)

![VEC](https://discourse.paraview.org/uploads/default/original/2X/5/5ef1ee7acd7b95bf97ef026e76d49ab4c2360b7b.png)

 ![glyph](https://discourse.paraview.org/uploads/default/original/2X/d/d3248d7d00dd3f0327749e9e8d94165b35b96d1f.png)

and resulting view:

 ![view](https://discourse.paraview.org/uploads/default/original/2X/6/629e7c62a2df07a1bd0661b6938e9b3992c49c82.png)

You can tune the formulas inside Python calculator’s (to add the dependencies from Flux vectors components, and correct the dependency from cell sizes).

Does it works for you?

Best Regards,  
Pavel

---

<div class="post-metadata">

### Author: ![sofeiya2021](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sofeiya2021/32/7148_2.png) [@sofeiya2021](https://discourse.paraview.org/u/sofeiya2021)
#### Post date: [January 27, 2022, 7:06am UTC](https://discourse.paraview.org/t/how-to-associate-the-length-of-vector-with-the-size-of-cells-when-we-draw-the-celldata-vector-flux-on-the-corresponding-xyz-coordinates/8804/3 "2022-01-27T07:06:41Z")

</div>

![orient_vec](https://discourse.paraview.org/uploads/default/original/2X/7/7cf6046f1a81a7e8b12117dc48ddf48c90b46551.png)  
when the Orientation Array of Glyph1 is vec,the display effect of vector is consistent with our expectation.But in my project,the Orientation Array of Glyph1 should be flux,when change the Orientation Array to flux,The starting point of vector is wrong. It always starts from the center of gravity of the cell。We want it to go from one face of the cell to another  
 ![orient_flux](https://discourse.paraview.org/uploads/default/original/2X/d/d898427a8562a48057b2db6f71a303bb9b759263.png)

---

<div class="post-metadata">

### Author: ![pavel](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pavel/32/8287_2.png) [@pavel](https://discourse.paraview.org/u/pavel)
#### Post date: [January 27, 2022, 8:15am UTC](https://discourse.paraview.org/t/how-to-associate-the-length-of-vector-with-the-size-of-cells-when-we-draw-the-celldata-vector-flux-on-the-corresponding-xyz-coordinates/8804/4 "2022-01-27T08:15:07Z")

</div>

You wrote

> [@sofeiya2021](#):
>
> when the Orientation Array of Glyph1 is vec,the display effect of vector is consistent with our expectation

but starting point of vector is in the center of gravity of the cell in both Figures. Could you please clarify?

---

<div class="post-metadata">

### Author: ![sofeiya2021](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sofeiya2021/32/7148_2.png) [@sofeiya2021](https://discourse.paraview.org/u/sofeiya2021)
#### Post date: [January 27, 2022, 9:16am UTC](https://discourse.paraview.org/t/how-to-associate-the-length-of-vector-with-the-size-of-cells-when-we-draw-the-celldata-vector-flux-on-the-corresponding-xyz-coordinates/8804/5 "2022-01-27T09:16:48Z")

</div>

> [@sofeiya2021](#):
>
> We want it to go from one face of the cell to another

I didn’t look carefully. I made a mistake.We want it to go from one face of the cell to another

---

<div class="post-metadata">

### Author: ![sofeiya2021](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sofeiya2021/32/7148_2.png) [@sofeiya2021](https://discourse.paraview.org/u/sofeiya2021)
#### Post date: [January 27, 2022, 9:17am UTC](https://discourse.paraview.org/t/how-to-associate-the-length-of-vector-with-the-size-of-cells-when-we-draw-the-celldata-vector-flux-on-the-corresponding-xyz-coordinates/8804/6 "2022-01-27T09:17:15Z")

</div>

> [@sofeiya2021](#):
>
> I didn’t look carefully. I made a mistake.We want it to go from one face of the cell to another

I didn’t look carefully. I made a mistake.We want it to go from one face of the cell to another

---

<div class="post-metadata">

### Author: ![pavel](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pavel/32/8287_2.png) [@pavel](https://discourse.paraview.org/u/pavel)
#### Post date: [January 27, 2022, 11:16am UTC](https://discourse.paraview.org/t/how-to-associate-the-length-of-vector-with-the-size-of-cells-when-we-draw-the-celldata-vector-flux-on-the-corresponding-xyz-coordinates/8804/7 "2022-01-27T11:16:17Z")

</div>

Thanks for clarification. You wrote:

> [@sofeiya2021](#):
>
> I have calculated the intersection of vector flux and elements

So, you have a set of points which could be the starting points for arrows. Do you want to add that pointset to model and try to create arrows representing the flux vectors based on them? You can try to do it by means of Python calculator or/and Python plugin.  
Maybe another option: that pointset is possible to do based on coordinates of vertices of the cell faces (centers of gravity of the faces).

---

<div class="post-metadata">

### Author: ![sofeiya2021](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sofeiya2021/32/7148_2.png) [@sofeiya2021](https://discourse.paraview.org/u/sofeiya2021)
#### Post date: [January 28, 2022, 2:10am UTC](https://discourse.paraview.org/t/how-to-associate-the-length-of-vector-with-the-size-of-cells-when-we-draw-the-celldata-vector-flux-on-the-corresponding-xyz-coordinates/8804/8 "2022-01-28T02:10:37Z")

</div>

> [@pavel](#):
>
> So, you have a set of points which could be the starting points for arrows. Do you want to add that pointset to model and try to create arrows representing the flux vectors based on them? You can try to do it by means of Python calculator or/and Python plugin.  
> Maybe another option: that pointset is possible to do based on coordinates of vertices of the cell faces (centers of gravity of the faces).

what’s the meaning of another option?Can you be more specific?

---

<div class="post-metadata">

### Author: ![sofeiya2021](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sofeiya2021/32/7148_2.png) [@sofeiya2021](https://discourse.paraview.org/u/sofeiya2021)
#### Post date: [January 28, 2022, 2:19am UTC](https://discourse.paraview.org/t/how-to-associate-the-length-of-vector-with-the-size-of-cells-when-we-draw-the-celldata-vector-flux-on-the-corresponding-xyz-coordinates/8804/9 "2022-01-28T02:19:13Z")

</div>

> [@pavel](#):
>
> Do you want to add that pointset to model and try to create arrows representing the flux vectors based on them?

Yes,I want to add that poinset to model and try to create arrows representing the flux vectors based on them.But,I don’t know how to do it?
