Paraview - visual bug for 820 - 827 ?

Mesh generators, CAD programs, and other tools
Post Reply
YannGuevel
Posts: 30
Joined: 26 May 2014, 12:37
Antispam: Yes

Paraview - visual bug for 820 - 827 ?

Post by YannGuevel »

Hello,

i'm still working around with Hexahedral quadratic 820 and Biquadratic 827 Elmer element types.
I noticed a visual bug in paraview (at least for 3.10 and 4.01 versions) when using VTU elmer result output solver.
The outer surfaces are more or lesse ok, but inside it's a bit strange, like if ordering was bad.

Gmsh H20 -> ElmerGrid 820 Hexa - Elmer UDS "Steady Path following FlowSolve" - ResOutput VTU - paraview

Anyone see that too when using 820 elements with paraview? is that a VTK VTU issue or Paraview, or Elmer output?

Thanks for your suggestions.
Attachments
Gmsh H20 -> ElmerGrid 820 Hexa - Steady Path following FlowSolve - ResOutput VTU - paraview
Gmsh H20 -> ElmerGrid 820 Hexa - Steady Path following FlowSolve - ResOutput VTU - paraview
VTU_Paraview_Cube_ElmerElementType820.png (114.83 KiB) Viewed 8888 times
YannGuevel
Posts: 30
Joined: 26 May 2014, 12:37
Antispam: Yes

Re: Paraview - visual bug for 820 - 827 ?

Post by YannGuevel »

There is a difference of ordering in 827 and code 29 TriQuadHexa of VTK

Code: Select all

       v
       ^
       |
       |    
       +----> u   
        \
         \
           w

Code: Select all

   GMSH H27 code12     ELMER H27 code 827   VTK TriQuadratic code 29
    3----13----2         4----11----3         3----10----2         
    |\         |\        |\         |\        |\         |\        
    |15    24  | 14      |16    23  | 15      |19    23  | 18      
    9  \ 20    11 \      12  \ 25    10 \     11  \ 24   9  \      
    |   7----19+---6     |   8----19+---7     |   7----14+---6     
    |22 |  26  | 23|     |24 |  27  | 22|     |20 |  26  | 21|     
    0---+-8----1   |     1---+-9----2   |     0---+-8----1   |     
     \ 17    25 \  18     \ 20    26 \  18     \ 15    25 \  13    
     10 |  21    12|      13 |  21    14|      16 |  22    17|     
       \|         \|        \|         \|        \|         \|     
        4----16----5         5----17----6         4----12----5     
I assume that for 820 something is also happening with ordering.

But i don't see in the Result Output Solver code where to modify the elment permutation for the VTU file...
YannGuevel
Posts: 30
Joined: 26 May 2014, 12:37
Antispam: Yes

Re: Paraview - visual bug for 820 - 827 ?

Post by YannGuevel »

Hi,
it looks like the 820 element is not correctly written out into VTU format.
I'll try to perform the permutation, but here are allready some informations.

--------------------------------------------------------------------------------------------------------
ELMER 820 -> QuadraticHexahedron -> VTU code 25
--------------------------------------------------------------------------------------------------------
Source :
http://www.vtk.org/doc/nightly/html/cla ... ml#details
vtkQuadraticHexahedron is a concrete implementation of vtkNonLinearCell to represent a three-dimensional, 20-node isoparametric parabolic hexahedron. The interpolation is the standard finite element, quadratic isoparametric shape function. The cell includes a mid-edge node. The ordering of the twenty points defining the cell is point ids
(0-7,8-19)
where point ids 0-7 are the eight corner vertices of the cube;
followed by twelve midedge nodes (8-19).
Note that these midedge nodes correspond lie on the edges defined by
8 (0,1),
9 (1,2),
10 (2,3),
11 (3,0),
12 (4,5),
13 (5,6),
14 (6,7),
15 (7,4),
16 (0,4),
17 (1,5),
18 (2,6),
19 (3,7).

