Open Mike637 opened 1 year ago
The definition of the hexahedron20 requires a specific order of nodes or adapted node connectivity. https://vtk.org/doc/nightly/html/classvtkQuadraticHexahedron.html#details
It should be:
import meshio
import numpy
import os
BASE_DIR = os.getcwd()
hex20_corrected = meshio.Mesh(
[
[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],
[0.5, 0.0, 0.0],
[1.0, 0.5, 0.0],
[0.5, 1.0, 0.0],#10
[0.0, 0.5, 0.0],
[0.5, 0.0, 1.0],# first wrong node
[1.0, 0.5, 1.0],
[0.5, 1.0, 1.0],
[0.0, 0.5, 1.0],
[0.0, 0.0, 0.5],
[1.0, 0.0, 0.5],
[1.0, 1.0, 0.5],
[0.0, 1.0, 0.5],
],
[("hexahedron20", [numpy.arange(20)])],
)
hex20_corrected.write(
os.path.join(BASE_DIR, "result_corrected.vtu"),
)
Code: ` import sys, numpy, os BASE_DIR = os.getcwd() import meshio hex20_mesh = meshio.Mesh( [ [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],
) hex20_mesh.write( os.path.join(BASE_DIR ,"result123.vtu"),
) ` After covertation I opened vtu file in paraview and saw wrong view of hexahedron.