Wrong surface mesh when the yarn is smaller than the domain

General discussion about TexGen.

Moderators: Martin, Developers

Post Reply
charles
Posts: 7
Joined: Sun Mar 07, 2021 2:21 am

Wrong surface mesh when the yarn is smaller than the domain

Post by charles »

Hi. I want to use Tetgen to generate meshes for Abaqus. I got bad elements on two ends of the yarn when the yarn is smaller than the domain.

For example, the size of the domain is 2x2.5x0.55. Two nodes of the yarn are (0.5,0,0.25) and (0.5,2.5,0.25) (see pic: model 1). So the yarn has the same size as the domain in the y-direction. I got the correct meshes (see pic: mesh1). When I shortened the yarn length or increased the size of the domain (see pic in the reply), I got the wrong meshes (see pic: mesh2). The tg3 file is attached in the reply.

The model is based on the default 3D weave model and I just did some simple modifications to it. The Tetgen parameters are pqAY, seed size is 0.4, periodic mesh is on and the resolution is 10. I've tried different options of the Tetgen and it has nothing to do with this error except the Y parameter. When I didn't use the Y parameter, I got the correct mesh of the yarn end, but the model was no longer periodic that two opposite faces didn't have the same mesh. The reason why it works when the Y is not used is that the surface mesh is not preserved, so Tetgen can modify the surface mesh. But I need the periodic boundary condition, so I have to include the Y parameter.

I think the problem is from the surface mesh, but I don't know how to solve this issue. I also tried to change the "TriangleCorners" in the tg3 file to different values, e.g. -1, 0, and 10, but it didn't work. Would you please tell me how to solve this problem?

Many Thanks,
Charles
model 1.png
model 1.png (29.55 KiB) Viewed 10940 times
mesh1.png
mesh1.png (154.93 KiB) Viewed 10940 times
mesh 2.png
mesh 2.png (13.93 KiB) Viewed 10940 times
charles
Posts: 7
Joined: Sun Mar 07, 2021 2:21 am

Re: Wrong surface mesh when the yarn is smaller than the dom

Post by charles »

Here is the picture when I shortened the yarn length.
model 2.png
model 2.png (22.57 KiB) Viewed 10939 times
Here is the tg3 file.
test.zip
(1.22 KiB) Downloaded 134 times
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Wrong surface mesh when the yarn is smaller than the dom

Post by louisepb »

Hi Charles,

When the tetgen mesh is generated with a yarn which intersects the domain it finds the intersection polygon and uses that to seed the triangulation. If you have a yarn which is entirely within the domain it will just use the surface mesh for the entire yarn which is sent to tetgen as an input. I think that there is a tetgen parameter which forces the input mesh to be retained so I guess you could try switching that off. Alternatively there is an input to the surface mesh bFillEnds which could be set to false to stop generating the mesh at the ends. I'm not sure how that would affect the tetgen mesh but could be worth a try.

Hope that helps,
Louise
charles
Posts: 7
Joined: Sun Mar 07, 2021 2:21 am

Re: Wrong surface mesh when the yarn is smaller than the dom

Post by charles »

Hi Louise,

Thank you very much for your reply. I tried to turn the tetgen parameter off, but the generated mesh is quite messy.

1. Is the surface meshed by Texgen and the two ends meshed by Tetgen?
2. Could you tell me how to set the input bFillEnds off?
3. Would you please also tell me which cpp file controls the surface mesh? It seems it's the yarn.cpp but I can't find the exact location.

Many Thanks,
Charles
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Wrong surface mesh when the yarn is smaller than the dom

Post by louisepb »

Hi Charles,

Sorry for the slow reply. It took a while for me to have the opportunity to investigate this.

The -Y parameter means that the input surface mesh is retained. The whole yarn surface is meshed by TexGen and set as the input to tetgen. You will see how the ends are meshed using the x-ray rendering. If you look at the files created when you do a tetgen export you will see the .poly file which is created. You can view all of the tetgen files by downloading the tetview program from the tetgen website.

I had to make a slight change to the code in order to get the mesh to create without the yarn ends being meshed. I was incorrect, it is the bAddEndCaps parameter which governs whether the yarn ends are filled or not (the bFillEnds is used when it cuts the domain surface). I added the bAddEndCaps to the AddSurfaceToMesh function to test the results. I there are no end caps then tetgen meshes the whole domain as one material but retaining the mesh on the yarn tube surface so this clearly is not what's needed.

The mesh is created by the CMesh class - there are several overloaded functions AddSurfaceToMesh() in CYarn which add the nodes and elements to the mesh.

The ideal solution would probably be to create a section mesh (created by CSectionMesh - look at the render textile volume to see what is created in this case and then add a triangulated version of this to the mesh sent to tetgen. I'd need to have a think about the best way to do that.

I don't think that gives you a solution I'm afraid but hopefully helps you to understand what is going on. Let me know if you have more questions.

Best wishes,
Louise
Post Reply