--------------------------------------------------------------------------------------------------------

Code: Select all

ELEMENT 20 Node Octahedron
Dimension 3
Topology  Brick
Code 820
!ELMER     1    2    3    4    5    6    7    8    9    10   11  12   13   14   15   16   17   18   19   20
Node U   -1.0  1.0  1.0 -1.0 -1.0  1.0  1.0 -1.0  0.0  1.0  0.0 -1.0 -1.0  1.0  1.0 -1.0  0.0  1.0  0.0 -1.0
Node V   -1.0 -1.0  1.0  1.0 -1.0 -1.0  1.0  1.0 -1.0  0.0  1.0  0.0 -1.0 -1.0  1.0  1.0 -1.0  0.0  1.0  0.0
Node W   -1.0 -1.0 -1.0 -1.0  1.0  1.0  1.0  1.0 -1.0 -1.0 -1.0 -1.0  0.0  0.0  0.0  0.0  1.0  1.0  1.0  1.0
!  VTU     0    1    2    3    4    5    6    7    8    9    10   11   16  17   18   19   12   13    14   15 
--------------------------------------------------------------------------------------------------------

Code: Select all

  v          ELMER                  VTU
  ^
  |           4----11----3           3----10----2         
  |           |\         |\          |\         |\        
  +----> u    | 16       | 15        | 19       | 18      
   \         12  \       10 \       11  \       9 \      
    \         |   8----19+---7       |   7----14+---6     
      w       |   |      |   |       |   |      |   |     
              1---+-9----2   |       0---+-8----1   |     
               \  20      \  18       \  15      \  13
               13 |        14|        16 |        17|     
                 \|         \|          \|         \|     
                  5----17----6           4----12----5     
YannGuevel
Posts: 30
Joined: 26 May 2014, 12:37
Antispam: Yes

Re: Paraview - visual bug for 820 - 827 ?

Post by YannGuevel »

In the SUBROUTINE WriteVtuFile( VtuFile, Model, RemoveDisp )
One may modify the ordring for the Mesh, but i still need to reorder the datas... Work in progress...
Here is the code for permutation for at least 820 and 827 elements.

Code: Select all

    IF( WriteData ) THEN
      IF( BinaryOutput ) WRITE( VtuUnit ) k

      DO i = ElemFirst, ElemLast
        IF(.NOT. ActiveElem(i) ) CYCLE

        CurrentElement => Model % Elements(i)
        n = GetElementNOFNodes(CurrentElement)
       
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !                 
        ALLOCATE(Newind(n))            
        IF (Elmer2VTKElement(CurrentElement % TYPE % ElementCode) == 29) THEN
        ! Elmer 827 -> VTU 29        
            Newind(1:n) = (/1,2,3,4,5,6,7,8,9,10,11,12,17,18,19,20,13,14,15,16,24,22,21,23,25,26,27/)
   
        ElseIf (Elmer2VTKElement(CurrentElement % TYPE % ElementCode) == 25) THEN
        ! 820 -> 25
            Newind(1:n) = (/1,2,3,4,5,6,7,8,9,10,11,12,17,18,19,20,13,14,15,16/)
        ENDIF
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !                        
        DO j=1,n
          IF( AllNodesUsed ) THEN
! !             CALL AscBinIntegerWrite( CurrentElement % NodeIndexes(j) - 1 )
            CALL AscBinIntegerWrite( CurrentElement % NodeIndexes(Newind(j)) - 1 )
          ELSE
            CALL AscBinIntegerWrite( NodePerm( CurrentElement % NodeIndexes(j)) - 1 )
          END IF
        END DO
        DEALLOCATE(Newind)            

      END DO
      CALL AscBinIntegerWrite( 0, .TRUE. ) 
    END IF
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Paraview - visual bug for 820 - 827 ?

Post by raback »

Hi Yann

Great that you are working to implement the missing elements. Does the code already work (mainly the permutation). I could take it to the official version when I have a suitable slot.

