CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] Warping Cells by Vectors?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ronwelty

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2014, 06:37
Default Warping Cells by Vectors?
  #1
New Member
 
Alessandro
Join Date: Apr 2014
Location: Italy
Posts: 19
Rep Power: 12
ronwelty is on a distinguished road
I am correctly using and displaying a large number of triangular cells, which constitute a 3D tessellation. I import the data from .vtk files and I also know the displacement of every group of cells (which is made of n triangles). The issue i found in displaying the deformed shape of the thing is: a lot of cells share edges and vertices, so it's impossible to define a point-based vector field to correctly represent the displacement. So i tried to define the disp vector as CELL_DATA but applying the "Warp By Vector" Filter on the so-defined vector is not giving correct results.
Any ideas?
ronwelty is offline   Reply With Quote

Old   April 24, 2014, 17:40
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Alessandro,

Sorry, I'm having trouble mentally visualizing the problem you're seeing.
Any chance you can share images of what you're seeing or a small test case we can load in ParaView to check this ourselves?

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   April 25, 2014, 05:53
Default
  #3
New Member
 
Alessandro
Join Date: Apr 2014
Location: Italy
Posts: 19
Rep Power: 12
ronwelty is on a distinguished road
Sorry if it was not clear enough. Basically I wanna do this:
imagine I have 2 triangles which share an edge (and so, 2 points). The total number of points in my model will be 4. Now, I want to move triangle 1 to the left, and triangle 2 to the right. The result I want obviously involves the creation of 2 extra-points since the two triangles will not share the edge anymore.
I would imagine I could do this by defining a CELL_DATA vector and applying it to the triangles, but this doesn't look to be working properly.
ronwelty is offline   Reply With Quote

Old   April 25, 2014, 15:15
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Alessandro,

Ah, then what you're looking for is essentially what's been discussed recently on this thread: http://www.cfd-online.com/Forums/par...ng-stress.html

If you scroll down to post #6, you'll see the solution I figured out today, which is to use an unstructured grid and to repeat the necessary points.

In addition, a way to split the triangles apart, is to apply the filter "Shrink" with a factor of 1.0, which will make sure to duplicate your points and separate the triangles.
The problem is that if you only use the "Shrink" filter, the damage is already done, in the sense that if you had repeated data for the coincident points in the data files, only 1 data value/group will be assigned to each point, therefore the other data value/group for the overlapping point will not be present in ParaView's loaded data.

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   April 26, 2014, 10:37
Default
  #5
New Member
 
Alessandro
Join Date: Apr 2014
Location: Italy
Posts: 19
Rep Power: 12
ronwelty is on a distinguished road
Hello Bruno, thanks for the support.
Anyways, duplicating point, at least for me, is not an option. In my analyses I have something like 75,000 points in the mesh and the connectivity is so dense I would need to duplicate every point at least 50 times, which makes it impossible to realize. Also, the size of the files would become just too big (I am working with 5-8 GB of files for a 200 time steps analysis).
Any other idea?
I tried using shrink, but at that point how can I tell ParaView I need to pass the cell_data to the points connecting the cell? The filter "Cell Data to Point Data" isn't doing that properly!
ronwelty is offline   Reply With Quote

Old   April 26, 2014, 11:17
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Alessandro,

Quote:
Originally Posted by ronwelty View Post
Anyways, duplicating point, at least for me, is not an option. In my analyses I have something like 75,000 points in the mesh and the connectivity is so dense I would need to duplicate every point at least 50 times, which makes it impossible to realize. Also, the size of the files would become just too big (I am working with 5-8 GB of files for a 200 time steps analysis).
Welcome to the world of big data!?
Because the way I see it, the size of the files should not increase all that much, because technically you're already repeating points in your structured mesh, in the files you already have. The difference is that you're not getting a representation of the repeated data, because it's being discarded during the loading process.


Quote:
Originally Posted by ronwelty View Post
I tried using shrink, but at that point how can I tell ParaView I need to pass the cell_data to the points connecting the cell?
As I wrote in the previous post, once the data is loaded from the structured data, it's already too late. The VTK library (which ParaView uses) will already have loaded all of the data and discarded the repeated data.

Quote:
Originally Posted by ronwelty View Post
The filter "Cell Data to Point Data" isn't doing that properly!
In ParaView and for your case of triangle-shaped faces, the "cell data" means that the data is present at the centre of each triangle. If the triangles do actually make up cells, then it's even worse, as the "cell data" is only for the centre of the cells.

