CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [General] Strange color mapping for stress (https://www.cfd-online.com/Forums/paraview/133519-strange-color-mapping-stress.html)

Zetison April 16, 2014 05:10

Strange color mapping for stress
 
My model simply contains four elements (each with 8 nodes with information about displacement and stress for each corner of the block) i get the following result

My modell contains discontinuity at the stresses. In the following image, the magnitude of the stress (von Mises?) is plotted

http://folk.ntnu.no/jonvegar/images/test2.png

Between the first and second element it should be discontinuity in the stress. The stresses throughout the first element is supposed to be zero. Is it because the color mapping does not accept discontinuous derivatives? How can it be fixed?

wyldckat April 16, 2014 15:37

3 Attachment(s)
Greetings Zetison and welcome to the forum!

If I understand you correctly and if I remember finite elements correctly, the problem is that:
  1. The values you have are only located at the nodes of the elements.
  2. ParaView usually represents point data with gradients; while cell (and face) data is represented as-is.
A solution that comes to mind if for you to reduce the number of gradient colours to be used in the representation.
In ParaView 3.12.0, the 3 images in attachment tell the story:
  1. Click on the button where the mouse cursor is at, in the first image.
  2. On the 2nd picture, in the edit box surrounded by the green hand-made circle, use the value 2 or 1. Then click on the "Close" button.
  3. Problem is that you might get something what's shown in the 3rd picture.

If this is not what you're looking for, then it can get really tricky, since it really depends on the representation you're looking for. And example would be helpful.

Best regards,
Bruno

Zetison April 17, 2014 02:32

Thank you for your reply.

The problem is that since I have discontinuous stresses, each node containing this discontinuity should have 2 set of values describing the stress. The first should describe the limit of the stress as one approches the point from the first element, while the other the limit point of the stress as one approches the point from the second element. But of course, Paraview only stores one value. So to solve the problem, I have to remake the vts file.

One idea that comes to mind was to use several "pieces", but for some reason this gave the exact same problem. I have created a much more simpler example in which two cubes are connected (as "pieces"). The stress in the first cube should be zero througout the domain, while it is non zero in the other:

http://folk.ntnu.no/jonvegar/images/test3.png

But as you can see, even with this idea, the problem still remains. The vts file I used is given as follows:

Code:

<?xml version="1.0"?>
<VTKFile type="StructuredGrid" version="0.1" byte_order="BigEndian" >
  <StructuredGrid  WholeExtent="0 2 0 1 0 1">
  <Piece Extent="0 1 0 1 0 1">
    <PointData Vectors="Disp"  >
      <DataArray type="Float64" Name="Stress" NumberOfComponents="6" format="ascii">
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
      </DataArray>
      <DataArray type="Float32" Name="Displacement" NumberOfComponents="3" format="ascii">
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
      </DataArray>
    </PointData>
    <Celldata>
    </Celldata>
    <Points>
      <DataArray type="Float32" Name="Array" NumberOfComponents="3" format="ascii">
 0 0 0
 1 0 0
 0 1 0
 1 1 0
 0 0 1
 1 0 1
 0 1 1
 1 1 1
      </DataArray>
    </Points>
  </Piece>
  <Piece Extent="1 2 0 1 0 1">
    <PointData Vectors="Disp"  >
      <DataArray type="Float64" Name="Stress" NumberOfComponents="6" format="ascii">
 0 0 0 0 0 0
 1 0 0 0 0 0
 0 1 0 0 0 0
 1 1 0 0 0 0
 0 0 1 0 0 0
 1 0 1 0 0 0
 0 1 1 0 0 0
 1 1 1 0 0 0
      </DataArray>
      <DataArray type="Float32" Name="Displacement" NumberOfComponents="3" format="ascii">
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
      </DataArray>
    </PointData>
    <Celldata>
    </Celldata>
    <Points>
      <DataArray type="Float32" Name="Array" NumberOfComponents="3" format="ascii">
 1 0 0
 2 0 0
 1 1 0
 2 1 0
 1 0 1
 2 0 1
 1 1 1
 2 1 1
      </DataArray>
    </Points>
  </Piece>
  </StructuredGrid>
</VTKFile>

The result of your solution is given below, and is abviously not satisfactory :(

http://folk.ntnu.no/jonvegar/images/test4.png

Are you using Paraview 4.1.0? I guess it could be smart to have the same version :)

wyldckat April 19, 2014 08:24

2 Attachment(s)
Hi Zetison,

Since you didn't specify which ParaView version you were using, I went with the one easiest for me to use.

Either way, as I mentioned before, you're trying to represent node data, therefore using the surface representation will not give you the results you want to see.
Attached are 2 ideas:
  1. You can use the wireframe representation, but it's not that great either.
  2. Or you can use the Glyph filter and use the settings shown in the second image. This way you get a more accurate representation.
    Note: the "Properties" tab was moved on top of the "Pipeline Browser" simply for the image snapshot.
Best regards,
Bruno

Zetison April 23, 2014 10:19

I see. But the surface representation is actually the only thing I am interested in. It gives a better view of how the stress is distributed over a surface of a domain.

If I make each element in a seperate VTS file, and view these files together in the same worksheet, I get the following result

http://folk.ntnu.no/jonvegar/images/test.png

Visually, the above picture represent exactly the represenation I want. However, my modell contains several thousan elements, and it is absurd to make so many vts files to visualize one object. Is it really no way to have this in one file?

wyldckat April 25, 2014 13:21

1 Attachment(s)
Hi Zetison,

OK, I've finally figured out, at least part of the issue.
  1. I didn't notice that you have 2 VTK pieces, one for each cube. That means you defined values for 16 points and not just for 12 points.
  2. You're using a structured grid. This means that there can only be one data value per point, i.e. VTK will merge data from overlapping points.
  3. Even if you use several pieces, the structured system in VTK will enforce that there can be only one data value per point.
I have not tried either one of the following possible solutions, but here's what I can figure out:
  1. You can try to use an unstructured grid instead of a structured one. Then you can repeat points and assign the values the you want for each point.
  2. Use a pseudo-structured grid, where you'll need to introduce ghost cells between each cell, with cell thickness of nearly 0.0... something like 1e-8. I tried to do this manually, but failed miserably :(
  3. Or you can use multi-block datasets... which would be rather cumbersome, as it would mean that you would have a million or so files (one per cell), all referenced by a single ".vtm" file...


I actually went ahead with the creation of a proof-of-concept of the unstructured grid, by using:
  1. the "Shrink" filter to shrink the cells by a factor of 0.9999 (edit: factor of 1.0 would have been enough);
  2. used "File -> Save Data" and saved to a ".vtu" file.
Then edited the file with a text editor and modified it to suit the data you're using in this example, file named "test2.vtu":
Code:

<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
  <UnstructuredGrid>
    <Piece NumberOfPoints="16" NumberOfCells="2">
      <PointData>
        <DataArray type="Float64" Name="Stress" NumberOfComponents="6" format="ascii" RangeMin="0" RangeMax="1.7320508076">
          0 0 0 0 0 0
          0 0 0 0 0 0
          0 0 0 0 0 0
          0 0 0 0 0 0
          0 0 0 0 0 0
          0 0 0 0 0 0
          0 0 0 0 0 0
          0 0 0 0 0 0
          0 0 0 0 0 0
          1 0 0 0 0 0
          1 1 0 0 0 0
          0 1 0 0 0 0
          0 0 1 0 0 0
          1 0 1 0 0 0
          1 1 1 0 0 0
          0 1 1 0 0 0
        </DataArray>
        <DataArray type="Float32" Name="Displacement" NumberOfComponents="3" format="ascii" RangeMin="1.7320508076" RangeMax="1.7320508076">
          1 1 1 1 1 1
          1 1 1 1 1 1
          1 1 1 1 1 1
          1 1 1 1 1 1
          1 1 1 1 1 1
          1 1 1 1 1 1
          1 1 1 1 1 1
          1 1 1 1 1 1
        </DataArray>
      </PointData>
      <CellData>
      </CellData>
      <Points>
        <DataArray type="Float32" Name="Points" NumberOfComponents="3" format="ascii" RangeMin="8.6602538191e-05" RangeMax="2.4494081284">
          0.0 0.0 0.0
          1.0 0.0 0.0
          1.0 1.0 0.0
          0.0 1.0 0.0
          0.0 0.0 1.0
          1.0 0.0 1.0
          1.0 1.0 1.0
          0.0 1.0 1.0
          1.0 0.0 0.0
          2.0 0.0 0.0
          2.0 1.0 0.0
          1.0 1.0 0.0
          1.0 0.0 1.0
          2.0 0.0 1.0
          2.0 1.0 1.0
          1.0 1.0 1.0
        </DataArray>
      </Points>
      <Cells>
        <DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="0" RangeMax="15">
          0 1 2 3 4 5
          6 7 8 9 10 11
          12 13 14 15
        </DataArray>
        <DataArray type="Int64" Name="offsets" format="ascii" RangeMin="8" RangeMax="16">
          8 16
        </DataArray>
        <DataArray type="UInt8" Name="types" format="ascii" RangeMin="12" RangeMax="12">
          12 12
        </DataArray>
      </Cells>
    </Piece>
  </UnstructuredGrid>
</VTKFile>

And I got the same result as you showed in the previous post:
http://www.cfd-online.com/Forums/att...2&d=1398446356

Best regards,
Bruno

Zetison April 26, 2014 08:45

It works perfectly! Thank you!

Is it any reason for choosing the somewhat random numbers 1.7320508076 and so on for the ranges?

wyldckat April 26, 2014 09:02

The field being represented in the image is the magnitude of the "Stress" field. For the point that has the "Stress" vector (1 1 1 0 0 0), means that the magnitude is:
Code:

sqrt(1^2 + 1^2 + 1^2 + 0^2 + 0^2 + 0^2) = 1.732050808

Zetison April 26, 2014 09:11

Isn't the magnitude of the stress given as von Mises Stress in paraView?

wyldckat April 26, 2014 09:21

Quote:

Originally Posted by Zetison (Post 488360)
Isn't the magnitude of the stress given as von Mises Stress in paraView?

Uhm... depends on which exact equation you're referring to!? Because if you want the one explained here: http://en.wikipedia.org/wiki/Von_Mis...al_formulation - then you will have to use the "Calculator" filter to do this calculation.

Either way, the usual calculation of magnitude automatically made in ParaView for tensors and vectors is the square root of the sum of the square values of each component, as implied in my previous post.

Zetison April 26, 2014 09:45

It was only my theory since if I add 6 components and call the input "Stress", the components are automatically labeled XX, YY, ZZ, XY, YZ, XZ (which refer to sigma_XX and so on). When I added a 7th component with von Mises stress, the labels went from 1 to 7, and the plot of von Mises stress was (as far as I could see) identical to the plot of the magnitude of the stress...

wyldckat April 26, 2014 09:58

Quote:

Originally Posted by Zetison (Post 488371)
the components are automatically labeled XX, YY, ZZ, XY, YZ, XZ (which refer to sigma_XX and so on).

This must be only a convention for upper matrix data representation. For a 3x3 matrix, the first 3 would be the diagonal and the other 3 the upper triangle; this is probably assuming the matrix is symmetric. If you have 9 elements, it should give the identification for the whole matrix.
This is because ParaView is a general purpose 3D data representation application, therefore it cannot do by default such calculations without further interaction by the user.

Zetison April 26, 2014 13:46

Ok. Thanks for the information! You have been very helpfull. :)

One finale question if you have time: Since I want to also add the von Mises stress such that I have 7 components, is it possible to name each component with XX, YY, ZZ, YZ, XZ, XY and von Mises, and skip the magnitude label?

wyldckat April 28, 2014 15:53

Quote:

Originally Posted by Zetison (Post 488408)
One finale question if you have time: Since I want to also add the von Mises stress such that I have 7 components, is it possible to name each component with XX, YY, ZZ, YZ, XZ, XY and von Mises, and skip the magnitude label?

AFAIK, it's not possible to do that. As I wrote before, the naming is automatic and there is no control over it.

The best that can be done is to have one field with the 6 components of "Stress" and another field just for the "von Mises" result.


All times are GMT -4. The time now is 01:22.