-Peter
YannGuevel
Posts: 30
Joined: 26 May 2014, 12:37
Antispam: Yes

Re: Paraview - visual bug for 820 - 827 ?

Post by YannGuevel »

Hi,

the permutation works for the "CELL" part of the VTU for the 820.
A visual bug still occurs but the values in the celles looks really correct, so that it might be a paraview interpolation issue.
Streamlines are ok, silce with triangulate looks ok.
The figures are produced with paraview using slice (Triangulate and Crinkle (to get the elements)). Steady flow continuation in a 3D rectangular duct is performed with asymptotic numerical method in a UDS. Grid is 60x10x60 elements. Elements are ELMER code 820, import from Gmsh with ElmerGrid 14 2 -autoclean.

I'll try to confirm that the 827 is ok with the permutation.
Glad if it can help others.
Attachments
ElmerToVTU_820_FlowSolve_FRONT_MIDDLE_CELL_looksOK.png
One Cell in the middle of the INLET part. Values looks right.
(36.34 KiB) Not downloaded yet
ElmerToVTU_820_FlowSolve_FRONT.png
INLET 820 looks bad in Paraview with surface view
(73.76 KiB) Not downloaded yet
ElmerToVTU_820_FlowSolve_BACK.png
OUTLET 820 looks right in Paraview with surface view
(49.7 KiB) Not downloaded yet
Last edited by YannGuevel on 13 Mar 2015, 01:00, edited 1 time in total.
YannGuevel
Posts: 30
Joined: 26 May 2014, 12:37
Antispam: Yes

Re: Paraview - visual bug for 820 - 827 ?

Post by YannGuevel »

Slices with triangulate are ok with 820.
Attachments
gravity_INLET_SLICES_820_Triangulate_OK.png
Multiple slices are ok with triangulate option with 820 elements
(113.58 KiB) Not downloaded yet
YannGuevel
Posts: 30
Joined: 26 May 2014, 12:37
Antispam: Yes

Re: Paraview - visual bug for 820 - 827 ?

Post by YannGuevel »

One should take care of permutation when everythin is ok..."Newind(1:n) = (/ (i, i = 1, n) /) ! nothing change"

Code: Select all

    ! Write out the mesh
.....
.....
    IF( WriteData ) THEN
      IF( BinaryOutput ) WRITE( VtuUnit ) k
      DO i = ElemFirst, ElemLast
        IF(.NOT. ActiveElem(i) ) CYCLE
        CurrentElement => Model % Elements(i)
        n = GetElementNOFNodes(CurrentElement)
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !                 
        ALLOCATE(Newind(n)) 
         IF (Elmer2VTKElement(CurrentElement % TYPE % ElementCode) == 29) THEN
            ! Elmer 827 -> VTU 29        
            Newind(1:n) = (/1,2,3,4,5,6,7,8,9,10,11,12,17,18,19,20,13,14,15,16,24,22,21,23,25,26,27/)
         ElseIf (Elmer2VTKElement(CurrentElement % TYPE % ElementCode) == 25) THEN
            ! 820 -> 25
            Newind(1:n) = (/1,2,3,4,5,6,7,8,9,10,11,12,17,18,19,20,13,14,15,16/)
         ELSE
             Newind(1:n) = (/ (i, i = 1, n) /)   ! nothing change
         ENDIF
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !                 

        DO j=1,n
          IF( AllNodesUsed ) THEN
!------------------------------------------------------------------------------------------------
            CALL AscBinIntegerWrite( CurrentElement % NodeIndexes( Newind(j) ) - 1 )
!------------------------------------------------------------------------------------------------
         ELSE......
         ENDIF
        ENDDO

        DEALLOCATE(Newind) 
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Paraview - visual bug for 820 - 827 ?

Post by raback »

Hi Yann

The Vtu output has now been fixed on the devel branch at GitHub (in a slightly modified way). I hope it works as intended. Thanx for contributing!

-Peter
Post Reply