nutils icon indicating copy to clipboard operation
nutils copied to clipboard

bezier.tri yields two different element orientation

Open scdivi opened this issue 3 years ago • 2 comments

Hi,

I could create a VTK (or STL) based on extracting bezier.tri as connectivity to a set of vertices as follows:

bezier = domain.sample('bezier', 10)
points = bezier.eval(geom)
export.vtk(vtkpath, bezier.tri, points)

However, after exporting the generated geometry to a tool and observing the normal direction in each element, it shows that every alternative element has a inverted element orientation (see image below). I think this is not intentional and it would be better to rotate the orientation all to a direction.

For now, a simple fix is done using the following lines:

# Change element orientation
tri = bezier.tri.copy()
tri[1::2, 1] = bezier.tri[1::2, 2]
tri[1::2, 2] = bezier.tri[1::2, 1]

image

scdivi avatar Oct 13 '22 13:10 scdivi

To my knowledge the VTK file format does not make any promises about simplex orientations, so we don't consider the current situation an error. Which is not to say that we wouldn't consider changing the situation if it turns out that flipping elements helps a certain workflow. Can you explain in what practical scenario you are running into this issue?

gertjanvanzwieten avatar Oct 13 '22 14:10 gertjanvanzwieten

The flipping helps if we create a (multipatch) domain and geometry in nutils and export the sampled points and bezier triangulation to write an STL file or any other format that can be used in an existing commercial tool. With the right orientation one can use these exported files to run simulations in other platforms and compare it with IGA simulation based on nutils.

Without the right orientation, the exported STL surfaces act strange with application of normal forces, etc.

scdivi avatar Oct 13 '22 14:10 scdivi