Quote:
Originally Posted by ronwelty View Post
Any other idea?
Yes, but you probably won't like it
If you do use "cell data" to store data at the centre of the cells, where each cell is composed by N triangles... oh, wait this is what you have!...
OK, as I was describing, the "cell data" will actually need to store a massive amount of data to be later redistributed to each point. Essentially, each cell centre would have to store all points of the cell and their respective values. Then you would have to use the "Shrink" filter, followed by the "Programmable Filter" filter in ParaView for coding a Python algorithm that reassigns the data at each centre to each point. In other words, it would sort-of uncompress the data.

Therefore, the way I see it, either you have 5-8GB in data and take 2-5 minutes to uncompress the data for each iteration, or you have 8-11GB in data and take 1 minute to load each iteration.

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   April 26, 2014, 11:55
Default
  #7
New Member
 
Alessandro
Join Date: Apr 2014
Location: Italy
Posts: 19
Rep Power: 12
ronwelty is on a distinguished road
Hmmm I do not have any repeated point in the data I load. Why should I? If a node is connected to more than 1 cell I just create 1 point and join all the needed cell. So no, my files are 3GB and contain zero repeated data.
Repeating 50-100 times every node for this reason means a 100ish GB file, which not only takes a little more than 1 minute to be loaded, but also means I can store 8-10 simulations in a TB hard drive and then it's over.
Last, but certainly not least, in some cases it would be very long to compute how many times I should repeat a certain point, and then duplicate it and change ALL my connectivity matrix along. Also, defining displacement as POINT_FATA instead of CELL_DATA would increase file size even more (cell numbers are approx 100 times more than point numbers), so that would probably lead to 200ish GB files?.?

PS: I am not using any structured mesh!!
ronwelty is offline   Reply With Quote

Old   April 26, 2014, 14:39
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Alessandro,

Sorry about that. I got confused between the topics of this thread and the other thread I mentioned above. Since the issue seemed so similar, I wrongly assumed you were also using a structured mesh . And usually on weekends I tend to be a bit more slow... long week, need the rest, so my brain turns off a few features

Having a simple test case for opening in ParaView would help, so that I could think a bit better by looking at the data and to deduce a few ideas... and to not loose track of the topic being discussed.

Let me see if I can imagine/visualize this... your mesh is composed of polyhedral cells, all of which are composed by triangle faces. You're storing the displacement data in "cell data" mode. I've re-read your posts and I can't tell for certain how exactly the data is stored for each cell. You've mentioned a connectivity matrix and displacement vectors you need to impose on each point... for moving those points, to reflect the displacement.

OK, there are two ways you might be storing your data:
  • Polygonal data, perhaps using stripped triangles for performance. The cell data in this case would be stored in the faces of the triangles.
  • Unstructured mesh, which would mean that the cell data would be stored in the centre of the cells.
From your description, I believe it's polygonal data.

Now, the connectivity matrix for the 2 triangles example would indicate that the displacement (X1_2, Y1_2, Z1_2) in a particular triangle ID1 refers to another triangle face ID2; since the triangles are connected by 2 points, this would mean that those two points would be equally displaced.
The problem with this scenario, is that... this seems a pretty hectic problem: by moving 2 points, all other triangles would feel this displacement, unless either:
  1. you somehow make the motion to be in a shrink direction only, i.e. preserve the location of the centre and normal of the triangle and displace the now duplicate points towards the centre of their own triangle... or
  2. the centre stays, but the points move along the displacement vector, 50% of the length of the vector for each pair of duplicate points.
Wow, this feels like a pretty amazing representation of displacement!


The wrap cells by vectors won't work for this, because it was designed for the vertexes to remain attached.
What you need is to, after loading the data in ParaView, first apply the "Shrink" filter with a factor of 1, so that the points are cloned for each triangle. Then you've have to use the "Programmable Filter" for:
  1. Iterating over each and every triangle;
  2. correlate the displacement with in the other connected triangle;
  3. and apply the displacement to each pair of pairs of points... in other words, apply the displacement to the 2 point-pairs of duplicate points, e.g. a1+a2 and b1+b2, where c1 and c2 are unrelated points between the the two triangles.
The examples that you can follow for ideas on how to implement this:
  1. The very first example from this page: http://www.paraview.org/Wiki/Python_Programmable_Filter - gives an example on how to manipulate the point locations.
  2. The examples "Tetrahedra Volume (Filter)" and "Tetrahedra Radius (Filter)" on this page http://www.paraview.org/Wiki/ParaVie...Python_Filters - give an example on how to iterate over each cell. Although it's for unstructured grids, the only detail that changes is the class type of the "pdi" variable, which isn't even addressed directly in the Python code in the filter.
For me to able to help you beyond this, I really need a simple test case, otherwise (assuming I find the time) I'll probably go off in a tangent with some convoluted data format .

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   April 28, 2014, 05:52
Default
  #9
New Member
 
Alessandro
Join Date: Apr 2014
Location: Italy
Posts: 19
Rep Power: 12
ronwelty is on a distinguished road
Dear Bruno, first of all I want to thank you for your support.
My script is structured like this: I have a very large number of triangles, and they are subdivided into groups, every group must move altogether. To do so, I define a cell_data vector (same size as number of triangles) in which I define the displacement for every triangle (it means that I forcedly repeat the displacement values for all the triangles that must move together). I am using Unstructured grids and 3-point cells in Paraview.
A little example could be like this:

Code:
# vtk DataFile Version 4.0 
Unstructured grid legacy vtk file with point scalar data 
ASCII 
DATASET UNSTRUCTURED_GRID 
POINTS 6 float 
0 0 0
1 0 0
2 0 0
2 1 0
1 1 0
0 1 0

CELLS 4 16 
3 0 4 5
3 0 1 4
3 1 3 4
3 1 2 3

CELL_TYPES 4 
5 
5 
5 
5 


CELL_DATA 4 
VECTORS disp float 
-1.0 0.0 0.0
-1.0 0.0 0.0
1.0 0.0 0.0
1.0 0.0 0.0
So basically, I want to warp the first 2 triangles in -X dir and the remaining 2 in +X dir. I thought this kind of syntax could do it?
Thanks again.


EDIT: applying the Shrink filter with a factor of 1 and THEN the warp by vector filter seems to work.
This is the results I obtain before warping:



and this is after warping:



Do you think this can be a permanent solution to the problem?
ronwelty is offline   Reply With Quote

Old   April 28, 2014, 15:47
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by ronwelty View Post
Do you think this can be a permanent solution to the problem?
This makes everything a lot more clear!
OK, then if you only care about the displacement made to the centres of the triangles, then yes, this should do the trick!
The steps seem to be:
  1. Apply the "Shrink" filter with a factor of 1.
  2. Apply the "Cell Data to Point Data" filter.
  3. And finally apply the "Warp by Vector" filter.
If you do step #2 before #1, then you risk getting interpolated values for the triangle vertices.

My question is: is the displacement of each triangle already globally calculated or is it relative to each other?
Because these steps assume the displacement is global, if I'm not mistaken.
wyldckat is offline   Reply With Quote

Old   April 29, 2014, 06:52
Default
  #11
New Member
 
Alessandro
Join Date: Apr 2014
Location: Italy
Posts: 19
Rep Power: 12
ronwelty is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
This makes everything a lot more clear!
OK, then if you only care about the displacement made to the centres of the triangles, then yes, this should do the trick!
The steps seem to be:
  1. Apply the "Shrink" filter with a factor of 1.
  2. Apply the "Cell Data to Point Data" filter.
  3. And finally apply the "Warp by Vector" filter.
If you do step #2 before #1, then you risk getting interpolated values for the triangle vertices.

My question is: is the displacement of each triangle already globally calculated or is it relative to each other?
Because these steps assume the displacement is global, if I'm not mistaken.
Dear Bruno,

as you can see from the screenshots I posted, the "Cell Data to Point Data" filter is not even needed. This means ParaView understands the CELL_DATA vector is applied to the triangles and not to the points. The only step needed is the "Shrink" filter, otherwise the displacement gets interpolated and the triangles don't split!
And yes, you're right, the displacement is calculated in the global reference system.
wyldckat likes this.
ronwelty is offline   Reply With Quote

Reply

Tags
warp vector cells


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] snappyHexMesh <-> dynamicMeshDict problem with protected cells Billy_16 OpenFOAM Meshing & Mesh Conversion 2 November 21, 2020 04:34
cellZone not taking all the cells inside rahulksoni OpenFOAM Running, Solving & CFD 6 January 25, 2019 01:11
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 10:38
[snappyHexMesh] snappyHexMesh matches wrong cells to CellZone Siegunn OpenFOAM Meshing & Mesh Conversion 4 July 31, 2015 06:10
snappyhexmesh remove blockmesh geometry philipp1 OpenFOAM Running, Solving & CFD 2 December 12, 2014 11:58


All times are GMT -4. The time now is 02:39.